如何将测试余额添加到条带测试帐户以测试API集成

时间:2020-07-03 19:40:18

标签: stripe-api stripe-testing

有什么方法可以立即在测试模式下向Stripe帐户添加余额以进行API集成测试?

1 个答案:

答案 0 :(得分:1)

条带允许向“余额”收费以紧急测试帐户,以便开发人员可以测试条带集成

$stripe = new \Stripe\StripeClient('Your_Test_SK');
$stripe->charges->create([
  'amount' => 2000,
  'currency' => 'usd',
  'source' => 'tok_bypassPending',
  'description' => 'My First Test Charge (created for API docs)',
]);

紧急使用tok_bypassPending作为source费用测试帐户余额的值
API文档: https://stripe.com/docs/api/charges/create
测试令牌文档: https://stripe.com/docs/testing?lang=php#cards-responses
移至“令牌”标签,首先是该令牌
令牌文档截屏: https://i.stack.imgur.com/55otJ.png