#EDDxample-invoice-tax-calculation
1 messages · Page 1 of 1 (latest)
Hey! To be clear you're looking for an individual line item for the computed tax value on the invoice?
it would be for one item
Can you share the code you're using to call the endpoint? There's parameters to pass required tax rates for the line items: https://stripe.com/docs/api/invoices/upcoming#upcoming_invoice-invoice_items-tax_rates
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
For example, I just retrieve an upcoming invoice with a tax_rate applied to the price/product and there's a tax value returned: https://stripe.com/docs/api/invoices/object#invoice_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.
sure, let me clean the code a bit, but I'm basically creating a checkout session with a tax code in the line item
are tax_rate the same thing as tax_code?
Sorry, I thought we were talking about upcoming invoices? https://stripe.com/docs/api/invoices/upcoming
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
No, tax code pertain to your product (i.e. how is it classified for taxation purposes)
Tax rates are the actual rates of tax that are applied
that's what I'm trying to get then, the asociated value once you try to pay for the product
something like this, I chopped different parts of the code so it might not work as is, but I hope you get the idea
const session = await stripe.checkout.sessions.create({
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
line_items: [
{
price_data: {
tax_behavior: 'exclusive' as any,
currency: 'eur',
product_data: {
name: `...`,
tax_code: '...',
},
unit_amount: 100,
},
quantity: 1,
},
],
mode: 'payment',
});
Hmm, I'm confused. Can you share some code of how you're integrating or expecting to retrieve this data?
Yeah, you need to apply tax_rates to the line item: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-tax_rates
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
does it work with automatic taxes?
As in Stripe Tax?
yes
Tax codes work to ensure if tax is due on the product: https://stripe.com/docs/tax/tax-codes
ok!, I'll check them out
To sum it up in case this explains it a bit better, I'm looking for a way to represent the tax %'s of a certain item, given automatic taxes with Stripe tax + its own tax_code
Something like
Price - ...
Vat (tax_code%) - ...
Total - ...
I'll go now read those links but this is in case you think of a better solution and I'm just confused, thanks!
Represent where though?
before an actual payment, as in registering the product itself
You won't be able to do that with Stripe Tax automatically. It only works in Checkout
So you'd need to use tax rates and do the manual computation
that's what I was worried about... but anyway, still thank you guys for this support <3