#arielbo-tax

1 messages · Page 1 of 1 (latest)

glass junco
wild talon
#

hello koo

#

I use this code: 'automatic_tax' => [
'enabled' => true,
],

glass junco
#

@wild talon hello! Happy to help but that's 1% of the info 🙂

wild talon
#

and POST /v1/subscriptions
Status
400 ERR
ID
req_WeCsj0HnP8fUu9

#

yes I explain me better

glass junco
#

so did you put the address on the customer first? If not why not? Which doc are you following?

#

So I see this customer has an address in bolivia, but the country is the full name, it should be a country code

#

did you look at the tax hash on customer?

#

my guess is that it has an error right now

wild talon
#

what I want to know is what address information is necessary for the 'automatic_tax' to work => [
'enabled' => true,
],

I am currently asking only the country and the city, do you need more data? is it the same for all countries?

glass junco
#

you never gave the city though, you also didn't pass the right country code

#

and it's all in our docs

wild talon
#

I understand maybe is something like BO not Bolivia

#

right?

glass junco
#

correct

#

And make sure to properly look at the tax array in the respond, you have to expand it with 'expand' => ['tax'] on customer creation

#

and then read its content

wild talon
#

well let me try

#

why I need to use in your object expand, in which cases ?

glass junco
#

https://stripe.com/docs/expand has all the information about the feature in details with lots of examples. But it's because tax is not returned by default (to keep the API fast)

Learn how to reduce the number of requests you make to the Stripe API by expanding objects in responses.

wild talon
#

thanks you, please, where do you have one list of country codes?

#

can I use expand in update customer too ?

#
                    $cus,
                    [
                      'address' => ['country' => $code ] 
                    ], 
                     'expand' => ['tax'],
                  );```
glass junco
#

well yes but the code you have won't work. Expand is a parameter it goes in the same place as the address

#

and it's the 2 letter country code

wild talon
#

$customer = $stripe->customers->update(
$cus,
[
'address' => ['country' => $code ],
'tax' => [
'ip_address' => get_Real_IP(),
]
],
);

#

yes works fine thank your koo