Search code examples
node.jsstripe-paymentsstripe-tax

Problem creating customer account stripe nodejs


I'm having trouble creating a stripe client account in node.

ALL CODE:

 const customer = await stripe.customers.create({
  email: emailAddress,
  description: uid,
  name: name_lastname,
  address: {city: "Warszawa",
      country: "Poland",
      line1: "Testowa",
      line2: "22",
      postal_code: "00-001",
      state: "mazowieckie"
    },
  source: token,
  tax: {
        location: {
          source: 'billing_address',
        },
     },
});

If I add tax: {} to stripe.customers.create:

  tax: {
        location: {
          source: 'billing_address',
        },
     },

the customer's account is not created, if I delete it and the code looks like this, everything works fine:

 const customer = await stripe.customers.create({
  email: emailAddress,
  description: uid,
  name: name_lastname,
  address: {city: "Warszawa",
      country: "Poland",
      line1: "Testowa",
      line2: "22",
      postal_code: "00-001",
      state: "mazowieckie"
    },
  source: token,
});

I used this link: https://stripe.com/docs/api/customers/object?lang=node

I just want to give the client the appropriate TAX rate when creating the client, so that it will add taxrate automatically based on the given country in the billing address.


Solution

  • If you look at doc specific to the Create Customer API request you'll see that the only customer.tax attribute you can add is ip_address.

    Additionally taxes will not automatically get added unless you are using some other tool or integration to handle that. Stripe Tax is an option there but it doesn't cover all use cases.

    In general the address parameter should be fine fo most use cases.