Sha*_*dow 8 php stripe-payments
我正在使用 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)
小智 10
由于您的错误建议您需要按照以下示例在条带客户创建 API 中传递地址对象
$customer = \Stripe\Customer::create(array(
'name' => 'test',
'description' => 'test description',
'email' => $email,
'source' => $token,
"address" => ["city" => $city, "country" => $country, "line1" => $address, "line2" => "", "postal_code" => $zipCode, "state" => $state]
));
Run Code Online (Sandbox Code Playgroud)
注意:地址对象中需要 line1
| 归档时间: |
|
| 查看次数: |
11741 次 |
| 最近记录: |