Skip to main content
Razorpay → PostHogIntegration guide

Connecting Razorpay to PostHog

Razorpay is Indian payments, where UPI dominates and the flow moves through a separate app on the customer's phone. 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 Razorpay payment 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

Razorpay in PostHog funnels: real UPI drop-off versus lost tracking

PostHog's browser checkout funnel misses UPI buyers who never return, so send the completed step from the server. Put PostHog's distinct_id into the Razorpay order notes, capture payment_captured from the webhook with the Razorpay payment ID as event UUID, plus method, UPI flow and rupee amount, and capture payment.failed with Razorpay's error reason.

PostHog funnels for a Razorpay checkout usually show a steep drop between payment started and payment completed, and on mobile most of that drop is fake. The completed step is captured in the browser after Razorpay's success handler runs, and UPI buyers who approve in their banking app often never return to run it. Product decisions made on that funnel, such as redesigning a checkout that is actually converting, are the real cost here.

Send the completed step from the server. Put PostHog's distinct_id into the Razorpay order notes when your server creates the order, then capture a payment_captured event from the payment.captured webhook against that distinct_id, with the Razorpay payment ID as the event UUID so a webhook retry is not recorded twice. Add the payment method, UPI flow and amount in rupees as properties. The funnel then joins a browser start event to a server finish event for the same person, and the real UPI abandonment rate becomes visible.

Also capture payment.failed with Razorpay's error reason as a property; a funnel broken down by failure reason tells you whether customers abandon in the UPI app or are declined by their bank. If you self-host PostHog, the webhook handler needs to reach your ingestion endpoint and retry on failure.

Razorpay → PostHog · what breaks

Why this join usually fails — Razorpay → PostHog

  1. 01

    The distinct_id never reaches Razorpay

    UPI sends the customer into a banking app to approve, and on mobile that app switch frequently ends the browser session. The payment completes and the browser that started it may never come back to fire anything.

  2. 02

    UPI app switching ends the browser session

    The customer leaves the browser for a banking app to approve, and on many devices does not return. Payment succeeds, page never fires — and UPI is the majority method in this market.

  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.

Razorpay → PostHog · the fix

What working looks like — Razorpay → 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

Razorpay → PostHog · architecture

How Razorpay and PostHog actually connect

  1. 1

    Razorpay holds the truth

    Razorpay separates authorised and captured. Auto-capture is common but not universal, and reporting on authorised inflates the figure by whatever fails to capture.

  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 Razorpay payment.

  4. 4

    The event source decides reliability

    Fire on captured. The app-switch behaviour of UPI makes any browser-based trigger unreliable in a way that is much more pronounced here than on card markets.

  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.

Razorpay → PostHog · normal or broken

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

Normal, not a fault

  • The distinct_id present on the payment

  • Sent from the Razorpay payment.captured 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

    UPI sends the customer into a banking app to approve, and on mobile that app switch frequently ends the browser session. The payment completes and the browser that started it may never come back to fire anything.

  • Sent from the browser

    The customer leaves the browser for a banking app to approve, and on many devices does not return. Payment succeeds, page never fires — and UPI is the majority method in this market.

  • 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

Razorpay → PostHog · diagnose

Diagnostic order — Razorpay → PostHog

  1. 01

    Count payments carrying the distinct_id

  2. 02

    Follow one real conversion end to end

  3. 03

    Compare captured payments against confirmation-page loads on mobile

    Split by payment method. The UPI gap will be much larger than the card gap.

  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.

Razorpay → PostHog · prove

How it gets proven — Razorpay → PostHog

Source of truth

Razorpay's captured payments by date, net of refunds.

  • 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 UPI payment approved in the banking app without returning to the site, confirmed to report.

Razorpay → PostHog · free audit

What we check in the free audit

  • Count payments carrying the distinct_id
  • Follow one real conversion end to end
  • Compare captured payments against confirmation-page loads on mobile
  • Check ingestion health and disk before debugging any missing event
  • Read the match rate, not the success message

Checked against

Razorpay's captured payments by date, net of refunds.

Get my free conversion tracking audit

Free30 minutesNo obligation

Razorpay → PostHog · when not to buy

When you don't need this — Razorpay → PostHog

  • Measure identifier coverage yourself first — pull your last hundred payments and count how many carry the distinct_id.
  • If your Razorpay volume is card-only, the app-switch problem largely disappears.
  • 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.

Razorpay → PostHog · what we deliver

What gets built — Razorpay → PostHog

  • Identifier capture into Razorpay

    Pass the click identifier into the Razorpay order's notes when your server creates the order. Notes survive to the payment and to the webhook regardless of what the browser did.

  • Event source: the Razorpay payment.captured webhook

    Fire on captured. The app-switch behaviour of UPI makes any browser-based trigger unreliable in a way that is much more pronounced here than on card markets.

  • 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

    Refunds are exposed and carry the original notes.

Written guarantee

95%+ tracking accuracy

Measured against Razorpay's captured payments by date, net of refunds.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Razorpay → PostHog questions, answered

Many UPI buyers never return to the page that fires the completion event. Capture the completion from the payment.captured webhook with the distinct_id stored in the order notes.

Free · 30 min

Get Razorpay and PostHog joined properly

Free30 minutesNo obligation