Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Getting Started >

How the discount is calculated on line item?

Started by Dev L -   in Getting Started

I have an item price is $22.50 with discount 15%.

Xero calculated the discount value as $3.37.

$22.5 X 0.15 = 3.375

Why Xero rounded to 3.37 but not 3.38?

How to get $3.38?

Setting your discount to 15.01% would seem to be an adequate workaround.

Richard Heylen  

Hi Dev L,

The discounts in Xero is calculated based on per line item total.

line 1: unit price of $22.5 with 15% off has a line item total of $19.13 ($19.125 rounded to 2 decimal places), the discount is then $22.5 - $19.13 = $3.37.

If we calculate discount first by $22.50 x 15% = $3.38 like you did and calculate line item total by $22.50 x 85% = $19.13, we would have resulted in an extra 1 cent difference in line total ($19.13 + $3.38 = $22.51).

If this calculation is different in your software, it will result in a different in the total amount in the invoice. In that scenario, you will need to introduce a new line to adjust the difference so the transaction can be reconciled later on.

Jenks Guo (Xero Staff)