#EDDxample-invoice-tax-calculation

1 messages · Page 1 of 1 (latest)

low lion
#

Hey! To be clear you're looking for an individual line item for the computed tax value on the invoice?

frosty leaf
#

it would be for one item

low lion
frosty leaf
#

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?

low lion
low lion
#

Tax rates are the actual rates of tax that are applied

frosty leaf
#

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',
});
low lion
#

Hmm, I'm confused. Can you share some code of how you're integrating or expecting to retrieve this data?

frosty leaf
#

does it work with automatic taxes?

low lion
#

As in Stripe Tax?

frosty leaf
#

yes

low lion
frosty leaf
#

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!

low lion
#

Represent where though?

frosty leaf
#

before an actual payment, as in registering the product itself

low lion
#

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

frosty leaf
#

that's what I was worried about... but anyway, still thank you guys for this support <3