本文介绍了出口交易需要客户姓名和地址 - 条纹错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Stripe SDK 来创建客户和使用 API 向客户收费,但收到错误消息 致命错误:未捕获(状态 400)(请求 req_ZyqUtykjUcOqrU)根据印度法规,出口交易需要客户姓名和地址.更多信息请访问:https://stripe.com/docs/india-exports 扔在/opt/lampp/htdocs/stripe/lib/Exception/ApiErrorException.php 第 38 行"

I'm using stripe SDK for creating customers & charge to a customer using API, but getting an error with "Fatal error: Uncaught (Status 400) (Request req_ZyqUtykjUcOqrU) As per Indian regulations, export transactions require a customer name and address. More info here: https://stripe.com/docs/india-exports thrown in /opt/lampp/htdocs/stripe/lib/Exception/ApiErrorException.php on line 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 
        ) 
    )); 

推荐答案

由于您的错误提示您需要按照以下示例在 stripe customer create API 中传递地址对象

As your error suggested you need to pass address object in stripe customer create API as per below example

$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

Note: line1 is required in address object

这篇关于出口交易需要客户姓名和地址 - 条纹错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 01:59