#nox7_api
1 messages ยท Page 1 of 1 (latest)
๐ 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.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ 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/1504488146421678193
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi there. Why do you think the tax calculation is incorrect on an amount of $5?
Because it's not me doing the taxes rounding. The only thing in my request is my application asking for a credit note preview from the API. The API only requires I provide the amount + line item Id.
Stripe does the tax calculation. And Stripe is erroring on itself. I can't remember if this has already been reported; but either way it's hindering my integration with Stripe.
Simply, I'm asking Stripe "Give me a credit preview for a line item with $5.00" and then it errors saying the tax calculation is wrong - but Stripe is internally calculating the taxes not me. I can't control its rounding error.
Yeah but to be clear why do you think the calculation we're doing is wrong? Aren't you just passing in too high of an amount?
I'm passing in the remaining line item amount (500/$5.00)
I don't understand how it can be too high. It's the remaining line item amount on the invoice.
I'm willing to try something else just to make this work, but it even errors in Stripe's website dashboard too. Something seems fatally wrong with issueing a credit note, then a second one on the remaining amount (a total of two credit notes, one after another) in Stripe's infrastructure
Hello
Jumping in here as my colleague needs to step away
Give me a moment to take a look
Thanks
I think this might be due to the manual tax rate, still looking
Okay I looked and it seems like this is due to Line item level rounding - https://docs.stripe.com/tax/tax-rates#rounding
Per-line tax rounding generates a credit note total ($5.38) that exceeds the remaining invoice balance ($5.37) by 1 cent.
The invoice in_1TX00LRhusOkdeelRxCMVqFk totals $86.00 ($80.00 + $6.00 tax at 7.5%). A prior pre-payment credit note cn_1TX00zRhusOkdeelLd1BEjHZ for $80.63 ($75.00 + $5.63 tax) left $5.37 remaining.
The preview for $5.00 subtotal computes tax as $5.00 ร 7.5% = $0.375, rounded up to $0.38, totaling $5.38 โ but the sum of individually rounded taxes ($5.63 + $0.38 = $6.01) exceeds the invoice-level tax ($6.00), making it impossible to credit the exact remaining balance at the line-item level.
I see, so that is the source of the issue; but in this circumstance what should I do instead if a user gets to this point? Swap to amount-based refunds/credits if an existing credit note already exists?
Yeah if you do amount based credit notes (without il_) then that bypasses per-line tax calculation
You can also reduce the line item amount by 1 cent
which isn't ideal
Right, seems a little hacky; but I get the idea. No way around this really without one or the other.
Alright, thanks. I'll take one of those approaches and move on.