#ednonstop - calculate tax
1 messages ยท Page 1 of 1 (latest)
I just enabled this feature on stripe dashboard and want stripe to calculate tax for customers automatically
I haven't done it yet
Okay so you are using automatic tax calculation.
I want to know how to get tax. I'm using SetupIntent and PaymentIntent. My task is to estimate and show my users tax before they make payment
Can you tell me how it can be done
Looking into this. At what point in your flow are you wanting to display the tax amount (or %) to your customers?
User goes into basket, click "Place Order" and see "Confirm Payment" screen with total payment and taxes info. Then he click "Confirm" and stripe payment popup appear.
So basically it must be seen just before payment popup will appear
What is the payment popup in this case?
The only API I can find that will return the tax rate prior to the purchase is the Stripe Customer API:
https://stripe.com/docs/api/customers/object#customer_object-tax
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
At that point in your app, do you already know who the Customer is?
Yes , i just checked the customer object i received
but there is no tax field inside it
maybe need to complete some requirements
the tax property is not expanded by default. You need to request it expand=['tax']
oh
But this will only get populated after the user adds a payment method (so we get the IP address and location info)
Or makes a payment
expand=['tax']
is this a query parameter for Retrieve a customer request?
i'm using on my js backend
const customerList = await stripe.customers.list({
email: req.body.email,
limit: 1
});
or
const customer = await stripe.customers.create({
email: req.body.email
});
expand=['tax']
is this a query parameter for Retrieve a customer request?
Expand is a parameter for the API requests. You can review how to expand using Node.js syntax here: https://stripe.com/docs/api/expanding_objects
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Ok thanks
so in my case
it will be
const customerList = await stripe.customers.list({
email: req.body.email,
limit: 1,
expand: ['tax'],
});
am i right?
๐ stepping in as Snufkin has to step away
Yes your code above would be correct for expanding tax when listing Customers
ok, will try now, thanks
This property cannot be expanded (tax). You may want to try expanding 'data.tax' instead."
Are you creating Subscriptions?
Okay well you can't collect tax via Stripe with that integration unfortunately.
We don't support automatic tax on PaymentIntents without using the Orders API
Which isn't supported on the Mobile SDKs yet.
So there is no manual way to calculate the tax with current integration, right?
With just PaymentIntents and SetupIntents you would have to handle tax yourself on Mobile.
Unless you use Invoices
That would be the other way to do this on Mobile for one-off payments
handle from where? can you clarify
You would include it in your own calculation of the PaymentIntent amount.
Stripe can't calculate tax for you if you only use a PaymentIntents/SetupIntents integration.
Yes, but from where i can get tax rate for current customer to calculate it
Like I said, Stripe can't provide that. You would have to gather that yourself, perhaps using a third party or something. Stripe can't know the tax rate just based on the Customer object. That isn't how automatic tax works. Feel free to give a read through our Stripe Tax docs: https://stripe.com/docs/tax
ok, got it, will speak with my team , thanks