ml-connector
XeroChargebee

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.

How Xero works

Xero is a cloud accounting platform that exposes invoices, contacts, purchase orders, payments, accounts, and manual journals through the Xero Accounting API using REST with JSON or XML responses. It authenticates via OAuth2 Authorization Code flow, with access tokens that expire in 30 minutes and refresh tokens valid for 60 days when the offline_access scope is requested. Xero supports webhooks for contacts, invoices, credit notes, payments, manual journals, purchase orders, and bank transactions (CREATE and UPDATE events only), though webhooks contain only metadata and require a follow-up GET to fetch the full record. For polling, Xero supports delta sync via the If-Modified-Since header. Rate limits are enforced at 5 concurrent calls, 60 per minute per tenant, and 5000 per day per tenant. All API requests require the Xero-tenant-id header to target a specific organization.

How Chargebee works

Chargebee is a subscription billing and revenue management platform that handles recurring billing, invoicing, and payment collection through REST APIs secured with HTTP Basic Auth using an API key as the username. It exposes customers, subscriptions, invoices, credit notes, transactions, payment sources, items, and item prices. Chargebee supports outbound webhooks for over 200 event types across customer, subscription, invoice, payment, credit note, order, coupon, and item categories, with retries up to 2 days and increasing delays. It uses offset-based pagination with a maximum page size of 100 records. Rate limits depend on the plan tier, ranging from 150 requests per minute for Starter to 3500 for Enterprise, with separate limits for concurrent GETs and POSTs. Chargebee has no native GL or procurement objects, so it functions as a billing and customer management layer, not a source for financial accounting.

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

Connect Xero and Chargebee

Free to use. Add your credentials, ping your real systems, and see if we fit.

Get started