#_alex - customer

1 messages ยท Page 1 of 1 (latest)

random basin
#

Hi there!

#

How are you creating the customer?

haughty lake
#

Yes... Either creating or updating an existing one

random basin
#

But how are you creating the customer? By calling this API endpoint? https://stripe.com/docs/api/customers/create
If so, Stripe doesn't use the IP address of the customer. It only stores the information you passed when creating the customer.

haughty lake
#

I add the tax.ip_address parameter. I read somewhere in the docs, that Stripe will try to infer location based on this parameter

#

Other option would be for Stripe to infer the location from the payment method

#

Plus, if address is empty, after update/create the response would contain:
"tax": { "automatic_tax": "not_collecting", "ip_address": "206.71.50.XXX", "location": { "country": "US", "source": "ip_address", "state": "NY" } }

#

I would expect Stripe to be intelligent enough to use this info to infer billing location

#

After all, it has everything it needs. Are you saying that this is data is not being used to infer the billing address?

#

Do you need more time to investigate?

random basin
#

Thanks for providing more details! Can you share a customer ID where you see this issue?

haughty lake
#

In my test environment: cus_MNmLTfuz5Muhgc

haughty lake
#

I hope you did not forget about me ๐Ÿ™‚

solemn storm
#

Hello ๐Ÿ‘‹ Apologies for the delay. Jumping in as the server is a running busy today
Give me a moment to catch up and I'll respond as soon as I can ๐Ÿ™‚

#

Can Stripe guarantee there would always be some billing address attached to the customer, or am I running a risk of charging someone's card without being able to document their location to the tax authorities?
It depends on how you create the customer as well as the payment method that's being used with the charge.

I'm unclear on how exactly you're trying to test the behavior here?
As I do see an IP address on the customer but there's also an incomplete billing address on the payment method that's attached to the customer.

#

Can you provide more information about how exactly you're testing this flow?

haughty lake
#

Hi @solemn storm! Thanks for stepping in.

#

So I just created a new customer via this API: https://stripe.com/docs/api/customers/create. I did not provide address, but I did provide IP. After creation this customer has no billing address associated with him, even though tax.location has appropriate data

#

he's ID: cus_MNo4c2HFNOsuwZ

#

*his

solemn storm
#

are you referring to

      country: "US",
      source: "ip_address",
      state: "NY"
    }```?
haughty lake
#

yup

#

I just need to know the country - I am not registered in US for tax purpses

solemn storm
#

are you asking if the country will show up if you pass in the IP and there are no other billing details attached to the customer?

haughty lake
#

pretty much

#

I need to have at least the country specified on the invoice

#

My concern is that I might end up in a situation where country is not present on the invoice

solemn storm
#

I believe so. However, the general recommendation is to collect billing details for accurate tax calculations.
Its easy to spoof the IP (by using a VPN etc)

haughty lake
#

To clarify: You believe, that if IP is specified, Stripe will always try to infer the country from that IP in the absence of the actual billing address given by the user?

solemn storm
#

For taxes? yes.

haughty lake
#

If that is the case, why doesn't it happen in the test mode?

solemn storm
#

can you provide more information about what exactly doesn't happen in test mode?

haughty lake
#

billing address is not being inferred from the IP in the absence of other data

#

*other data = address information provided by the customer

solemn storm
#

where exactly are you looking?

haughty lake
#

cus_MNo4c2HFNOsuwZ - his "Billing details" are empty

#

also, his invoices, have no billing address specified

#

I am looking at the dashboard in Stripe

solemn storm
#

billing_details are different and separate than tax_details. You're confusing a couple things here.
1/ What you see in tax_details is calculated based on the IP that you passed in and is stored as part of tax_details
2/ billing_details will only populate if you collect the billing info from your customer and pass it in. Stripe will not do that automatically.

If you want, you can run some custom logic with webhooks where you listen for customer.created event and then look for the country under tax_details and then update the customer billing_details with that country

haughty lake
solemn storm
#

yes

haughty lake
#

So, you are saying that those details are being used only to calculate tax and in theory the billing address could be located in a totally different country?

#

In Live mode, I have no logic like you described, and I am not asking the customers for their details, yet the billing details are being populated anyway. What is the source of those billing details?

solemn storm
#

So, you are saying that those details are being used only to calculate tax and in theory the billing address could be located in a totally different country?
that's correct.

In Live mode, I have no logic like you described, and I am not asking the customers for their details, yet the billing details are being populated anyway. What is the source of those billing details?
It is possible that the payment method has the billing details on them
I still don't know how you're integrating so I can't say for certain.

haughty lake
#

So far my users where charged by checkout session.

#

they would provide only their card details and name

#

Are you receiving their Country and postal code from the card issuer?

solemn storm
#

I'd need to take a look at your example checkout session. As far as I remember, checkout does collect country and zip for card payments.

haughty lake
#

cs_test_b1X0w4R1mA2mnCj0OchFgsrR4M2sG3DaE6RbdQjkHBgUCxN3CWFGoa6zXT

#

Is this enough?

solemn storm
#

yup, so seems like this customer had a previous payment that was successful where they probably passed in the country and the zip.
As you can see, if I try to change it then checkout asks for the country again (and zip too if supported)

haughty lake
#

This is a test user, so I used and deleted him many times in the past.

#

OK, so if I have someone completely new, they will be asked for both the country and zip code (for US and CA), when paying with card?

solemn storm
#

yup

haughty lake
#

I think this gives me a bit of piece of mind.

#

If the customer would choose to remove all the details later, but using the update.customer enpoint and specifying address: undefined or something like that, would he be asked for the country and zip code again?

solemn storm
#

No idea as I haven't tested this flow personally. I'd recommend trying it out in test-mode.
AFAIK checkout will store the billing info on the attached payment method and not to customer object itself (not 100% sure so would recommend testing it out)

#

and when i say billing info, I mean the country and the zip

haughty lake
#

OK. I think I have something to work with,

#

The concern I have is that test mode seems to be working differently than live mode here. Maybe it's because I am using the test card (4242...)

#

In live mode everything seems to be working ok.

#

I will investigate more and reach out if I need further assistance.

#

Thanks a lot, @solemn storm !

solemn storm
#

NP! ๐Ÿ™‚ Good luck