我正在使用 Stripe SDK 创建客户并使用 API 向客户收费,但出现“致命错误:未捕获(状态 400)(请求 req_ZyqUtykjUcOqrU)”的错误。根据印度法规,出口交易需要客户姓名和地址。更多此处的信息:https : //stripe.com/docs/india-exports 在第 38 行的 /opt/lampp/htdocs/stripe/lib/Exception/ApiErrorException.php 中抛出“
我的代码如下:
\Stripe\Stripe::setApiKey(STRIPE_API_KEY);
$customer = \Stripe\Customer::create(array(
'name' => 'test',
'description' => 'test description',
'email' => $email,
'source' => $token
));
$orderID = strtoupper(str_replace('.','',uniqid('', true)));
$charge = \Stripe\Charge::create(array(
'customer' => $customer->id,
//'source' => 'rtest',
'amount' => $itemPrice,
'currency' => $currency,
'description' => $itemName,
'metadata' => array(
'order_id' => $orderID
)
));
Run Code Online (Sandbox Code Playgroud)