Skip to main content
Stripe → PostHogIntegration guide

Connecting Stripe to PostHog

Stripe knows exactly what was paid, by whom, and when — down to the cent, including the refund three weeks later. 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 Stripe Customer or PaymentIntent 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

Stripe payments in PostHog on the same distinct_id

Call identify before checkout, put the PostHog distinct_id into Stripe Checkout Session metadata, and capture a purchase from the webhook with that distinct_id, amount converted from cents, currency and the PaymentIntent ID for deduplication. PostHog's warehouse can import Stripe for revenue totals, but funnels still need the captured event. Self-hosted, queue and retry webhooks.

PostHog is useful here when a Stripe payment sits at the end of the product behaviour that led to it, which means the payment event must carry the same distinct_id as the browser session. Call identify before checkout, put the distinct_id into the Checkout Session metadata, and capture a purchase from the webhook with that distinct_id, the amount converted from cents, the currency, and the PaymentIntent ID as a property you deduplicate on.

PostHog's data warehouse can also import Stripe as a source, giving you charges, customers and refunds for revenue reporting without webhook code. The tradeoff: imported tables sync on a schedule and join to persons only through a key you map, usually email, so funnels ending in a paid step still need the webhook event on the distinct_id. Many teams run both: the warehouse for revenue totals, the captured event for funnels and retention by acquisition source.

If you self-host, do not let the webhook handler fail when your instance is slow; queue and retry, or Stripe's retries layered on yours produce duplicates. If you only need revenue by plan and never by user journey, the Stripe dashboard already answers that and this integration adds little.

Stripe → PostHog · what breaks

Why this join usually fails — Stripe → PostHog

  1. 01

    The distinct_id never reaches Stripe

    Stripe Checkout runs on checkout.stripe.com, a different origin from your site, so nothing you set in a first-party cookie travels with the customer. The identifier has to be put into PaymentIntent metadata (or the Checkout Session's metadata) at the moment you create the session, server-side. If you create sessions from a price link or a Buy Button, there is no server step and no metadata — that setup cannot be joined to advertising at all without changing how sessions are created.

  2. 02

    Checkout is on Stripe's domain, so the browser loses the thread

    The customer leaves your site, pays somewhere else, and comes back to a thank-you page. Anything relying on browser continuity across that hop is unreliable, and on Safari it is worse than unreliable.

  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.

Stripe → PostHog · the fix

What working looks like — Stripe → PostHog

  • The distinct_id on every payment

  • Conversions arriving in PostHog

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

  • Reconciled against the source

Stripe → PostHog · architecture

How Stripe and PostHog actually connect

  1. 1

    Stripe holds the truth

    Every succeeded PaymentIntent is a real conversion with a real amount and currency. No sampling, no modeling, no consent gate. This is the number the business actually banked, which is why it is the reference rather than anything either ad platform reports.

  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 Stripe Customer or PaymentIntent.

  4. 4

    The event source decides reliability

    Subscribe to payment_intent.succeeded (or checkout.session.completed) and send from your server when Stripe fires it. Reading a payment from the thank-you page instead means every customer who closes the tab on the redirect is a conversion you never counted, and Stripe redirects after taking money, not before.

  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.

Stripe → PostHog · normal or broken

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

Normal, not a fault

  • The distinct_id present on the payment

  • Sent from the Stripe 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

    Stripe Checkout runs on checkout.stripe.com, a different origin from your site, so nothing you set in a first-party cookie travels with the customer. The identifier has to be put into PaymentIntent metadata (or the Checkout Session's metadata) at the moment you create the session, server-side. If you create sessions from a price link or a Buy Button, there is no server step and no metadata — that setup cannot be joined to advertising at all without changing how sessions are created.

  • Sent from the browser

    The customer leaves your site, pays somewhere else, and comes back to a thank-you page. Anything relying on browser continuity across that hop is unreliable, and on Safari it is worse than unreliable.

  • 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

Stripe → PostHog · diagnose

Diagnostic order — Stripe → PostHog

  1. 01

    Count payments carrying the distinct_id

  2. 02

    Follow one real conversion end to end

  3. 03

    Open one succeeded PaymentIntent in the Stripe dashboard

    Look at its Metadata section. If the identifier is not there, nothing downstream can fix it — the join is broken at the source and every other check is wasted effort.

  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.

Stripe → PostHog · prove

How it gets proven — Stripe → PostHog

Source of truth

The Stripe dashboard — Payments, filtered to succeeded, for the same window.

  • The distinct_id confirmed present on a live payment.
  • Purchase events reconciled per transaction against your billing system, with ingestion lag checked over the same window.
  • A refunded payment confirmed to reverse, not just the sale confirmed to send.

Stripe → PostHog · free audit

What we check in the free audit

  • Count payments carrying the distinct_id
  • Follow one real conversion end to end
  • Open one succeeded PaymentIntent in the Stripe dashboard
  • Check ingestion health and disk before debugging any missing event
  • Read the match rate, not the success message

Checked against

The Stripe dashboard — Payments, filtered to succeeded, for the same window.

Get my free conversion tracking audit

Free30 minutesNo obligation

Stripe → PostHog · when not to buy

When you don't need this — Stripe → PostHog

  • Measure identifier coverage yourself first — pull your last hundred payments and count how many carry the distinct_id.
  • If you take payment through a hosted Payment Link or Buy Button and have no server creating sessions, this needs a development change on your side before any tracking work is worth commissioning. Worth knowing before you pay for tracking.
  • 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.

Stripe → PostHog · what we deliver

What gets built — Stripe → PostHog

  • Identifier capture into Stripe

    Read the click identifier from the landing page, persist it in a first-party cookie, and pass it into the create-session call as metadata. Stripe carries metadata onto the resulting PaymentIntent and Charge, so it survives to the webhook and to any later refund.

  • Event source: the Stripe webhook

    Subscribe to payment_intent.succeeded (or checkout.session.completed) and send from your server when Stripe fires it. Reading a payment from the thank-you page instead means every customer who closes the tab on the redirect is a conversion you never counted, and Stripe redirects after taking money, not before.

  • 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

    Stripe fires charge.refunded and charge.dispute.created. Both carry the original metadata, so a refund can be sent as a negative or a retraction wherever the destination supports it. Most setups never wire this and quietly overstate revenue by the refund rate.

Written guarantee

95%+ tracking accuracy

Measured against The Stripe dashboard — Payments, filtered to succeeded, for the same window.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Stripe → PostHog questions, answered

Store the PostHog distinct_id in Checkout Session metadata, then capture the purchase from the Stripe webhook under that distinct_id.

Free · 30 min

Get Stripe and PostHog joined properly

Free30 minutesNo obligation