Skip to main content
Chargebee → PostHogIntegration guide

Connecting Chargebee to PostHog

Chargebee is a billing system, so it holds the only complete record of what a subscription business earned — and it sits entirely outside the browser. PostHog can be self-hosted, which changes the calculus entirely: the data stays on infrastructure you control, and so does the responsibility for everything that goes wrong with it. The join between them succeeds or fails on one thing: whether the distinct_id reaches the Chargebee subscription before the conversion happens, because PostHog can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

PostHog: which product behavior leads to a Chargebee payment

Send Chargebee's payment_succeeded, cancellation and plan changes to PostHog's capture API with distinct_id set to your own user ID, the one used in identify, never the Chargebee customer ID. Attach the company as a group for B2B, include amount, currency, plan and interval, and derive event UUIDs from the Chargebee event ID. Use Chargebee for booked revenue.

PostHog shows what trial users do in the product; Chargebee knows which of them paid. The question this pair answers is which activation steps predict a first payment, and that needs the payment inside PostHog on the same person. Send payment_succeeded, cancellation and plan changes to the capture API with the distinct_id set to your own user ID, the same one you pass to PostHog's identify call when the user logs in.

The Chargebee customer ID is not that distinct_id, so store your user ID on the Chargebee customer or keep a lookup. Sending events with the Chargebee ID creates a separate PostHog person who has billing events and no product usage, which makes every paid user look like they never used the product. For B2B, also attach the company as a PostHog group so a payment lands on the account where several users did the evaluating.

Include amount, currency, plan and billing interval as properties, and set the event UUID from the Chargebee event ID so a webhook retry is ignored. Revenue in PostHog will not reconcile to Chargebee's books, since refunds and credits live in billing; use it to compare cohorts, and use Chargebee for what was earned.

Chargebee → PostHog · what breaks

Why this join usually fails — Chargebee → PostHog

  1. 01

    The distinct_id never reaches Chargebee

    The identifier must live on the customer or subscription so it survives a trial period that is longer than any browser cookie you can rely on. Chargebee's hosted checkout is also a different origin, so nothing crosses it by default.

  2. 02

    Trials longer than any cookie

    The gap between signup and first payment is where the identifier has to survive, and it is measured in weeks. Browser storage will not do it.

  3. 03

    Self-hosting the analytics and the outage together

    The advantage of owning the pipeline is that nothing blocks it. The cost is that when the ingestion instance fills its disk on a Saturday, the events are gone and nobody is paged. Hosted tools fail differently and more visibly.

  4. 04

    Nothing reconciles afterwards

    PostHog shows events in the activity view within moments. On a self-hosted instance, check the ingestion lag as well — events that are queued are not events that are lost, and the two need different responses.

Chargebee → PostHog · the fix

What working looks like — Chargebee → PostHog

  • The distinct_id on every subscription

  • Conversions arriving in PostHog

    The event lands on the person profile and becomes available in insights, funnels and session replay.

  • Reconciled against the source

Chargebee → PostHog · architecture

How Chargebee and PostHog actually connect

  1. 1

    Chargebee holds the truth

    The distinction that matters most here is invoice generated versus payment succeeded. An invoice is a bill you sent; a payment is money you received, and in any business with dunning the gap between them is large.

  2. 2

    PostHog needs a click to match

    PostHog needs a distinct_id, an event name and its properties. Self-hosted instances additionally need the ingestion endpoint reachable and the project API key correct, which is a class of failure hosted tools do not have.

  3. 3

    The identifier is the bridge

    The distinct_id, captured at the visit and carried into the Chargebee subscription.

  4. 4

    The event source decides reliability

    Fire on payment succeeded, not invoice generated, and key the conversion on the billing period so a dunning sequence with four retries produces one conversion rather than four.

  5. 5

    Deduplication at the destination

    PostHog deduplicates on the event UUID where supplied. Without one, a retried batch duplicates, and on a self-hosted instance there is no vendor support desk to notice it for you.

Chargebee → PostHog · normal or broken

