Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Endpoints >

Inclusive tax rounding not following whats outlined in the API documentation

Started by Austin Smith -   in API Endpoints

I work for a company that integrates with Xero. I am running into a couple of issues with inclusive tax calculations when using a tax rate with 2 components (one marked as compound). I have read through the Tax API documentation and understand the concept of how Xero calculates tax on each line, rounds the calculation of each line, and then totals them to give the total tax. What I am running into is a situation where it looks like your system is not rounding correctly.

Here is an example of what I am talking about.

I have a tax rate that has a total tax rate of 10.00% (effective rate is 10.24%) which is made up of 2 individual tax components. Tax Component A is 6% and Tax Component B is 4%. Tax Component B is flagged as a compound component.

I created an invoice with a single line item. That line items total is $10,000.00 and has the tax rate mentioned above set on it. The invoice has it's tax option set to inclusive.

Heres a screenshot of the invoice details: https://www.screencast.com/t/9SfFAygJqXF

After saving, I printed the invoice to check the calculated tax per component. (I understand that the printout shows tax in an exclusive fashion and that is fine). When looking at the amount of tax calculated per component there seems to be a rounding issue in that one of the components tax amounts is not being correctly rounded.

Heres a screenshot of the invoice printout: https://www.screencast.com/t/Fnk7E6cKYk

The Tax amount for Component A should be calculated using $9071.12 X 6%. This would be $544.2672 before rounding. If you round to the closes cent (2 decimal places) the total tax for Component A would be $544.27. When looking at your calculation you show this as $544.26.

The calculation for the compound component seems to be correct ($384.615 rounded to $384.62). When totaling the pretax line amount ($9071.12) calculations, the total does end up bieng $10,000.00 however based on the Xero API documentation and the rules it lays out(calc each line by component), the total should be $10,000.01.

Why is the total for Component A using a different rounding method than the total tax for Component B in this situation? Is it to ensure the invoice total is correct?

If that is the case then what is the rule that is being applied here. I am curious because I need to know how to display this calculation in our system so that it matches the invoice we send to Xero.