#bijay_jha
1 messages · Page 1 of 1 (latest)
As you can see above, I am trying to calculate Tax using above api. Here, I have to explicitly mention the tax_behaviour.
Can stripe provide tax_behaviour automatically based on currency or country code?
There is a global setting in the dashboard for this: https://dashboard.stripe.com/test/settings/tax
yeah, I have set automatic here
but still, the default value is being set for tax_behaviour is exclusive
When using automatic this should happen:
Stripe will use the price currency to define whether the tax should be added on top of the price (excluded) or included in the price. Tax will be excluded in USD and CAD, but included in all other currencies.
Is this not working?
Let me give you the context: Usual scenario, when I create a subscription for my products, I can see the tax is being calculated autmatically and shown in invoices. 2nd scenario: I am using Tax calculation api to create tax details as shown above to show the tax details before a customer purchase a subscription( just a preview).
For the 2nd scenario, the automatic behaviour is not working
I hope I was able to explain you the concern
For the 2nd scenario, the automatic behaviour is not working
Can you clarify what "not working" means? Can you share the request ID (req_xxx)?
what I mean with not working is, if I don't pass the tax_behaviour field in this : stripe.tax.calculations.create({
currency: 'eur',
line_items: [
{
amount: amount,
reference: 'L1',
tax_behavior: 'inclusive',
product: stripeProductId,
}
],
customer_details: {
address: {
country: 'DE',
},
address_source: 'billing'
}
}); the api response is always exclusive tax irregardless of which currency I choose
sample response: if the tax_behaviour is not passed explicitly : {
taxCalculation: {
id: 'taxcalc_1NhriyF9yHeYvqmolzxZ85Nq',
object: 'tax.calculation',
amount_total: 1470,
currency: 'eur',
customer: null,
customer_details: {
address: [Object],
address_source: 'billing',
ip_address: null,
tax_ids: [],
taxability_override: 'none'
},
expires_at: 1692872532,
livemode: false,
shipping_cost: null,
tax_amount_exclusive: 235,
tax_amount_inclusive: 0,
tax_breakdown: [ [Object] ],
tax_date: 1692699732
}
req_Iz1DTKIyZcystN
Thanks for the clear explanation! Looking into this.
sure
I think that's expected, since you can see here it defaults to exclusive: https://stripe.com/docs/api/tax/calculations/create#calculate_tax-line_items-tax_behavior
the setting in the dashboard is for controlling what happens when we do an automatic calculation. if you do the calculation yourself you need to provide the inputs.
hmm..Got it.. Thanks Soma. Can you also let me know if Stripe provides any api that will get me the tax details before creating a subscription.. just to show a preview to customers?
You could use Tax Calculation (like you are already doing), or use the upcoming invoice endpoint (that you can use before creating the subscription): https://stripe.com/docs/api/invoices/upcoming
can we get Upcoming invoice even without creating subscription?
Yes, the subscription parameter is optional.
Happy to help 🙂