1

I am successfully writing invoices to Xero, including line item information, thus:

            $products_list[] = array(
                'Description' => $product_description,
                'Quantity' => (float) $row['Quantity'],
                'UnitAmount' => (float) $row['List Price'],
                'DiscountRate' => $discountPercentage,
                'TaxType' => 'OUTPUT2', //20% vat
                'TaxAmount' => $calculatedTaxRate, //20% vat
                'Name' => $xeroProductName['itemName'],
                'ItemCode' => $xeroProductName['itemCode'],
                'AccountCode' => $accountCode
            );

All is fine except the AccountCode - no matter what I do it simply doesn't get written (neither I think does TaxAmount). I notice in Xero that 'Account' is a dropdown and when an account is selected, the tax amount is calculated.

Any help greatly appreciated.

Andy

Andy
  • 11
  • 1
  • Are you getting an error response because there's no account code, or are you just getting a blank written into the invoice? I didn't think the latter was possible. – droopsnoot Oct 29 '19 at 12:44
  • If you're getting an error code, have you checked in "my apps - history" in the developer centre? You can see the xml that the API has posted there, but not if it appeared to be successful. You have to ask Xero support for assistance to see calls that seem to have worked. – droopsnoot Oct 29 '19 at 13:02
  • What is an AccountCode? The docs say "Default account code to be used for purchased/sale" . The examples give a number like 200. What does it refer to? – Ade Nov 12 '21 at 18:20

0 Answers0