Export transactions require a customer name and address - Stripe Error

14,388

Solution 1

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

Note: line1 is required in address object

Solution 2

change the currency to INR from USD

i was working on Node & React this helps me

currency: 'INR'

this will fix your problem probably.

Solution 3

Even I was facing the same issue.

Just make sure you are putting the same currency.

For example: if you have mentioned india as your country then put "inr" else "usd" use this for your reference:

    customer=stripe.Customer.create(
        email=request.POST["email"],
        name=request.POST["nickname"],
        source=request.POST["stripeToken"],
        )
        customer=stripe.Customer.modify(
            customer.id,
            address={"city":"mumbai","country":"india","line1":"unr","line2":"thane","postal_code":"421005","state":"maharashtra"},
        )
        charge=stripe.Charge.create(
        customer=customer,
        amount=500,
        currency='inr',
        description="payment"
        )

Solution 4

i had this issue in stripe nodejs i fixed it by passing address

const stripeAddress: Stripe.AddressParam = {
        line1: userAddress.street1,
        line2: userAddress.street2,
        city: userAddress.city,
        country: userAddress.country,
        postal_code: userAddress.zip,
        state: userAddress.state,
      };




 const stripeCustomer: Stripe.Customer = await this.stripe.customers.create(
    {
      name: userData.name,
      description: userData.description,
      email: userData.email,
      phone: userData.phoneNumber,
      address: stripeAddress,
    }
  );
Share:
14,388

Related videos on Youtube

Shadow
Author by

Shadow

Updated on September 29, 2022

Comments

  • Shadow
    Shadow over 1 year

    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"

    My code is like below:

    \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 
            ) 
        )); 
    
  • beginner115
    beginner115 over 4 years
    where is this → '$address'?
  • Frank
    Frank over 4 years
    @beginner115 it's an array. Reference: stripe.com/docs/india-exports#export-of-services
  • Sivaranjani D
    Sivaranjani D about 4 years
    How to add the test address?
  • Marjeta
    Marjeta almost 4 years
    Please use `` to indicate code, for example `customer=stripe.Customer...`, which then displays as customer=stripe.Customer... If you have a block of code, then separate the code with at least one empty line, and indent the code by 4 spaces.
  • Pankaj Cheema
    Pankaj Cheema over 3 years
    stripe is not for INR only please guide someone in correct direction
  • Govind Kumar Thakur
    Govind Kumar Thakur over 3 years
    sir, for indian cutomer stripe developer had made some changes so you can credit the user in term of INR and build your own logic to convert into other currency hope this will help you.
  • Agus Mathew
    Agus Mathew almost 3 years
    Worked for me as well.