total does not show when not adding tax

24 views
Skip to first unread message

Todd Hodes

unread,
Oct 18, 2024, 4:30:33 AM10/18/24
to Stripe API Discussion

wondering if anyone has insight.  in Europe, prices must be "all-in", eg, when a thing is EUR7.99, the services charges, fees, and tax must be a part of that, not added on top.

when i compute all these out, and line item them, but add the tax as a percentage TaxRates, i get a subtotal and total, which looks good, but, can lead to rounding errors.  e.g., 7.99 w/ 22% VAT:
6.55*1.22 =7.991 --> 8
6.54*1.22 =7.9788 --> 7.98
or fo 49.99...

Pay Eluvio, Inc.
€49.98
  • Season Pass
    €38.47
  • Service Fee (6.5%)
    €2.50
Subtotal
€40.97
VAT (22%)
€9.01
Total due
€49.98


if instead I just use all line items, it no longer has a total (!):


Pay Eluvio, Inc.
€14.99
  • Goat Pack Two
    €11.53
  • Service Fee (6.5%)
    €0.75
  • VAT (22%)
    €2.71



Does anyone know how i can get the line items version to show a Total?  or any other approach to this?

(I know about prices being Inclusive or Exclusive, but, that would just show a single line item, no information on fees and taxes, which is not acceptable; it needs to be spelled out just like any other receipt in the US, or anywhere, with tax spelled out.)

Any help at all appreciated!
 -t

Karl Reid

unread,
Oct 18, 2024, 6:09:14 AM10/18/24
to Stripe API Discussion, todd....@eluv.io
Hi there,
It's a little hard to give a complete answer without more information so I'd suggest opening a support ticket at https://support.stripe.com/?contact=true . For example, what products/APIs are you using(an Invoice? A CheckoutSession? A Quote? something else?) and specific IDs of the objects where you've tested this in test mode, and the details of this European requirement you're referring to.

What I would say in general is that Inclusive tax rates  ( https://docs.stripe.com/billing/taxes/tax-rates#inclusive-vs-exclusive-tax )seem to be part of the solution here. For example I can create an Invoice that charges my season pass + a percentage service fee and then tax is calculated on an inclusive basis on that subtotal:
===
let invoice = await stripe.invoices.create({
     ...
      default_tax_rates: ['txr_1QBCM8JoUivz182DWiLFA3RE'],
     ...
    });
...
const seasonPassAmount = 4999
    const invoiceItem = await stripe.invoiceItems.create({
      customer: customer.id,
      invoice:invoice.id,
      unit_amount: seasonPassAmount,
      description:"Season pass",
    });
const serviceChargeAmount = Math.round((seasonPassAmount * 6.5) / 100) // 6.5%
    const invoiceItem2 = await stripe.invoiceItems.create({
      customer: customer.id,
      invoice:invoice.id,
      unit_amount: serviceChargeAmount,
      description:"Service charge",
    });
===
(untitled 17.png)

I think what you might be asking though is how to make the Service Fee line item basically be inclusive itself such that it doesn't directly get added to the subtotal. That's not something we support, what you could do instead is pass one line item that is the combined amount where you've already done the inclusive calculation on your end. It's not possible to split that out as its own item though and likely this is not what you're looking for exactly, but for now that's the only approach I can think of that is supported in our product.
===
const seasonPassAmount = 4999
const serviceChargePercent = 6.5
const inclusiveServiceCharge =
  Math.round((seasonPassAmount / (100 + serviceChargePercent)) * serviceChargePercent)
const inclusiveServiceChargeFormatted = (inclusiveServiceCharge / 100).toFixed(2)
const invoiceItem = await stripe.invoiceItems.create({
    customer: customer.id,
    invoice:invoice.id,
    unit_amount: seasonPassAmount,
    description:`Season pass (including 6.5% service charge of €${inclusiveServiceChargeFormatted})`,
  });
===
(untitled 18.png)

I'd suggest opening a support ticket to follow up on this in more detail.
All the best,
Karl
Untitled 17.png
Untitled 18.png

Todd Hodes

unread,
Oct 18, 2024, 5:40:06 PM10/18/24
to Stripe API Discussion, ka...@stripe.com, Todd Hodes

Thanks!  this is perfect.  I just needed to calc the service fee, subtract it from the (all-in) total, add both as inclusive line-items with attached VAT tax rate. 
That makes the numbers are exact and I get the tax line, subtotal, total lines -- no need to line-item the tax.

Much appreciated!

 -t

--------

Pay Eluvio, Inc.
€49.99
  • Sample
    €46.94
  • Service Fee (6.5%)
    €3.05
Subtotal
€49.99
VAT (22% inclusive)
€9.01
Total due
€49.99

Reply all
Reply to author
Forward
0 new messages