Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Endpoints >

LineAmountTypes - Tax Type of API created invoice is being inherited from last manually created inv

Started by John Wilson -   in API Endpoints

We have recently uncovered an issue that has resulted in a number of our invoices being wrongly generated as tax inclusive.

We have an internal system which is used to track jobs and the work done on them by different departments within our organisation.

Once a job is complete, a production controller sends the job to Xero for invoicing.
This effectively takes all the data from the job ticket and posts the relevant parts to the Xero API to generate a new invoice.

The issue we are having at the moment is that we have just found that a number of "seemingly random" invoices have been created as GST inclusive when they should be GST exclusive.

The function which generates the invoice via the API is hard coded to always set the LineAmountType to be Exclusive, as we rarely ever raise GST inc invoices.

Through testing, we have discovered that if a user logs into Xero and manually raises an invoice and sets the Tax to be GST inclusive, then any requests sent through the API will now generate invoices as GST inclusive (ignoring the hard coded LineAmountType = Exclusive) from that point on until the user logs into Xero and manually generate a new invoice with tax set to Exclusive. At which point all API generated invoices will now be tax exclusive.


We have tested this by creating a job ticket within our internal system and repeatedly sending the same XML payload to the Xero API. The tax status of the resulting invoice will be determined by the most recent manually generated invoice, not by the data in the API call.

Is this the expected behaviour?



STEPS TO REPLICATE THIS

1.
Action: Send XML to API to generate a new invoice with LineAmountType set to Exclusive
Result: A new invoice is generated as Tax Exclusive (as expected)

2.
Action: Send same XML to API to generate a new invoice with LineAmountType set to Exclusive
Result: A new invoice is generated as Tax Exclusive (as expected)

3.
Log into Xero web interface, generate a new invoice and set Tax Type to GST inclusive
Result: A new invoice is generated as Tax Inclusive (as expected)

4.
Action: Send same XML as 1&2 to API to generate a new invoice with LineAmountType set to Exclusive
Result: A new invoice is generated as Tax Inclusive (NOT as expected)

5.
Log into Xero web interface, generate a new invoice and set Tax Type to GST Exclusive
Result: A new invoice is generated as Tax Exclusive (as expected)

6
Action: Send same XML to API to generate a new invoice with LineAmountType set to Exclusive
Result: A new invoice is generated as Tax Exclusive (as expected)
Hey John,

Apologies for late reply. Unfortunately, I wasn't able to replicate the issue on my side and it seems to be working fine.

If you could send some more details by emailing api@xero.com, we can have a closer look into it.

Thanks
Keertika
 

Keertika Chandola (Community Manager)