Lightspeed Tax Calculation

in Development
Hi there,
We are taking payment via Vantiv in our integration, then creating an invoice on Lightspeed using the Sale endpoint. The issue we are having is that Lightspeed calculates the SaleLines total including taxes, and we calculate it on our side for the Payment. We are sometimes off by 0.01, which fails the creation of the Sale. Does anyone have insight into the order of operations on how Lightspeed calculates the taxes for Sales?
We are taking payment via Vantiv in our integration, then creating an invoice on Lightspeed using the Sale endpoint. The issue we are having is that Lightspeed calculates the SaleLines total including taxes, and we calculate it on our side for the Payment. We are sometimes off by 0.01, which fails the creation of the Sale. Does anyone have insight into the order of operations on how Lightspeed calculates the taxes for Sales?
1 comment
1. Calculate the tax amount for tax 1 (GST in a Canadian shop with 2 taxes) for each line without rounding. This is SaleLine.calcTax1. It can vary from line to line depending on the tax class.
2. Sum those amounts, then round the total to get Sale.calcTax1.
3. If the account has 2 taxes, repeat steps 1 and 2 with tax 2 (PST) to get Sale.calcTax2.
4. Add the subtotal before tax for each line to get the Sale.calcSubtotal.
5. Add Sale.calcTax1 + Sale.calcTax2 + Sale.calcSubtotal to get Sale.total.
Here's an example using Québec sales tax. Both items use the default tax class.
Line 1: Price 5.99, Qty 1
Line 2: Price 9.99, Qty 2
Sale.tax1Total: (5.99 * 1) * 0.05 + (9.99 *2) * 0.05 = 1.2985 → 1.30
Sale.tax2Total: (5.99 * 1) * 0.09975 + (9.99 *2) * 0.09975 = 2.5905075 → 2.59
Sale.calcSubTotal: (5.99 * 1) + (9.99 *2) = 25.97
Sale.calcTotal: 25.97 + 1.30 + 2.59 = 29.86
Lightspeed HQ