Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Endpoints >

Line total mismatch on invoice line that has not been updated

Started by Invoice Sherpa -   in API Endpoints

I'm trying to append a new line to an invoice. My process is:

1. retrieve the invoice to be updated;
2. append a new line;
3. POST the invoice with the new line back to Xero.

The line items look roughly like this:

This code is provided by the developer community - Xero does not warrant it in any way


As indicated in the line descriptions, the first line is one I retrieved from Xero, while the second line is the new line I'm trying to append.

When I make my update request, I get the following message: "the line total 1500.00 does not match the expected line total 1499.93, and 3 other issues." I understand that this happens when the `LineAmount` does not match the amount computed by Xero given the line's item and quantity. However, the amount indicated in the error belongs to a line that I have not altered. In other words, 1500.00 appears to be the amount computed by Xero, but Xero does not accept it when I post it back.

How do I get around this? I would prefer not to cause Xero to recalculate totals on lines I haven't updated, if possible.