ml-connector
FreshBooksChargebee

FreshBooks and Chargebee integration

FreshBooks handles your accounting; Chargebee handles your subscription billing. Connecting them keeps your two systems aligned so that every subscription customer in Chargebee appears as a client in FreshBooks, every Chargebee invoice has a matching record in FreshBooks accounting, and credit notes flow backward to adjust accounts receivable. ml-connector handles the different OAuth and Basic Auth flows and syncs records on the cadence Chargebee's webhooks provide.

How FreshBooks works

FreshBooks exposes clients, invoices, bills, expenses, items, and chart of accounts through REST APIs in two namespaces: accounting for finance records and timetracking for project time. It authenticates with OAuth 2.0 Authorization Code grant (user-delegated, not Client Credentials) and publishes webhook events for invoice, bill, payment, client, and expense changes with HMAC-SHA256 signatures. FreshBooks webhooks can take seconds to several minutes to deliver and have a 10-second timeout per attempt, with persistent failures disabling the callback. Invoices and payments are read-only on status fields since status is computed by the system.

How Chargebee works

Chargebee is a subscription billing platform exposing customers, subscriptions, invoices, credit notes, transactions, payment sources, and items through REST API over HTTPS with HTTP Basic Auth (API key as username, empty password). It publishes 200+ webhook event types across customer, subscription, invoice, payment, credit note, and coupon categories with no HMAC signature, relying instead on Basic Auth protection or re-fetch via GET for verification. Chargebee imposes rate limits by plan tier (Starter 150 req/min, Performance 1000 req/min, Enterprise 3500 req/min) and uses offset-based pagination with max page size 100. It has no native GL or procurement objects, so all records are billing-domain only.

What moves between them

The main flow is Chargebee to FreshBooks. When Chargebee publishes customer.created events, ml-connector creates a matching FreshBooks client. When Chargebee publishes invoice.created events, ml-connector creates a matching FreshBooks invoice in the accounting namespace. When Chargebee publishes credit_note.created events, ml-connector creates a matching FreshBooks credit note to adjust receivables. Product and service mappings between the two systems are configured upfront so that Chargebee line items map to FreshBooks items by SKU.

How ml-connector handles it

ml-connector registers a webhook endpoint with Chargebee and listens for customer, subscription, invoice, and credit note events. On each event, it decrypts the stored Chargebee Basic Auth credentials, makes the HTTP Basic Auth call to fetch the full record from Chargebee's REST API, then exchanges the stored FreshBooks OAuth refresh token for a fresh access token (handling expiry gracefully), and writes the record to FreshBooks' accounting namespace. Chargebee rate limits (especially on Starter tier at 150 req/min) are managed with backoff and retry. Product SKU matching is case-sensitive and is cached after first read. Because FreshBooks status fields on invoices are computed and read-only, ml-connector never attempts to write status, only the invoice amount and line items. Webhook delivery from Chargebee can lag from seconds to minutes, so for near-real-time syncs a periodic polling job can also read subscriptions directly from Chargebee's API and reconcile outstanding mismatches.

A real-world example

A B2B SaaS company runs subscriptions through Chargebee for multiple tiers of customers (starter, growth, enterprise) and uses FreshBooks for accounting and reporting. Before the integration, the finance team exported invoice reports from Chargebee each day and manually recreated them in FreshBooks, then had to manually link each invoice to the right customer in FreshBooks. With Chargebee and FreshBooks connected, every subscription customer appears in FreshBooks automatically, every invoice Chargebee generates flows to FreshBooks within minutes, and month-end close starts with all receivables already recorded and reconciled to subscription revenue.

What you can do

  • Create FreshBooks clients for every Chargebee subscription customer via customer.created and customer.updated webhook events.
  • Sync Chargebee invoices to FreshBooks accounting namespace with line items mapped to FreshBooks items by SKU.
  • Post Chargebee credit notes as FreshBooks credit notes to adjust accounts receivable when subscriptions are downgraded or canceled.
  • Authenticate Chargebee with HTTP Basic Auth and FreshBooks with OAuth 2.0 token refresh, handling expiry and credential storage encrypted.
  • Manage Chargebee rate limits with backoff and retry, and reconcile via polling on a schedule when webhook delivery is delayed.

Questions

How does ml-connector handle the different auth flows between Chargebee and FreshBooks?
Chargebee uses HTTP Basic Auth (API key as username, empty password). FreshBooks uses OAuth 2.0 with a refresh token that ml-connector stores encrypted and exchanges for a fresh access token on each call. ml-connector handles both flows transparently, refreshing the OAuth token when it expires and managing credential rotation.
Which direction does data move between Chargebee and FreshBooks?
The main flow is Chargebee to FreshBooks. Customers, invoices, and credit notes flow from Chargebee into FreshBooks' accounting namespace. FreshBooks customer and invoice records remain read-only from FreshBooks' perspective, so ml-connector does not write changes back to Chargebee. Subscription products are mapped to FreshBooks items upfront by SKU.
What happens if Chargebee's webhook delivery is slow or fails?
Chargebee webhooks can take seconds to minutes to arrive. ml-connector can also poll Chargebee's REST API on a schedule to reconcile outstanding invoices and customers, ensuring no records are lost even if webhook delivery is delayed. Rate limit backoff is applied to prevent throttling errors on Starter tier plans.

Related integrations

Connect FreshBooks and Chargebee

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

Get started