How to automate purchase order entry into Xero
Connect your order mailbox and Xero to Portal, then add a routing rule that creates an order draft. The AI reads the lines, matches them to items and prices from Xero, and an approver sends the draft on as a draft Xero sales invoice, since Xero has no sales order document.
About Xero.
Xero is online accounting software that calls itself a global small business platform, used by small businesses and the accountants and bookkeepers who work with them. It has been around since 2006 and leads cloud accounting in New Zealand, Australia and the UK.
It is sold as subscription plans with no per-user license fees. In the US the plans are Early, Growing and Established: Early sends quotes and up to 20 invoices, multiple currencies and project tracking come with Established, and Inventory Plus is an optional add-on on Growing and Established.
Xero only runs in the cloud. Every integration reaches it through the Xero Accounting API with OAuth 2.0, one connected organisation at a time, so there is nothing to install and nothing to open in a firewall.
Portal by Webisoft is a B2B portal for Xero: customer self-service and team apps on live Xero data.
Why connecting to Xero is hard.
In Xero an emailed purchase order usually ends up typed in as a draft invoice by whoever handles the books. Portal reads the email, matches the contact and item codes, and creates that draft for review.
Small API limits per organisation
Xero allows 5 calls in progress at once and 60 calls per minute for each connected organisation, plus a daily limit of 1,000 calls on the starter app tier and 5,000 on higher tiers. An organisation can connect at most five uncertified apps, so each extra tool you wire to Xero eats into the same small budget.
Tokens that expire and scopes that change
A Xero access token lasts 30 minutes and a refresh token 60 days, and every refresh hands back a new refresh token that has to be saved, with only a 30 minute grace period if it is lost. Xero is also replacing broad scopes such as accounting.transactions with granular ones; broad scopes remain available until September 2027.
Accounting documents, not order documents
Items saved in Xero feed quotes, invoices and purchase orders; there is no sales order to hold an order before it is billed. Core Xero also does not track inventory in more than one location, and codes can be assigned to up to 4,000 items, so order and stock workflows have to be mapped onto what Xero has.
Your options.
| Option | Fits when | Watch out for |
|---|---|---|
| Native Xero add-ons | You need one narrow function and an add-on covers it. | Each add-on is its own product to license, learn and upgrade. |
| Generic integration platform | You have someone in-house to build and maintain the flows. | You still build the screens, the AI layer and the Xero write rules yourself. |
| Custom code | The need is unique and you have developers who know Xero. | Upgrades and staff changes put the integration at risk. |
| Portal by Webisoft | You want customers, your team and AI agents working on live Xero data. | It works on top of Xero; it does not replace it. |
How Portal reaches Xero.
Your administrator clicks Connect with Xero, signs in and picks the organisation; Portal then works through the Xero Accounting API with OAuth 2.0 and granular scopes. Changes are found with If-Modified-Since, and Xero also notifies Portal when contacts and invoices change, so nothing has to be set up on the Xero side. Portal keeps to 3 calls at a time, under the 5 Xero allows.
Because Xero has no sales order, an order placed in Portal is written as a draft sales invoice and a quote as a draft Xero quote; accepting a quote creates the draft invoice from its lines and marks the quote invoiced. Every create carries an Idempotency-Key and a portal reference, and Portal looks for that reference before creating, so a retried order or payment is never entered twice. Credit hold is a Xero contact group, Credit Hold by default, since Xero has no credit hold flag.
What you need.
- A Xero user who can approve app access for the organisation
- The code of the Xero bank account that should receive portal payments
- The mailbox purchase orders arrive in, on Gmail, Microsoft 365 or any address you can forward
Step by step.
Your Portal team sets up the Xero connection with you during onboarding, so the first step is done together. The rest is yours to change any time.
Connect with Xero and pick the organisation
Under Setup, ERP, ERP system, choose Xero and click Connect with Xero, sign in and pick the organisation to connect; Portal fills in its name and organisation ID. Then name the contact group that marks credit hold, Credit Hold by default, and enter the code of the Xero bank account that receives portal payments. Nothing is installed, and Xero notifies Portal on its own when contacts and invoices change.
Connect the orders mailbox
In Email, Sources, choose Connect Gmail or Connect Microsoft 365, or create a forwarding address and forward your orders inbox to it.
Create order drafts from purchase orders
In Email, Routing rules, add a rule for the purchase order intent with the action Create an order draft. Lines are matched to Xero items and priced from the sales unit price on each Xero item, as Xero keeps no price levels or customer prices; anything unmatched is listed in the draft notes.
Approve and send
Drafts wait in the Review queue. An approver checks the lines and chooses Submit to ERP; the draft becomes a draft Xero sales invoice, since Xero has no sales order document, and once Xero confirms it the customer gets a reply with the order number.
What syncs with Xero.
| Record | Read | Write back | Note |
|---|---|---|---|
| Contacts (customers, contact persons, addresses) | Yes | Yes | Create, update and archive; credit hold from a contact group; balance from Xero |
| Items | Yes | Yes | An item no longer sold is inactive |
| Prices | Yes | No | Item sales price only: Xero has no price levels or customer prices |
| Stock | Yes | No | Quantity on hand of tracked items, one location |
| Quotes | Yes | Yes | An accepted quote becomes a draft invoice |
| Orders | Yes | Yes | Draft sales invoices, since Xero has no sales order |
| Invoices | Yes | Yes | An order's draft invoice is approved when you bill it |
| Credit notes | No | Yes | Allocated to the invoice they credit |
| Payments | Yes | Yes | One Xero payment per invoice paid, into the bank account you choose |
| Purchase orders | Yes | Yes | Create, and change line quantities |
| Bills and supplier payments | No | Yes |
Limits today: Xero has no sales orders, shipments or returns: portal orders become draft invoices and returns become credit notes.
What you can do next.
- A customer emails a PDF purchase order; Portal drafts it against their Xero account and pricing, and an approver submits it.
- A buyer uploads a photo of a printed PO with Order from a file on the portal; the lines land in their cart, priced from Xero.
Xero questions, answered.
What if the customer is on credit hold in Xero?
The draft cannot be submitted while the customer is on hold, which Portal reads from the Xero contact, on credit hold when it belongs to the Credit Hold contact group.
Can it read our Xero item numbers from a customer's part numbers?
Lines are matched to your catalog by the AI; anything it cannot match is listed in the draft so a person can pick the right item.
What stops a duplicate order if something is retried?
Every order carries an Idempotency-Key on every create and a portal marker in the Xero Reference field, searched for first, so a retry finds the first order instead of creating another.
Keep going.
- Automate order entry from email: overview
- B2B portal for Xero
- Connect an AI agent to your ERP, Xero
- Take invoice payments online, Xero
- Give customers order status, Xero
- Build a B2B ordering portal, Xero
- Quotes customers accept online, Xero
- Triage a shared inbox, Xero
- Add approval workflows, Xero
- One REST API for your ERP, Xero