我的 strip 帐户配置了 test
。并在我的 Laravel 应用程序中使用 test
键。
发帖时,如果不存在这样的话,我正在创建新的 stripe user
,
Stripe::setApiKey(Config::get('constants.features.stripe.secret'));
$token = $input['_token'];
$customer = Stripe_Customer::create(array(
"description" => "#{$user->id} / {$user->username} / {$user->email}",
"source" => $token,
"email" => $user->email
));
像这样创造电荷,
$charge = Stripe_Charge::create(array(
"amount" => '5000',
"currency" => "gbp",
"customer" => $customer->id,
"description" => 'description',
"statement_descriptor" => strtoupper("test desc")
));
但它返回错误
Stripe_InvalidRequestError No such token:
最佳答案
来自 Laravel 的 _token
输入是 CSRF token 。这不是您应该在 source
字段中传递给 stripe 的 token 。 source
字段中的 token 应该是由 stripe.js 库生成的 token ,它允许您识别客户信用卡而无需实际查看信用卡详细信息。
条纹文档解释了您应该如何处理这个 https://stripe.com/docs/stripe.js
关于php - 条纹 "No such token: "错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36175413/