#_alex - customer
1 messages ยท Page 1 of 1 (latest)
Yes... Either creating or updating an existing one
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.
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?
This is what I referred to earlier: https://stripe.com/docs/tax/customer-locations#address-hierarchy
Do you need more time to investigate?
Thanks for providing more details! Can you share a customer ID where you see this issue?
In my test environment: cus_MNmLTfuz5Muhgc
I hope you did not forget about me ๐
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?
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
are you referring to
country: "US",
source: "ip_address",
state: "NY"
}```?
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?
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
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)
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?
For taxes? yes.
If that is the case, why doesn't it happen in the test mode?
can you provide more information about what exactly doesn't happen in test mode?
billing address is not being inferred from the IP in the absence of other data
*other data = address information provided by the customer
where exactly are you looking?
cus_MNo4c2HFNOsuwZ - his "Billing details" are empty
also, his invoices, have no billing address specified
I am looking at the dashboard in Stripe
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
Is this what you mean by "tax_details":
"id": "cus_MNo4c2HFNOsuwZ", "tax": { "automatic_tax": "not_collecting", "ip_address": "206.71.50.230", "location": { "country": "US", "source": "ip_address", "state": "NY" } },
yes
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?
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.
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?
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.
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)
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?
yup
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?
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
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 !
NP! ๐ Good luck