Working vs. broken, side by side — Chargebee → PostHog

Normal, not a fault

  • The distinct_id present on the subscription

  • Sent from the Chargebee payment_succeeded webhook

  • Deduplicated correctly

    PostHog deduplicates on the event UUID where supplied. Without one, a retried batch duplicates, and on a self-hosted instance there is no vendor support desk to notice it for you.

  • Reconciles with the source

Actually broken

  • The distinct_id missing on most records

    The identifier must live on the customer or subscription so it survives a trial period that is longer than any browser cookie you can rely on. Chargebee's hosted checkout is also a different origin, so nothing crosses it by default.

  • Sent from the browser

    The gap between signup and first payment is where the identifier has to survive, and it is measured in weeks. Browser storage will not do it.

  • Counted twice, or not at all

    The advantage of owning the pipeline is that nothing blocks it. The cost is that when the ingestion instance fills its disk on a Saturday, the events are gone and nobody is paged. Hosted tools fail differently and more visibly.

  • Nobody has reconciled it

Chargebee → PostHog · diagnose

Diagnostic order — Chargebee → PostHog

  1. 01

    Count subscriptions carrying the distinct_id

  2. 02

    Follow one real conversion end to end

  3. 03

    Check whether the event fires on invoice or on payment

    Invoice-based firing counts money you have not received, and in a business with dunning that overstates consistently.

  4. 04

    Check ingestion health and disk before debugging any missing event

    On self-hosted instances the answer is infrastructure far more often than it is instrumentation.

  5. 05

    Read the match rate, not the success message

    PostHog shows events in the activity view within moments. On a self-hosted instance, check the ingestion lag as well — events that are queued are not events that are lost, and the two need different responses.

Chargebee → PostHog · prove

How it gets proven — Chargebee → PostHog

Source of truth

Chargebee's paid invoices by payment date, net of refunds and failed payments.

  • The distinct_id confirmed present on a live subscription.
  • Purchase events reconciled per transaction against your billing system, with ingestion lag checked over the same window.
  • A dunning sequence confirmed to produce one conversion rather than one per retry.

Chargebee → PostHog · free audit

What we check in the free audit

  • Count subscriptions carrying the distinct_id
  • Follow one real conversion end to end
  • Check whether the event fires on invoice or on payment
  • Check ingestion health and disk before debugging any missing event
  • Read the match rate, not the success message

Checked against

Chargebee's paid invoices by payment date, net of refunds and failed payments.

Get my free conversion tracking audit

Free30 minutesNo obligation

Chargebee → PostHog · when not to buy

When you don't need this — Chargebee → PostHog

  • Measure identifier coverage yourself first — pull your last hundred subscriptions and count how many carry the distinct_id.
  • If your trial is longer than 90 days, uploading the first payment against the original click cannot work — we will tell you that before quoting.
  • If you have no reason to keep the data on your own infrastructure and no team to run it, the hosted product removes the only real downside of this one.

Chargebee → PostHog · what we deliver

What gets built — Chargebee → PostHog

  • Identifier capture into Chargebee

    Write the click identifier to a custom field on the Chargebee customer or subscription when the subscription is created, server-side, rather than relying on the hosted checkout page to carry it.

  • Event source: the Chargebee payment_succeeded webhook

    Fire on payment succeeded, not invoice generated, and key the conversion on the billing period so a dunning sequence with four retries produces one conversion rather than four.

  • Dispatch to PostHog

    The PostHog capture API, posted server-side from your backend to your own instance or to PostHog Cloud.

  • Reversals where they exist

    Cancellations and refunds are exposed and should reverse the lifetime value claimed at acquisition.

Written guarantee

95%+ tracking accuracy

Measured against Chargebee's paid invoices by payment date, net of refunds and failed payments.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Chargebee → PostHog questions, answered

Send payment events with your own user ID as the distinct_id, the same one used in PostHog's identify call. Store that ID on the Chargebee customer.

Free · 30 min

Get Chargebee and PostHog joined properly

Free30 minutesNo obligation