#jairo094215_invoice-tax-percent-field
1 messages ยท Page 1 of 1 (latest)
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- jairo094215_webhooks, 57 minutes ago, 21 messages
- jairo094215_api, 5 days ago, 11 messages
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question. Thank you for your patience!
โฑ๏ธ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime! If this thread is closed and you have another question you'll need to start a new thread.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1214555805483802664
๐ Have more to share? You can add more detail below, including code, screenshots, videos, etc.
Hi, let me help you with this.
I believe tax is calculated per each item, you can see it in lines.data.tax_amounts/tax_rates.
Since we've started using Stripe Checkout to create our subscriptions the 'invoice.created' Webhook events that we are receiving have the 'tax_percent' value as null
It's a deprecated field which is unused if you're using Tax Rates, like you are
It's removed in newer API versions: https://docs.stripe.com/upgrades#2020-08-27
You'll need to look at the field above if you want the specific % applied by the txr_xxx object
But it's weird, because it is happening since we've started using Stripe Checkout
Yep, because Checkout is a new(er) payment UI that uses the Tax Rate objects I described
Before that, all our invoice.created events have the correct tax_percent value. Is it normal?
tax_percent is an old field/parameter you can set specifically, but it's deprecated and Checkout doesn't support it
Sure, could be. Depending on how you were creating them
Before that, we used the subscriptions API directly, and we indicated the tax rate using the default_tax_rates parameter on subscriptions creation
And by this way we can read the tax_percent of the invoice correctly from this event payload
Hard to say without a specific example. But as I said, that field is deprecated entirely so Checkout, a new(ish) API/UI, does not support setting it
But now all invoices of our customers are registering in our system with 0 tax, because we are getting the tax value of the invoices from this property
So you'll need to account for that and adjust your webhook code
Ok, then, how can we get the 'main' tax value for the entire invoice?
Depends what you mean by 'tax value'?
The amount of tax paid, or the tax percentage applied?
the percentage applied
For example, if the subscription is created with 21% tax as default tax value, We would like to get this tax percent from the Invoice payload
You'd look at the item level: https://docs.stripe.com/api/invoices/line_item#invoice_line_item_object-tax_rates-percentage
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
As some items may be tax exempt, which is why a top-level field makes less sense
And if items has different taxes, what value could we interpret as the total tax on an invoice?
If you mean %, then you'd have to compute that yourself
jairo094215_invoice-tax-percent-field
Sorry, but I don't finish to understand that. What would be the equivalent of what we did before? Before we only read the tax_percent of the invoice, now what should we read to obtain the value equivalent to the old tax_percent?
For example, if we have an Invoice with 2 items and both with 21% tax it is simple because we can treat the % of the first item as the main tax of the invoice
But what happens if the taxes are different?
There is no equivalent field like that today. The easiest way would be to calculate the tax amount as a % of subtotal_excluding_tax