Integrating with Xero Tracked Inventory


Set-up inventory accounts

Before you get started you will need to ensure the Xero organisation has the required accounts in its chart of accounts:

  • Inventory Asset Account – An asset account of type INVENTORY to track the value of stock on hand.
  • Inventory Adjustment Account – An account to track the value of inventory adjustments.
  • Cost of Goods Sold Account – An expense account to track the cost of goods sold.

You may want to have more than one inventory asset account if you want to distinguish between different stock lines on your balance sheet.

You can check this using the accounts endpoint and create new accounts if required.


Create the tracked inventory items in Xero

Once you know the Inventory Asset Account and Cost of Goods Sold Account you can create the inventory items in Xero (if they haven’t been created yet). See our documentation on the Items endpoint for details how to create and update tracked items.


Inventory Adjustments

Once the inventory items are created in Xero you may need to adjust the quantity and value of each item. You can do this using an inventory adjustment.

You may also need to do inventory adjustments periodically to increase/decrease quantity or revalue items (e.g. after a stocktake).

Increase Quantity on Hand

You can increase quantity on hand by creating a zero-total purchase (ACCPAY) invoice using the Invoices endpoint. For each inventory item you will need to create two line items; one to recognise the increase in the inventory asset (and increase the quantity on hand) and a second to recognise the the inventory adjustment. The inventory adjustment line will have a negative unit price so the two lines sum to zero.

Here’s an example. Imagine I’m adding 2 refrigerators at $1000 each. My inventory asset account is 630 and inventory adjustment account is 401.

The XML request to bring perform the adjustment would look something like:

<Invoice>
  <Type>ACCPAY</Type>
  <Contact>
    <Name>Inventory Adjustments</Name>
  </Contact>
  <Date>2015-10-01</Date>
  <DueDate>2015-10-01</DueDate>
  <LineAmountTypes>NoTax</LineAmountTypes>
  <Status>AUTHORISED</Status>
  <LineItems>
    <LineItem>
      <ItemCode>Fridge</ItemCode>
      <Description>Refrigerator</Description>
      <Quantity>2.0000</Quantity>
      <UnitAmount>1000.00</UnitAmount>
      <AccountCode>630</AccountCode>
    </LineItem>
    <LineItem>
      <Description>Inventory Adjustment</Description>
      <Quantity>2.0000</Quantity>
      <UnitAmount>-1000.00</UnitAmount>
      <AccountCode>401</AccountCode>
    </LineItem>
  </LineItems>
</Invoice>

Decrease Quantity on Hand

Decreasing quantity of hand is the reverse of an increase. The only difference is using a credit note of type to ACCPAYCREDIT (rather than an invoice). The following example would decrease the quantity on hand by 2.

<CreditNote>
  <Type>ACCPAYCREDIT</Type>
  <Contact>
    <Name>Inventory Adjustments</Name>
  </Contact>
  <Date>2015-10-01</Date>
  <DueDate>2015-10-01</DueDate>
  <LineAmountTypes>NoTax</LineAmountTypes>
  <Status>AUTHORISED</Status>
  <LineItems>
    <LineItem>
      <ItemCode>Fridge</ItemCode>
      <Description>Refrigerator</Description>
      <Quantity>2.0000</Quantity>
      <UnitAmount>1000.00</UnitAmount>
      <AccountCode>630</AccountCode>
    </LineItem>
    <LineItem>
      <Description>Inventory Adjustment</Description>
      <Quantity>2.0000</Quantity>
      <UnitAmount>-1000.00</UnitAmount>
      <AccountCode>401</AccountCode>
    </LineItem>
  </LineItems>
</CreditNote>

Inventory Revaluations

Revaluing inventory is a three step process that includes a decrease adjustment and an increase adjustment:

  • Perform a GET on the item to retrieve the quantity on hand and total cost pool. Divide the total cost pool by the quantity on hand to get the average cost for the item.
  • Perform a decrease adjustment to bring the quantity on hand down to zero. Use the quantity on hand as the quantity and the average cost of the item as the unit price.
  • Perform an increase adjustment to bring the quantity back to the previous level. Use the revalued average cost as the unit price for the item.

Inventory Opening Balances

If you are a converting an organisation to Xero you may want to import inventory opening balances as part of the organisation setup. See our Inventory Opening Balances guide for more detail on that specific process.