【问题标题】:Stripe "No such token: " error条纹“没有这样的令牌:”错误
【发布时间】:2016-07-10 13:56:54
【问题描述】:

我的条带帐户配置为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:

【问题讨论】:

    标签: php laravel laravel-4 stripe-payments


    【解决方案1】:

    来自 Laravel 的 _token 输入是 CSRF 令牌。这不是您应该传递给 source 字段中的条带的令牌。 source 字段中的令牌应该是由 stripe.js 库生成的令牌,它允许您在不实际查看信用卡详细信息的情况下识别客户的信用卡。

    条纹文档解释了您应该如何处理这个https://stripe.com/docs/stripe.js

    【讨论】:

      猜你喜欢
      • 2017-10-02
      • 2018-10-21
      • 2017-05-12
      • 2022-06-24
      • 2021-08-23
      • 1970-01-01
      • 1970-01-01
      • 2020-12-30
      • 2019-05-20
      相关资源
      最近更新 更多