使用以前使用条带创建的客户创建的令牌进行收费时出现错误。我需要能够多次向用户收费,以便收费可以转到多个目的地,这就是我创建令牌的原因。但是,当尝试使用以下代码向任何人收费时,我收到错误:
致命错误:未捕获的异常“Stripe\Error\InvalidRequest”与消息“没有这样的令牌:tok_187sfmBqiK1u6WYC3qS20eNu”
$stripe_id 和其他变量已在我的代码中分配,我只是复制/粘贴主要位:
\Stripe\Stripe::setApiKey("sk_mykey-changedforsecurity"); // authorises secret key
$token = $_POST['stripeToken'];
$customer = \Stripe\Customer::create(array(
"description" => "test customer",
"source" => $token // obtained with Stripe.js
));
$chargetoken = \Stripe\Token::create(
array("customer" => $customer->id),
array("stripe_account" => $stripe_id) // id of the connected account
);
$charge = \Stripe\Charge::create(array(
"amount" => $price,
"currency" => "gbp",
"source" => $chargetoken,
"description" => $title,
"application_fee" => 20,
"destination" => $stripe_id
));
任何帮助将不胜感激,
谢谢