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:
<ErrorNumber>10</ErrorNumber>
<Type>ValidationException</Type>
<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?

Regards
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.

<Invoice>
<Type>ACCREC</Type>
<Contact>
<Name>Martin Hudson</Name>
</Contact>
<Date>2011-12-30T00:00:00</Date>
<DueDate>2012-01-06T00:00:00</DueDate>
<LineAmountTypes>Inclusive</LineAmountTypes>
<LineItems>
<LineItem>
<Description>Items inclusive of Tax</Description>
<Quantity>4</Quantity>
<UnitAmount>59.99</UnitAmount>
<AccountCode>200</AccountCode>
</LineItem>
</LineItems>
</Invoice>

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
 

Chris Crawshaw