Metrivo
Docs/Razorpay

Razorpay Integration Setup

Connect Razorpay to Metrivo using secure webhooks. Match Indian and international transactions to acquisition channels, keywords, and referral links to optimize your ad spend.

Read-Only & Secure

Metrivo does not capture payments or store Razorpay API credentials. It only listens to signed webhook events to map payment events back to user traffic sessions.

How the integration works

When a payment succeeds, Razorpay sends a webhook notification to Metrivo. The attribution engine processes this event, validates the signature using your configured webhook secret, and matches the purchase to a customer session.

For high-confidence session-level attribution, you must pass Metrivo tracking identifiers into the Razorpay order or checkout page under the `notes` parameter. If no metadata is present, Metrivo falls back to matching by the customer's email address hash.

Setup steps

1

Generate your Metrivo Webhook URL

Navigate to Data Connections in the Metrivo dashboard, choose Razorpay, enter your integration details, and copy the generated Webhook URL. It will look like: https://metrivo.co/api/integrations/razorpay/webhook/<YOUR_INTEGRATION_ID>

2

Create a Webhook in Razorpay

Log into your Razorpay Dashboard, navigate to Settings → Webhooks, and click 'Add New Webhook'. Paste the Metrivo Webhook URL and enter a strong secret key.

3

Select Active Webhook Events

In the Razorpay webhook setup form, subscribe to the following events: payment.captured, order.paid, subscription.charged, and subscription.activated. Save the settings.

4

Save Webhook Secret in Metrivo

Return to the Metrivo dashboard, paste your Razorpay webhook secret key, and save. Metrivo encrypts the secret at rest and uses it to verify the signature of all inbound events.

5

Verify the Connection

Trigger a test payment in Razorpay. Metrivo will verify the webhook payload signature and mark your connection as Active.

Supported Webhook Events

payment.captured

Triggered when a customer payment is successfully captured. Metrivo parses the payment, registers the amount, and attempts session attribution.

order.paid

Triggered when all payments for a specific Razorpay Order are finalized. Ideal for shopping cart checkouts.

subscription.charged

Triggered on recurring billing cycles. Metrivo records subscription revenue and associates it with the original customer profile.

subscription.activated

Triggered when a subscription starts. Recorded to trace subscription growth cohorts.

Passing tracking IDs for high-confidence attribution

For high-confidence attribution, send the current Metrivo checkout metadata to your server and include it in the `notes` payload when creating a Razorpay Order:

// Client: send this object to your checkout endpoint const metadata = window.Metrivo.getAttributionMetadata(); // Server: initialize Razorpay Order with those notes razorpay.orders.create({ amount: 4900, // In paise (₹49.00) currency: "INR", notes: metadata, });

This attaches the session tokens directly to the order record. When checkout completes, Razorpay passes the `notes` back in the webhook payload so Metrivo can attempt a high-confidence match. Missing notes may fall back to email or remain unattributed.

Need more help?

Explore other guides or switch to a different payment gateway connection.