Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Endpoints >

VAT Inclusive items causing error

Started by Chris Crawshaw -   in API Endpoints

I'm getting the following error when trying to submit an invoice:
<Message>A validation exception occurred</Message>
<Elements> <DataContractBase xsi:type="Invoice"> <ValidationErrors> <ValidationError> <Message>The line total 199.97 does not match the expected line total 199.96</Message> </ValidationError>

I have tracked this down to our items being priced in our database inclusive of VAT.

This is causing an error with the following sums:
Item price: &#163;59.99 (inc. VAT at 20%)
Therefore, Line Item Price: &#163;49.99 (ex. VAT)
With a quantity of 4, our system works this out at 4*59.99 = &#163;239.96 with VAT: 239.96 - 239.96/1.2 = &#163;39.99
Where as Xero calculates 4*49.99*1.2 = &#163;239.95

My question is, how do I form my xml to account for this, or change to organisation settings to allow for this?

Hi Chris - Xero supports both exclusive (default) or inclusive line items. If you set the <LineAmountTypes> element to be Inclusive then all your line items can be entered at 59.99 and your total will be 239.96. See the example below.

<Name>Martin Hudson</Name>
<Description>Items inclusive of Tax</Description>

Hope this helps.

Tony Rule (Xero Staff)  

Hi Tony,

Many thanks for your reply. This works perfectly. I just overlooked it when writing my scripts.

Kind Regards,

Chris Crawshaw