Xero Integration setup


The Xero integration allows small to medium sized businesses to link all their inventory and order management activities on Stock&Buy with their accounting records on Xero. This tremendously helps streamline business operations by aligning your inventory records with your accounting journal in a simple and effective way. This automation is enabled by the Stock&Buy ability to link invoices, payments, stock and customer data automatically with your Xero account.

:triangular_flag_on_post:Important: Stock&Buy does not communicate with Xero’s Inventory Management feature. Products in Stock&Buy will not be synced with your products on Xero. The remainder of this article details the data types which sync with Xero.


Before you can link your Stock&Buy account with your Xero account, certain settings have to first be adjusted in Xero to allow a smooth integration.
Stock&Buy needs the following accounts to be setup in Xero in order to link your records and all your transactions:

Sales account

Stock&Buy will push all of your sales orders to this account.

Payments account

When a payment is created against a given invoice in Stock&Buy, a corresponding item is created in Xero and is recorded against your payments account.

:warning: The xero payment account used in this section must be a bank account or a ledger account for which the “Enable payments to this account” option is ticked on.

Purchases account

An expenses account against which Purchase orders will be recorded.

Stock Purchases account

An expenses account against which Purchase order net value (without VAT / Tax/ GST) will be recorded.

This account is mainly used to balance the SOH account once your purchase orders are received.

Stock On Hand account

A current asset account where to record your stock on hand.

Cost of Goods Sold account

Adjustments account

An expenses account against which Adjustments will be recorded. This is useful if you want to capture stock loss/shrinkage/write offs. This account can also be used to keep a close eye on manual adjustments made and query them monthly.

Once your Xero accounts are all set, head over to Stock&Buy and install the Xero integration accessible in the Integration pane from the main navigation menu.
Follow the on-screen instructions which should take you through the following steps:

  1. Install the Xero integration in Stock&Buy
  2. A page will open asking you to log into your Xero account and authorize Stock&Buy to access to account data
  3. One you authorize access to your Xero account, you will be redirected back to Stock&Buy where you get the option to map your Stock&Buy transactions to your Xero accounts

How does the integration work?

Stock&Buy automatically syncs all your orders and inventory records with your accounting journals on Xero.
The following summarizes the operations and interactions between Stock&Buy and Xero.

Stock&Buy Transaction Xero Transaction
Approve a purchase order A bill is created against your Purchases account account
Receive a purchase order Creates a journal entry which moves the net amount (without tax) of the purchase order from the Stock Purchases account to your Stock On Hand account.
Void a purchase order Sets the corresponding bill back to Draft (see note below)
Invoice a sale order An invoice is created against your Sales account in Xero
Record a payment for a sale order Marks the corresponding invoice as Paid in Xero and pushes a note to your payments account
Void a sale order Sets the corresponding bill back to Draft (see note below)
Create a sale refund A credit note is created against your sales account in Xero
Ship (fulfill) a sale order A journal entry is created to move the order total cost of goods sold from the Stock On Hand account to the Cost of Goods Sold account. Any refunds attached to the closed order will result in a journal entry moving the total cost of the refund from the cost of goods sold to the Stock On Hand account (if the items are restocked) or the Adjustments account if the items is written off
Create an adjustment A journal entry is created moving the total adjustment value from the Stock On Hand ledger account to the adjustments ledger account

:information_source: Stock&Buy can set an invoice or purchase order to Draft state only and only if the document (invoice / bill) has no payments attached to it. The document has to be manually modified within Xero it has a payment attached to it.

More details

You can view more details about the inner working of the Stock&Buy - Xero integration in the video below:


Xero Stock On Hand balance

There is a subtle difference between the stock on hand value within Stock&Buy versus the value in Xero.
The stock on hand in Stock&Buy is the sum of all your product costs multiplied by their quantity on hand.
Your stock on hand in Xero (synced by Stock&Buy) is the sum of all the purchases (and adjustments) performed since Stock&Buy was integrated with Xero.

Let’s consider the following example:

Day 1:
Bob joined Stock&Buy and imported two products, Jeans :jeans: and Shirts :tshirt:
Bob has imported 10 jeans valued at $1000 and 5 shirts valued at $500.
Bob’s total inventory at hand in Stock&Buy would be $1500.

Day 2:
Bob decides to join Xero to manage his accounting online.

Day 3:
Bob purchases a couple more jeans valued at $300.
The total Stock On Hand within Stock&Buy is now $1800
The total Stock On Hand within Xero is now $300

The discrepancy above is due to the fact that Bob did not setup his Stock On Hand opening balance at $1500 when he created his Xero account.

It is therefore very important to double check your Stock On Hand value within Stock&Buy and make sure Xero has a similar opening balance.

Sales and purchases tax handling

Sales and purchase tax are also synced from Stock&Buy to Xero. However there are important considerations you need to be aware of depending on which country your reside in.

Xero AU, Xero NZ and Xero UK:

If you have you are running an Australian, New Zeland or United Kindom Xero version, then you must already have your tax rates defined in Xero (Xero creates them automatically for you). For these Xero versions, Stock&Buy pushes all data without tax definitions. The invoices and bills will automatically get assigned their respective tax rates depending on what ledger account they are sent into.

Other Xero versions:

If your Xero version is none of the above, then Stock&Buy will automatically push your tax definitions within Stock&Buy to Xero. This applies to both sales and purchase tax rates (also applies to orders coming from online shops such as Shopify)

:notebook: Important notes: All changes made in Xero do not propagate back to Stock&Buy. It is therefore highly recommended to perform all your operations within Stock&Buy.

Advanced Xero settings:

This post outlined the various steps to follow in order to get going with Xero. It cover the basic default settings such as sales, payment and purchase ledger account settings. The Xero Integration for Stock&Buy is not limited to those default settings. These default settings can be augmented to sync payments and sales to different accounts depending on tax rates, payment gateways and so on. One can for example send paypal payments to Xero ledger account 201 while all other payments go to ledger account 200. This is achieved by our powerful concept of Xero account rules covered in the Xero advanced settings article.

Common Xero Errors and Warnings
Advanced Xero settings
Shopify transactions not syncing to Xero
Stock on hand difference between Stock&Buy and Xero
Consignment Stock