#gracine

1 messages · Page 1 of 1 (latest)

dark tigerBOT
median mauve
#

expand should be in the first argument object, not the second one

warped wyvern
#

ah!

median mauve
#

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".

warped wyvern
#

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 ?

median mauve
warped wyvern
#

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

median mauve
warped wyvern
#

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

median mauve
#

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)

warped wyvern
#

ohhhh

warped wyvern
#

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

median mauve
#

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

warped wyvern
#

nice

median mauve
#

so I think the product already does what you need, just by default

warped wyvern
#

🤦‍♂️

#

alright, im glad we talked!

oak forge
#

👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!

warped wyvern
#

All good you can close this thank you