Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Endpoints >

(C#) Exporting Purchase Orders to Xero doesn't retain the AccountCode

Started by Lubomir Sotirov -   in API Endpoints

I am working on an integration to Xero with the .Net library and I ran into a possible bug. Upon trying to export a Purchase Order to Xero, every Line Item loses it's AccountCode value. On calling the .Create() method for the Purchase Orders endpoint I am checking if it has the AccountCode property populated for every Line Item (and it is), but on receiving the response from Xero, every Line Item has null for the AccountCode. Going to the Xero interface yields no different results, again a blank field... for every line item.

Am I doing something wrong or is it an actual bug?
Hi Lubomir,

The account codes are optional on .Net library, you can always supply an account code on the lineitem and it would create with them fine. I can see that you own a public application/integration 'Stock Channel' connecting to : Demo Company (UK), I've had a look at our logs and can see that your API calls for PUT/purchaseorder since 16'th Feb have only one line item and that does have account code 300 specified on the request and the response shows the same being set on the Purchase Orders.

Hope this helps.

Regards,
Krish
 

srikrishna tadinada (Community Manager)  

Hi Krish, I found out where I went wrong. I got confused and I thought that it was a bug, because the Line Item price was £0 and by trial and error I fugured out that the Xero API disregards the Account Code and Tax Rate, because there is no logic to apply tax on an item that costs £0. Once I sent an item that had a valid price (> £0), the Account Code and Tax Rate were properly applied to the Line Item. Thanks for your response :)
 

Lubomir Sotirov