#codex-invoice-decimal
1 messages · Page 1 of 1 (latest)
I am using Avalara tax, with a subscription of 3 quantities
So each time I refund a subscription quantity 1, I have to refund 1/3rd of the Avalara tax
But in the end, when I refund all 3 sequentially, I am left with a "partial refund" of $0.02 remaining
Am I able to refund so that each partial refund will total to $0.00 remaining (i.e. FULL refund)
👋 @stoic cradle all our amounts are in the smallest currency unit. So if you want $0.02 USD then you pass amount: 2, there's no decimal/float
codex-invoice-decimal
In this case, how can I refund 1/3rd of the Avalara tax item exactly? So there is no leftover remaining amount on the invoice?
i.e. it will be a FULL refund, instead of a partial refund
I'm sorry I don't understand what you could mean and we don't really control Avalara's integration
you have an Invoice for $X, and then you can refund how much you want up to $X
For example, Avalara's tax is 335 cents on a subscription quantity of 3. If I refund a quantity of 1, I have to refund 1/3rd the tax. 1/3rd of that is 111 cents rounded down. If I refund two more times (fully cancelled), the invoice has 2 cents left
----------------------That is not what we want. If we refund 1/3rd of that three times, we want the invoice to be left with 0 cents
Unfortunately you will have to handle that logic/rounding yourself in that case I think
In that case is there any way to know how much is left remaining on a current invoice?
Per invoice line item?
I don't think so
Ahh so there's no API to check the remaining charge for a customer?
In that case, what kind of rounding does Stripe do for calculations? Banker's rounding, etc.?
I mean there are some APIs, I just don't get what you are after at all unfortunately nor how you refund. If you do your own math and refund 111 then there's 224 left and then the next time if you refund 111 instead of 112 then there's 113 left
Yes, and then the final refund, 113 minus 111 = 2 cents
As in, when I refund all 3 subscription items, and 3/3 of the avalara price, I am still off by 2 cents
It should instead be zero
how do you refund all 3 subscriptions items. Like what exact API and code are you using?
stripe.Refund.create
When we refund 1 subscription item, we refund the 1 subscription item cost + 1/3rd of the tax calculated
Refund second time, then refund third time (last time) should leave a total of ZERO remaining on the invoice
But we are left with 2 cents since we cannot refund by exact floats.
okay so you do your own refund/math logic
in that case that's on you to keep track of how much was refunded and how much is left and to handle the rounding
There is no API to check the remaining value on an invoice even after refunds?