question

mkonnekt avatar image
mkonnekt asked Jacob Abrams commented

Tax calculation mismatch when once of the items is non-taxable

Hi,

I am sending an order to clover where: - item1 is $2.99 and taxable - 8.25% tax - item2 is $2 but NOT taxable - 0% tax - total order has discount of $2.99

https://www.clover.com/r/PTGW0XCK1BJ58

On Clover, the tax is coming out to be $0.1 whereas I don't think there should be any tax for a customer in this scenario. Please help and tell what can we do to prevent this tax mismatch.

TaxesDiscounts
2 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mkonnekt avatar image mkonnekt commented ·

@jacobabrams we have seen another discrepancy when calculating the tax for the below scenario

We have two items - 10.99 each for one item we have two taxes 9.25% and 8.50% and the second item has a tax of 7.75%. We also have a discount of 2.99 for which we proportionally applied to both the items - $1.50 & 1.49.

Item 1: Discounted amount: 10.99-1.50 = 9.49 Tax: 9.49*17.75% = 1.68

Item 2: Discounted amount: 10.99 - 1.49 = 9.50 Tax: 9.5 * 7.75% = 0.74

Total tax: 2.42

On clover side we are seeing a tax of 2.43. https://www.clover.com/r/ERQA66PTEF3W2

Can you please look into this.

0 Likes 0 ·
Jacob Abrams avatar image Jacob Abrams ♦♦ commented ·

The tax computation computes each tax individually, it doesn't sum 8.5% and 9.25%. This is because each tax authority will desire that their tax is rounded up to the nearest penny and doesn't care about other tax authorities. So yes 17.75% gives $1.68 but then you would need to pay your taxes to two different authorities and one would see they didn't get rounded up. So our computation is $9.49 * 8.5% = round up to $0.81 and $9.49 * 9.25% = round up to $0.88. Now each tax authority gets rounded up.

0 Likes 0 ·

1 Answer

Jacob Abrams avatar image
Jacob Abrams answered Jacob Abrams commented

An order-level discount is applied proportionally to all items when computing taxes. If the discount is intended for a single item you should make it an line item-level discount instead.

Also taxes are computed individually for each tax rate being applied. So if you have two tax rates on an item, we will not sum the taxes before calculating the tax, instead we calculate the tax for the first rate and round up, then calculate the tax for the second rate and round up, then sum the taxes for the total tax. This ensures each tax authority sees that their tax has been rounded up.

If you want to replicate Clover's calculations exactly you may want to actually just want to use a java library we provide, you can find information about that here: http://devask.clover.com/question/221

Here is the calculation based on the items in your question:

Item 1 (non-taxable): 2.00
Item 2 (taxable): 2.99
Undiscounted subtotal: 4.99
Subtotal discount: 2.99

Item 2 tax: (2.99 - (2.99 / 4.99) * 2.99) * 0.0825 = 0.10

Tax: 1.20
Total: 4.99 - 2.99 + 0.10 = 2.10
10 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mkonnekt avatar image mkonnekt commented ·

Actually, this issue started after item2 was made non-taxable. Before that, there was never a tax mismatch with this very same order level discount API. Ok, so $1.5=$2.99/2 is discount for each item. Please help in understanding the calculation steps: After-discount item1=$1.49 = $2.99-$1.5 and item2=$0.5 = $2-$1.5. Since only item1 is taxed at 8.25%, tax=$0.13 = 8.25%*$1.49. Now order total=$2.12 = $1.49+$0.5+$0.13. Still tax=$0.13 but its $0.1 on Clover & total=$2.12 but its $2.10 on clover.

0 Likes 0 ·
mkonnekt avatar image mkonnekt commented ·

Another order with tax mismatch- https://www.clover.com/r/HARJSQ9H9KNJG. I understand that we have to apply item level discounts. But even after that, tax calculation logic is unclear to me. Please explain TAX CALCULATION on the order so that we can replicate the logic on our end. We find that if item2 IS taxable, then there is no mismatch at all - https://www.clover.com/r/AYPKK8CB5QM2G

0 Likes 0 ·
Jacob Abrams avatar image Jacob Abrams ♦♦ commented ·

I misspoke, discount is not applied evenly, it is applied proportionally. See updated answer.

0 Likes 0 ·
mkonnekt avatar image mkonnekt commented ·

Thanks! So if we have 5 items $2 each (discounted, taxed) but 2 items $2 each (not discounted, not taxed), and an overall order discount of $5 for the 5 items, then we should send to clover $1 (proportionate) discount for each of the 5 items (discounted) but nothing for the remaining 2 items. Then order tax = 8.25% * ($2-$1)*5 = $0.45 and total order = $1*5+ $2*2 + $0.45 = $9.45

0 Likes 0 ·
Jacob Abrams avatar image Jacob Abrams ♦♦ commented ·

Yup sounds right.

0 Likes 0 ·
Show more comments

Welcome to the
Clover Developer Community