gpt4 book ai didi

php - 导出交易需要客户姓名和地址 - Stripe 错误

转载 作者:行者123 更新时间:2023-12-04 22:21:33 25 4
gpt4 key购买 nike

我正在使用 strip SDK 创建客户并使用 API 向客户收费,但出现 错误“ fatal error :未捕获(状态 400)(请求 req_ZyqUtykjUcOqrU)根据印度法规,导出交易需要客户姓名和地址。更多信息:https://stripe.com/docs/india-exports 抛出/opt/lampp/htdocs/stripe/lib/Exception/ApiErrorException .php 在第 38 行"

我的代码如下:

\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
)
));

最佳答案

正如您的错误所暗示的,您需要按照以下示例在 strip 客户创建 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]
));

注意:地址对象中需要 line1

关于php - 导出交易需要客户姓名和地址 - Stripe 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59282024/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com