Xero and Chargebee integration
Xero handles your accounting and invoicing. Chargebee handles your subscription billing and revenue recognition. Connecting them keeps your customer records and billing data synchronized across both platforms. New customers in Xero flow into Chargebee automatically, and invoices created in Xero can trigger or supplement billing records in Chargebee. ml-connector manages the different authentication models and maps invoices and contacts between the two systems without manual intervention.
What moves between them
Customer contacts and invoice data flow from Xero into Chargebee on a schedule controlled by webhook events or polling intervals. When a new contact is created or updated in Xero, ml-connector maps it to a Chargebee customer record. When an invoice is created in Xero, ml-connector sends it to Chargebee where it can be linked to an existing subscription or used as a one-off transaction. Payments recorded in Xero can also flow into Chargebee as transactions. The primary flow is one-directional (Xero to Chargebee) because Chargebee does not hold GL data; however, subscription changes and invoice disputes in Chargebee can be queried and logged in Xero for reconciliation.
How ml-connector handles it
ml-connector stores both credential sets securely and refreshes the Xero OAuth2 access token transparently when it expires. It listens for Xero webhooks on contacts, invoices, and payments, and when received, fetches the full record via Xero's API using the Xero-tenant-id header and maps it to Chargebee's customer, invoice, or transaction schema. For contacts, it uses the email address and name from Xero to create or update a Chargebee customer. For invoices, it maps the invoice number, amount, due date, and line items from Xero's format to Chargebee's invoice structure. Because both systems have rate limits, ml-connector queues outbound writes to Chargebee and batches updates where possible, backing off if Chargebee returns HTTP 429. Chargebee's webhook signature is validated using the API key-based auth model. ml-connector maintains a deduplication key based on the Xero invoice or contact ID so that duplicate webhook events do not create duplicate records in Chargebee. If a write to Chargebee fails, the record is queued for replay with a full audit trail of each attempt.
A real-world example
A SaaS company uses Xero for its accounting and bookkeeping, invoicing customers directly from Xero. The same company uses Chargebee to manage recurring subscriptions and handle dunning and payment retry logic for subscription-based revenue. Before the integration, the finance team manually exported customer data from Xero every month, imported it into Chargebee, and reconciled invoice numbering and amounts by hand. With Xero and Chargebee connected, new customer signups in Xero automatically create billing profiles in Chargebee, invoices issued in Xero flow into Chargebee as billing records, and payment data remains consistent across both systems without re-entry.
What you can do
- Sync Xero contacts into Chargebee as customer records, keeping names, email addresses, and company information current.
- Map Xero invoices into Chargebee invoice records with amounts, due dates, and line item details.
- Handle Xero OAuth2 token refresh automatically and authenticate to Chargebee using HTTP Basic Auth with the stored API key.
- Validate Xero webhook events and fetch full record payloads, then queue writes to Chargebee respecting both systems rate limits.
- Track every sync attempt in an audit log and replay failed records without manual intervention or risk of duplication.
Questions
- Which direction does data move between Xero and Chargebee?
- The primary flow is from Xero into Chargebee. Customer contacts and invoices created in Xero are synced to Chargebee where they populate the customer and invoice records used for billing and revenue recognition. Because Chargebee has no GL data, it cannot push financial entries back to Xero; however, subscription events in Chargebee can be logged in Xero for reconciliation.
- How does ml-connector handle the different authentication methods between Xero and Chargebee?
- ml-connector stores both credentials securely: the Xero OAuth2 client ID and secret (used to obtain access tokens valid for 30 minutes), and the Chargebee API key (used with HTTP Basic Auth). It transparently refreshes the Xero access token when it expires and presents the API key on every request to Chargebee, eliminating the need to manage authentication in your workflows.
- What happens if a webhook event from Xero is received twice or if a write to Chargebee fails?
- ml-connector deduplicates webhook events using the Xero record ID, so duplicate events do not create duplicate Chargebee records. If a write to Chargebee fails, the record is queued and automatically retried with a full audit trail, so no data is lost and failed syncs can be replayed once the issue is resolved.
Related integrations
More Xero integrations
Other systems that connect to Chargebee
Connect Xero and Chargebee
Free to use. Add your credentials, ping your real systems, and see if we fit.
Get started