【发布时间】:2018-02-11 03:20:28
【问题描述】:
我使用的是 Stripe,之前我的所有订阅都可以正常工作。 就在最近,我试图将相同的代码移动到不同的条带帐户,并且在尝试收取订阅费用时收到错误消息。
<?php
require_once('../stripe-php-master/init.php');
// (switch to the live key later)
\Stripe\Stripe::setApiKey("sk_test_hlQNSE1fy1cGmsqDSbR9LfDF");
try
{
$customer = \Stripe\Customer::create(array(
'email' => $_POST['stripeEmail'],
'source' => $_POST['stripeToken'],
'plan' => 'basic_annually'
));
header('Location: ../../subscription-success.html');
exit;
}
catch(Exception $e)
{
header('Location:oops.html');
error_log("unable to sign up customer:" . $_POST['stripeEmail'].
", error:" . $e->getMessage());
}
这将返回以下错误
unable to sign up customer: 'test@example.com', error:No such plan: basic_monthly; one exists with a name of basic_monthly, but its ID is 504102373103330.
【问题讨论】:
-
正如您所说,您正在尝试对不同的 Stripe 帐户使用相同的代码。那个 Stripe 帐户是否有定义
IDbasic_annually的计划?? -
是的,如果
ID是504102373103330你需要在plan中传递它
标签: php stripe-payments checkout stripe.js