Integration guides
How do I create a Xero invoice automatically when a HubSpot deal is won?
Flow Mesh · · 7 min read
A deal moves to closed won in HubSpot, and then someone opens Xero, finds or creates the client, retypes the line items and raises the invoice. It takes ten minutes when it goes well. When it does not, the invoice goes out late, to the wrong billing contact, or not at all.
The direct answer: HubSpot's own Xero integration does not create invoices from deals, so you need one of three routes. A HubSpot Marketplace app that adds this feature, an automation platform such as Zapier or Make, or a HubSpot workflow that calls a webhook. For most 10 to 50 person firms, the safest design creates a draft invoice in Xero that a person approves, rather than sending invoices with no one looking.
Why the native integration does not do it
HubSpot's Data Sync app for Xero syncs contacts, products, invoices and payments, as described in HubSpot's knowledge base. Deals are not one of the synced objects. So winning a deal does not, on its own, produce anything in Xero. Our guide on how to integrate HubSpot with Xero covers what the native sync does well; this article picks up where it stops.
Before you build: decide four things
Most deal-to-invoice automations fail because of decisions nobody made, not because of the tools.
- What "won" means. Is closed won the moment to invoice, or is it when the engagement letter is signed, or when the deposit is due? Some firms invoice a deposit on win and the balance later. Pick one trigger.
- Where the line items come from. The invoice can only be as good as the deal. If your team attaches products or line items to deals, the automation can copy them. If the deal holds only an amount, the invoice will have one line, and someone will need to describe it.
- Who the invoice goes to. A deal is usually associated with a company and one or more contacts. Decide which contact is the billing contact and where that is recorded, for example a "billing contact" property on the company.
- Draft or approved. A draft invoice waits in Xero for someone to check and approve it. An approved invoice is ready to send. Start with drafts.
Route 1: a HubSpot Marketplace app
Several apps add "create a Xero invoice from a deal" to HubSpot. Two examples:
- Integrate Xero and HubSpot by Inbound Addons says it can create a Xero invoice when a deal's stage changes, with a separate line for each deal product.
- ScaleXP Invoicing adds a "Create Xero Invoice" action you can use in HubSpot workflows with a closed won trigger. Its help center notes that only one-off invoices can be created through workflows, as documented in October 2026.
Good fit when: your process is standard (one deal, one invoice, line items on the deal) and you want something maintained by a vendor. Watch for: each app has its own subscription, its own contact matching rules, and its own idea of which fields map where. Check the listing for current pricing, and test how it handles a client who already exists in Xero under a slightly different name.
Route 2: Zapier or Make
An automation platform gives you full control over the steps. On Zapier, the HubSpot and Xero integration page lists an Updated Deal Stage trigger and Xero actions including Find Contact, Create/Update Contact and Create Sales Invoice. On Make, the HubSpot CRM and Xero page lists a Watch CRM Objects trigger for created or updated records and a Xero Create an Invoice module, plus a generic API call module for anything the ready-made modules do not cover.
A typical build looks like this:
- Trigger: deal enters the closed won stage.
- Fetch the details: read the deal's associated company, billing contact and line items from HubSpot.
- Find the client in Xero: search by a stable key, ideally the Xero contact ID stored on the HubSpot company from a previous run. Fall back to email or company name only if no ID exists.
- Create the contact only if none was found, then write the new Xero contact ID back to the HubSpot company so the next invoice skips the search.
- Create the invoice as a draft, with each line item's description, quantity, price, account code and tax rate, and a reference that includes the HubSpot deal ID.
- Write back to HubSpot: store the Xero invoice number on the deal and add a note, so anyone looking at the deal can see the invoice exists.
- Notify a person: post to a channel or send an email to whoever approves invoices.
Good fit when: your firm has deposits, retainers, several entities, or other tools in the chain. Watch for: the per-task or per-credit cost of every step. Our guide to Zapier's pricing explains how a seven-step build is counted.
Route 3: a HubSpot workflow with a webhook
If you already pay for the right HubSpot tier, a workflow can trigger on closed won and send the deal to an endpoint you control, such as an n8n or Make webhook, or a small custom service. HubSpot workflows themselves need a Professional or Enterprise subscription on one of the hubs listed in HubSpot's workflow documentation. The webhook action specifically is available with Data Hub Professional or Enterprise, according to HubSpot's webhook article, as listed in October 2026. That article also says HubSpot retries failed webhooks for up to three days, which matters: your receiving end must recognize a deal it has already invoiced and not create a second invoice.
Good fit when: the firm already has the HubSpot tier and someone who can maintain the receiving end. Watch for: the logic now lives in two places, so document both.
Comparing the three routes
| Marketplace app | Zapier or Make | Workflow and webhook | |
|---|---|---|---|
| Setup effort | Low | Medium | Medium to high |
| Flexibility | Limited to the app's options | High | Highest |
| Extra subscription | The app | The automation platform | HubSpot tier, plus wherever the webhook lands |
| Who maintains it | Vendor, plus your settings | Your team or a consultant | Your team or a consultant |
The checks that prevent the usual mistakes
Duplicate contacts in Xero
Xero requires contact names to be unique; its product team confirmed on the Xero product ideas forum that there are no current plans to allow duplicates. That means a "create contact" step can fail when the client already exists, or quietly create "Smith & Co Ltd" next to "Smith and Co Limited". Searching by a stored ID first is the fix. Our article on syncing data without duplicates goes into the method.
Deals won twice
Deals get moved back and forth between stages. If someone moves a deal out of closed won and back in, a naive automation invoices it again. Store the Xero invoice number on the deal, and have the automation stop if that field already has a value.
Wrong account codes and tax rates
Each line item needs an account code and tax rate that your accountant agrees with. Map HubSpot products to Xero items or account codes once, in a table you can review, rather than hard-coding them in the automation. Check the mapping with your accountant before the first live invoice.
Two tools writing the same record
If HubSpot's Data Sync is also syncing contacts or invoices, decide which tool creates what. A common split: the automation creates invoices, Data Sync brings payment status back into HubSpot. Never let both create contacts.
Testing before you switch it on
Run the automation against a Xero demo company or a test deal first. Try the awkward cases on purpose: a client with an accent in the name, a deal with no line items, a deal with a discount, a client that already exists in Xero, and a deal moved to won twice. Keep the automation on draft invoices for at least the first month and compare each draft with what someone would have typed by hand.
How Flow Mesh helps
Deal-to-invoice is one of the workflows our stack audit looks at closely: we check how HubSpot and Xero are set up today, give each tool a verdict (keep, configure, consolidate or replace) and write down exactly which system owns contacts, line items and invoices. If you want us to build it, we scope and quote the build in writing after the audit and work inside your own accounts.
Key takeaways
- HubSpot's native Xero sync does not create invoices from deals; you need a Marketplace app, Zapier or Make, or a workflow webhook.
- Decide the trigger, the line item source, the billing contact and draft versus approved before building anything.
- Search Xero by a stored contact ID before creating contacts; Xero does not allow duplicate contact names.
- Store the Xero invoice number on the deal so a deal moved to won twice is not invoiced twice.
- Start with draft invoices and a named approver, and test the awkward cases first.