“Ridade summa ei võrdu arve summaga”: why Merit Aktiva rejects the invoice and how to stop it
Merit Aktiva rejects the invoice, or the invoice ends up a cent off the payment. Where the cent goes, a worked example, and four rules that make every WooCommerce order match to the cent.
If your WooCommerce shop sends invoices to Merit Aktiva, sooner or later you'll meet this message: “Ridade summa ei võrdu arve summaga”. In English: the line totals don't equal the invoice total.
Sometimes the invoice is rejected. Sometimes it goes through, but the total is a cent or two away from what the customer paid. Either way, someone fixes it by hand later or writes the difference off.
The good news: it isn't random. WooCommerce and Merit Aktiva simply start the VAT sum from opposite ends, and once you see where, you can stop it.
How Merit Aktiva adds up an invoice
It works line by line:
- line net = quantity × unit price, rounded to two decimals;
- line VAT = line net × tax rate, rounded to two decimals (an exact half cent goes up);
- the invoice net and VAT are the sums of the lines.
So Merit Aktiva rounds first and adds up afterwards. It also recalculates every invoice it receives. If an integration sends a total or a VAT amount that doesn't equal what the lines give, you get the error or the difference.
How WooCommerce adds it up
Estonian shops usually enter prices with VAT. WooCommerce then starts from the gross: the line total is fixed and the VAT is taken out of it. Merit Aktiva starts from the net and adds VAT on top. Both are correct. They just round in different places, and each line can drift by a cent.
Four things make the gap bigger:
- Coupons. A percentage discount is spread over the lines, and each line's share is rounded on its own.
- Unit prices rounded to cents. If an integration rounds the net unit price to cents, the error is multiplied by the quantity.
- Shipping. WooCommerce usually takes the shipping cost without VAT and adds tax on top, so the shipping line rounds its own way.
- "Round tax at subtotal level, instead of rounding per line". With this WooCommerce setting on, VAT is rounded once for the whole subtotal. Merit Aktiva always rounds per line.
A real-looking example
Nothing unusual here: seven T-shirts at €24.23, one book at €18.90, a 10% coupon on the products, and shipping.
| Line | Customer paid | Net | VAT the Merit Aktiva way |
|---|---|---|---|
| T-shirt 7 × €24.23, 24%, −10% | 152.65 | 123.10 | 29.54 |
| Book €18.90, 9%, −10% | 17.01 | 15.61 | 1.40 |
| Shipping €3.22 + 24% | 3.99 | 3.22 | 0.77 |
| Total | 173.65 | 141.93 | 31.71 |
By Merit Aktiva's maths the invoice is 141.93 + 31.71 = €173.64. The customer paid €173.65.
Where did the cent go? WooCommerce counted the T-shirt line's VAT as €29.55 (152.65 − 123.10). Working from the net, it's 123.10 × 24% = 29.544, rounded to €29.54.
It gets worse if the integration rounds the T-shirt's unit price to cents. 123.10 / 7 = 17.5857…, rounded to €17.59. Now the line net is 7 × 17.59 = €123.13 and the line with VAT €152.68: three cents more than the customer paid.
Four rules that fix it
- Send the line net exactly. A Merit Aktiva unit price can have seven decimals. At 17.5857143, seven T-shirts come to exactly 123.10 after rounding, the same net as in WooCommerce.
- Work out VAT the way Merit Aktiva does. Per line, from the net, to two decimals. Your lines and VAT amounts then match its own calculation, and nothing is rejected.
- Put the leftover cent into rounding. A Merit Aktiva invoice has a separate rounding amount (
RoundingAmountin the API) that changes only the invoice total. The cent or two of difference goes there, and the total equals the amount paid. In the example, rounding is +€0.01 and the invoice total €173.65. - Don't hide big differences. More than a cent per line isn't rounding. It's almost always a wrong tax mapping or a plugin adding fees outside the order lines. Don't "fix" that with rounding. Take a look at the order instead.
In WooCommerce itself, it helps to enter all prices the same way (all with VAT or all without) and to leave subtotal-level rounding off unless you have a reason for it.
Do you have this problem? A five-minute check
Export one month of shop invoices from Merit Aktiva and compare each invoice total with the WooCommerce order total. If more than a handful differ, it happens every month, and somebody is fixing it by hand right now.
sild does this on every order: lines with a seven-decimal price, VAT worked out the way Merit Aktiva does, and the leftover cent in rounding. In preview mode you see whether sild's invoices match the ones already in your Merit Aktiva before you switch anything on. See how it works.