#gracine
1 messages · Page 1 of 1 (latest)
expand should be in the first argument object, not the second one
ah!
it's just
stripe_customer = Stripe::Customer.create({
email: email,
address: {
country: country_code,
state: region_code
},
expand: ['tax']
})
the second object is only for things like stripe_account or stripe_version , it's for "request options".
it works!
merci!
I was having issues with customer / taxability
Its the chicken or the egg, I must know if I tax the customer before creating the checkout session
but the customer address is known only within the checkout session, when the user enters his address
I think this logic is missing in the checkout session page
so now I must detect the customer location, create or get the customer from Stripe and check if customer.tax.automatic_tax == 'supported'
basically this is my flag to enabled automatic tax on the session
I did not find a better way, because its counter intuitive to ask user for address before the checkout page
Does that make sense ?
yes, that is exactly what https://stripe.com/docs/payments/checkout/taxes?tax-calculation=stripe-tax#existing-customers describes.
The issue is mainly that we do not want to collect taxes in a state that we do not have tax registration
we are based in canada so a us customer must never have automatic_tax enabled
cool. Well checking for not_collected in the expanded tax field of the Customer (which I assume is what you're doing) will help there. https://stripe.com/docs/api/customers/object#customer_object-tax-automatic_tax
In my opinion it would be nicer to have this logic computed dynamically in the checkout session, so our app does not need to add a "enter your address" before Stripe, this adds friction to the subscription process
hmm, I mean, it does. You don't have to create a Customer. You can just create the CheckoutSession and it calculates tax and if it can't(because you're not registered), then it doesn't, it would calculate $0 tax (https://stripe.com/docs/tax/zero-tax)
ohhhh
I assumed that tax would be calculated even if we do not have registration...i did not test this
so i should symply set automatic tax enabled always
only resident of canada will see taxes added
I'm pretty sure it doesn't, you can give it a try, overall that's why that docs page exists and explains common reasons for seeing $0 tax applies is not being registered
nice
so I think the product already does what you need, just by default
👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
All good you can close this thank you