0

I'm trying to post invoices to XERO using the API. I'm getting an exception "The UnitAmount field is mandatory and cannot be derived from the Quantity and LineAmount fields." for null UnitAmount and Quantity.

The only way I can post the invoice lines is by adding 0 for UnitAmount and adding 1 for quantity.

How can I post null value invoice lines?

Shereen
  • 119
  • 1
  • 17
  • 1
    What other fields are you adding in your lineitem? It is possible to have description only line items. If you want the lineitem to have an 'amount' you'll need to supply at least two of the following three properties: UnitAmount, Quantity, LineAmount – MJMortimer Sep 10 '19 at 21:50
  • @MJMortimer I'm adding AccountCode, Description,TaxType,TaxAmount,UnitAmount,Quantity and trackingCategory fields. How do I Add description only line Items – Shereen Sep 10 '19 at 22:53
  • Sorry, I think you misunderstood my question. To get the original error that you were getting (before adding default values for unit amount and quantity) , what fields were being set? – MJMortimer Sep 11 '19 at 01:26
  • @MJMortimer I have found a solution. I have uploaded the invoice with null account code and it fixed the issue. Thanks for your help – Shereen Sep 11 '19 at 03:21

1 Answers1

0

upload the invoice with null account code and it will fixe the issue.

Shereen
  • 119
  • 1
  • 17