Skip to main content
Braintree → PostHogIntegration guide

Connecting Braintree to PostHog

Braintree is a payment gateway rather than a storefront, so it sits underneath whatever is taking the order and holds the transaction itself. 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 Braintree transaction 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

Braintree payments in PostHog: tie revenue to the product user

Send the PostHog distinct_id with the payment method nonce, store it in a Braintree custom field, and capture purchase or subscription events server-side on settlement, using the Braintree transaction ID as the event UUID. Add renewal, failed-charge and cancellation events from subscription webhooks for paying-user retention cohorts. Keep card brand, last four and billing address out.

PostHog is where a product team learns which usage precedes paying, and Braintree has the payment but not the user. The join is distinct_id: send it from the browser or app with the payment method nonce, store it in a Braintree custom field, and capture a purchase or subscription event server-side when the transaction settles. Use the Braintree transaction ID as the event UUID so a webhook delivered twice does not produce two payments.

Server-side capture also fixes what client-side tracking gets wrong on this pair. A purchase captured on the success screen fires before settlement, includes payments that are later declined or voided, and misses PayPal payers who close the tab. The settlement webhook can lag by hours, which is fine for funnels and retention because PostHog is not feeding a bidding algorithm here.

Recurring billing makes the pair more useful: send renewal, failed-charge and cancellation events from Braintree's subscription webhooks, and you can build retention cohorts on paying users rather than active users, and see which features churned customers stopped using before the cancellation. Keep amount and plan as event properties, and leave card brand, last four digits and billing address out of person properties; no product question needs them.

Braintree → PostHog · what breaks

Why this join usually fails — Braintree → PostHog

  1. 01

    The distinct_id never reaches Braintree

    Braintree is a gateway, so it sees the payment and not the marketing. The identifier has to be attached at the point your application creates the transaction, through custom fields, or it never enters Braintree at all.

  2. 02

    A gateway that knows nothing about marketing

    Braintree sees a payment. Whether it can be tied to a click depends entirely on whether your own application attached the identifier when creating the transaction, and most do not.

  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.

Braintree → PostHog · the fix

What working looks like — Braintree → PostHog

  • The distinct_id on every transaction

  • Conversions arriving in PostHog

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

  • Reconciled against the source

Braintree → PostHog · architecture

How Braintree and PostHog actually connect

  1. 1

    Braintree holds the truth

    Settled and authorised are different states. Authorisation reserves the funds; settlement is money moving, and reporting on the wrong one produces a persistent gap against your bank.

  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 Braintree transaction.

  4. 4

    The event source decides reliability

    Fire on settlement rather than authorisation, and note that Braintree's PayPal and wallet flows redirect the buyer away — so the confirmation page is not a reliable trigger.

  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.

Braintree → PostHog · normal or broken

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

Normal, not a fault

  • The distinct_id present on the transaction

  • Sent from the Braintree transaction settlement 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

    Braintree is a gateway, so it sees the payment and not the marketing. The identifier has to be attached at the point your application creates the transaction, through custom fields, or it never enters Braintree at all.

  • Sent from the browser

    Braintree sees a payment. Whether it can be tied to a click depends entirely on whether your own application attached the identifier when creating the transaction, and most do not.

  • 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

Braintree → PostHog · diagnose

Diagnostic order — Braintree → PostHog

  1. 01

    Count transactions carrying the distinct_id

  2. 02

    Follow one real conversion end to end

  3. 03

    Open a settled transaction and check its custom fields

    If the identifier is not there, your application never attached it and nothing downstream can recover it.

  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.

Braintree → PostHog · prove

How it gets proven — Braintree → PostHog

Source of truth

Braintree's transaction records, filtered to settled, for the same window.

  • The distinct_id confirmed present on a live transaction.
  • Purchase events reconciled per transaction against your billing system, with ingestion lag checked over the same window.
  • A PayPal-funded transaction confirmed to report even though the buyer was redirected away.

Braintree → PostHog · free audit

What we check in the free audit

  • Count transactions carrying the distinct_id
  • Follow one real conversion end to end
  • Open a settled transaction and check its custom fields
  • Check ingestion health and disk before debugging any missing event
  • Read the match rate, not the success message

Checked against

Braintree's transaction records, filtered to settled, for the same window.

Get my free conversion tracking audit

Free30 minutesNo obligation

Braintree → PostHog · when not to buy

When you don't need this — Braintree → PostHog

  • Measure identifier coverage yourself first — pull your last hundred transactions and count how many carry the distinct_id.
  • If your platform already reports orders accurately and Braintree is purely the funding rail, work at the order layer instead — it is closer to the customer.
  • 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.

Braintree → PostHog · what we deliver

What gets built — Braintree → PostHog

  • Identifier capture into Braintree

    Pass the click identifier into the transaction's custom fields when your server creates the charge. Braintree preserves them and they survive to the webhook and to any later refund.

  • Event source: the Braintree transaction settlement webhook

    Fire on settlement rather than authorisation, and note that Braintree's PayPal and wallet flows redirect the buyer away — so the confirmation page is not a reliable trigger.

  • 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

    Braintree exposes refunds and disputes, both carrying the original custom fields, so reversals are straightforward.

Written guarantee

95%+ tracking accuracy

Measured against Braintree's transaction records, filtered to settled, for the same window.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Braintree → PostHog questions, answered

Store the user's distinct_id on the Braintree transaction and capture the event server-side on settlement through PostHog's capture API, with the transaction ID as the event UUID.

Free · 30 min

Get Braintree and PostHog joined properly

Free30 minutesNo obligation