Skip to main content
Razorpay → SegmentIntegration guide

Connecting Razorpay to Segment

Razorpay is Indian payments, where UPI dominates and the flow moves through a separate app on the customer's phone. Segment is a customer data platform rather than an ad network, so sending to it is not about matching a conversion — it is about putting one clean event where every other destination can read it. The join between them succeeds or fails on one thing: whether the userId and anonymousId reaches the Razorpay payment before the conversion happens, because Segment can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

Razorpay into Segment: Order Completed from captured, not the browser

Send Segment's Order Completed from Razorpay's payment.captured, with the anonymousId and userId stored in the order notes, the Razorpay order ID as order_id, rupee revenue in INR, and messageId built from the payment ID. Keep only one browser or server copy, send Order Refunded from the refund webhook, and write consent state into the notes.

For Razorpay, the browser-side Order Completed from analytics.js is the event most likely to be missing, because UPI app switching means the confirmation page frequently never loads. Move it server-side: put the Segment anonymousId and userId in the Razorpay order notes at creation, and send Order Completed from payment.captured with those IDs, the Razorpay order ID as order_id, revenue in rupees and currency INR.

Build the messageId from the payment ID so a Razorpay webhook retry does not fan a duplicate purchase out to every destination. If the site also fires a browser Order Completed when the confirmation page does load, keep only one of them; unless both share a messageId, Segment treats them as two orders and Meta, Google and the warehouse all receive both. Refunds go out as Order Refunded with the same order_id, sent from the refund webhook.

The webhook knows nothing about cookie consent. Write the visitor's consent state into the notes alongside the IDs, so the server event can be filtered away from ad destinations when the person declined. If you serve customers in India, check how the Digital Personal Data Protection Act's rules apply to that consent setup.

Razorpay → Segment · what breaks

Why this join usually fails — Razorpay → Segment

  1. 01

    The userId and anonymousId 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

    One bad event multiplied across every destination

    Segment's value is fan-out, which is also its risk. An inconsistent identity or a duplicated event does not break one report — it breaks every connected tool simultaneously, and tracing it back is harder than debugging a direct integration.

  4. 04

    Nothing reconciles afterwards

    Segment's debugger shows events arriving and which destinations accepted them. Arriving is not the test — check a destination you care about and confirm the event landed there with the identity intact, then reconcile against your own records.

Razorpay → Segment · the fix

What working looks like — Razorpay → Segment

  • The userId and anonymousId on every payment

  • Conversions arriving in Segment

    Events land in Segment and forward to every connected destination, warehouse included, on one shared definition.

  • Reconciled against the source

Razorpay → Segment · architecture

How Razorpay and Segment 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

    Segment needs a click to match

    Segment needs a consistent identity model — the same userId everywhere, an alias when an anonymous visitor becomes known, and event names that follow one spec. Feeding it inconsistent identities pushes the mess to every connected destination at once.

  3. 3

    The identifier is the bridge

    The userId and anonymousId, 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

    Segment deduplicates on messageId within a window. Because it fans out to many destinations, a duplicate here becomes a duplicate everywhere, which makes idempotent messageIds more important than in any single-destination integration.

Razorpay → Segment · normal or broken

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

Normal, not a fault

  • The userId and anonymousId present on the payment

  • Sent from the Razorpay payment.captured webhook

  • Deduplicated correctly

    Segment deduplicates on messageId within a window. Because it fans out to many destinations, a duplicate here becomes a duplicate everywhere, which makes idempotent messageIds more important than in any single-destination integration.

  • Reconciles with the source

Actually broken

  • The userId and anonymousId 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

    Segment's value is fan-out, which is also its risk. An inconsistent identity or a duplicated event does not break one report — it breaks every connected tool simultaneously, and tracing it back is harder than debugging a direct integration.

  • Nobody has reconciled it

Razorpay → Segment · diagnose

Diagnostic order — Razorpay → Segment

  1. 01

    Count payments carrying the userId and anonymousId

  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 identity resolution before checking anything downstream

    If anonymousId is never aliased to userId, every destination sees two people where there is one, and no downstream fix helps.

  5. 05

    Read the match rate, not the success message

    Segment's debugger shows events arriving and which destinations accepted them. Arriving is not the test — check a destination you care about and confirm the event landed there with the identity intact, then reconcile against your own records.

Razorpay → Segment · prove

How it gets proven — Razorpay → Segment

Source of truth

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

  • The userId and anonymousId confirmed present on a live payment.
  • An anonymous session confirmed aliased to a known user, with the event visible in at least one downstream destination.
  • A UPI payment approved in the banking app without returning to the site, confirmed to report.

Razorpay → Segment · free audit

What we check in the free audit

  • Count payments carrying the userId and anonymousId
  • Follow one real conversion end to end
  • Compare captured payments against confirmation-page loads on mobile
  • Check identity resolution before checking anything downstream
  • 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 → Segment · when not to buy

When you don't need this — Razorpay → Segment

  • Measure identifier coverage yourself first — pull your last hundred payments and count how many carry the userId and anonymousId.
  • If your Razorpay volume is card-only, the app-switch problem largely disappears.
  • If you send to one or two destinations, Segment is infrastructure you do not need — direct integrations are simpler and cheaper. It earns its place at genuine fan-out.

Razorpay → Segment · what we deliver

What gets built — Razorpay → Segment

  • 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 Segment

    Server-side track and identify calls with a stable messageId, consistent userId, and the click identifier carried as a trait or property.

  • 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 → Segment questions, answered

Store anonymousId and userId in the order notes, then send Order Completed from the payment.captured webhook through a source function or your server.

Free · 30 min

Get Razorpay and Segment joined properly

Free30 minutesNo obligation