简体   繁体   English

在Laravel中使用Stripe在测试模式下创建费用,但不能实时运行

[英]Create charge using Stripe in Laravel working in test mode but not in live

Hope somebody can help me with this one. 希望有人可以帮助我。 I am clueless right now. 我现在一无所知。

I just started stripe for the first time. 我是第一次开始条纹。 Looks like an amazing service. 看起来像是一项了不起的服务。

Have created a test application and started testing. 已经创建了测试应用程序并开始测试。 Everything works as it should. 一切正常。

Now after signing up, I want to go live. 现在注册后,我想开始直播。 Here is where the problem occurs. 这是发生问题的地方。

Somehow, it keeps saying no such token, when I can see the token standing in the stripe account. 不知何故,当我看到令牌存储在条带化帐户中时,它一直没有说这样的令牌。 The id of the account and our database is completely the same. 该帐户的ID与我们的数据库完全相同。

Stripe::setApiKey('[our live token]'); 

/*
* create new customer
*/
$results = \Stripe\Charge::create([
   "amount"            =>          '10',
   "currency"          =>          "jpy",
   "source"            =>          $getCommission->unique_id,
   "description"       =>          "test charge"
]);

Anybody has ever experienced this? 有人经历过吗?

It keeps saying the following 它一直在说以下

No such token: cus_EuguGZgeDoCxBj

Help is highly appriciated. 高度重视帮助。

Wesley 韦斯利

You are providing customer id instead of source token. 您正在提供客户ID而不是源令牌。

Source Token : 来源令牌:

Source token is token which is used for referenced of your cards. 源令牌是用于引用您的卡的令牌。 Generated from Stripe.js 从Stripe.js生成

\Stripe\Stripe::setApiKey("sk_test_4eC39HqLyjWDarjtT1zdp7dc");

\Stripe\Charge::create([
      "amount" => 2000,
      "currency" => "usd",
      "source" => "tok_amex", // obtained with Stripe.js
      "description" => "Charge for jenny.rosen@example.com"
 ]);

How to get Default Source : 如何获得默认来源:

  1. Get Stripe Customer 获取条纹客户
  2. Get default source on the Behalf of that customer 代表该客户获取默认来源

      \\Stripe\\Stripe::setApiKey("sk_test_4eC39HqLyjWDarjtT1zdp7dc"); $customer = \\Stripe\\Customer::retrieve('cus_EkSwM3JX7f0ueA'); $customer->default_source; // use this as source token 

    Use default source as source token 使用默认来源作为来源令牌

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM