Attach the Grosslytics visitor ID (gl_vid) inside Razorpay Standard Checkout notes.visitor_id and point Razorpay’s payment.captured webhook at your Grosslytics endpoint. That links every captured INR or international payment back to the UTM campaign, blog post, or AI search answer that brought the buyer.
Key takeaways
- Pass
visitor_idin the Standard Checkoutnotesobject sopayload.payment.entity.notes.visitor_idreaches the webhook. - Subscribe to
payment.capturedin Razorpay Webhooks; Grosslytics ignores browser success callbacks and authorized-only events. - Set your Grosslytics site reporting currency to
INRwhen charging in rupees, because Grosslytics rejects mismatched currencies. - Neither DataFast nor DataBull natively supports Razorpay; see how Grosslytics compares in DataFast vs DataBull vs Grosslytics.
What do you need before connecting Razorpay?
You need a Grosslytics site configured in your charge currency, g.js running on your acquisition pages, and Razorpay Orders with Standard Checkout.
- Add your site through the Grosslytics setup flow.
- Select
INR(or your settlement currency) when creating the site. - Install
g.json your landing and pricing pages. - Keep your existing server order creation and signature verification route ready.
- Turn on Razorpay Test Mode and run one test payment before going live.
Step 1: How do you capture the visitor and campaign?
Install the tracker on your pages so g.js records UTM tags and stores gl_vid in localStorage before checkout starts.
<script defer src="https://grosslytics.com/g.js"
data-site-id="YOUR_SITE_ID"></script>
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
Send marketing traffic to a tracked URL rather than a direct hosted payment link:
https://your-site.example/pricing?utm_source=newsletter&utm_medium=email&utm_campaign=saas-launch
When the buyer clicks checkout, read localStorage.getItem('gl_vid'). If storage is blocked, open checkout without a visitor ID so the payment still goes through. See the tracker documentation for Content Security Policy rules and self-hosting.
Step 2: Where do you attach notes.visitor_id?
Include visitor_id in both your server-side razorpay.orders.create call and the client-side Razorpay Checkout notes option.
Grosslytics reads payload.payment.entity.notes.visitor_id from the captured payment webhook. Passing notes in the checkout options copies visitor_id onto the captured payment entity. Source: Razorpay Orders API and Standard Checkout steps.

On your server order-creation endpoint:
// Server only: body comes from your validated checkout request.
const visitorId = typeof body.visitorId === 'string'
&& /^[A-Za-z0-9_-]{1,200}$/.test(body.visitorId)
? body.visitorId : null;
const order = await razorpay.orders.create({
amount: 50000, // 500 INR in paise; select the price on the server.
currency: 'INR',
receipt: crypto.randomUUID(),
notes: visitorId ? { visitor_id: visitorId } : {}
});
Then pass visitorId from the browser into new Razorpay({ notes }):
// Browser: run after tracker and Razorpay Checkout have loaded.
let visitorId = null;
try { visitorId = localStorage.getItem('gl_vid'); } catch {}
const response = await fetch('/api/create-razorpay-order', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ visitorId })
});
if (!response.ok) throw new Error('Unable to create an order.');
const order = await response.json();
const checkout = new Razorpay({
key: 'YOUR_PUBLIC_RAZORPAY_KEY_ID',
order_id: order.id,
amount: order.amount,
currency: order.currency,
notes: visitorId ? { visitor_id: visitorId } : {},
handler: existingVerifiedPaymentHandler
});
checkout.open();
Check a test payment
After an INR test payment is captured, look for the same amount and visitor in Razorpay and the Grosslytics sale. Match the payment ID before using the channel total. Razorpay fees shown here are estimates.
Open the Razorpay webhook setup step. See the closed Stripe sandbox example for a worked example of comparing charges, refunds and fees.
Step 3: Which webhook event updates Grosslytics?
Configure Razorpay to send signed payment.captured webhooks to your Grosslytics Razorpay endpoint and store the webhook secret in Payments settings.
https://YOUR_ANALYTICS_DOMAIN/api/webhooks/razorpay?siteId=YOUR_SITE_ID
Grosslytics verifies the X-Razorpay-Signature HMAC against the raw request body using your configured secret and deduplicates repeated deliveries by payment ID. Source: Razorpay payment webhook events and webhook validation.
| Payment flow | How visitor_id reaches Grosslytics |
Current support and limits |
|---|---|---|
| Orders + Standard Checkout | notes.visitor_id on payment entity |
Supported via payment.captured |
| Razorpay Payment Links | Pass notes.visitor_id via API |
No automatic link tagging in g.js |
| Subscriptions | Pass notes.visitor_id per charge |
Counts as a new sale (no separate renewal flag yet) |
See the payment integration reference for endpoint configuration.
How does Grosslytics handle Razorpay fees and currencies?
Grosslytics requires the Razorpay charge currency to match your site’s reporting currency and deducts a 2.0% domestic fee estimate.
For an illustrative INR 500 payment (50,000 paise), Grosslytics records INR 10 in estimated fees and INR 490 in net revenue:
payment = 50000 paise
estimated_fee = round(50000 * 200 / 10000) = 1000 paise
net_after_estimated_fee = 50000 - 1000 = 49000 paise
Razorpay’s 18% GST on fees and international card surcharges vary by payment method, so treat the 2.0% rate as an estimate and check final payouts in Razorpay settlements. Compare gateway rates with the payment fee calculator. Grosslytics does not deduct Razorpay refunds yet, and sending an INR charge to a USD site returns HTTP 422.
Pre-launch validation steps
Complete one Razorpay Test Mode purchase from a tagged visit before relying on production numbers:
- Visit your pricing page with
?utm_source=test&utm_medium=cpcin an ordinary browser. - Confirm
g.jsfires/api/eventand gets202 Accepted. - Complete a test Standard Checkout payment and inspect the
payment.capturedwebhook payload fornotes.visitor_id. - Confirm the sale credits
testin Grosslytics with the expected INR amount. - Replay the webhook in Razorpay and confirm Grosslytics deduplicates the payment ID.
Compare attribution views in the dashboard definitions, or compare Grosslytics against other tools that handle Indian and global payment stacks in 5 Best DataBull Alternatives.
Frequently asked questions
Does g.js tag Razorpay Payment Links automatically?
No. Unlike Stripe Payment Links and Polar links, g.js does not rewrite rzp.io links. Pass notes.visitor_id through your own checkout order or Payment Link API integration.
Does Grosslytics convert INR to USD automatically?
No. Each site reports in a single currency (USD, EUR, GBP, or INR) so exchange-rate swings never distort revenue trends. Set the site currency to INR for Razorpay INR checkouts.
Does Grosslytics separate Razorpay renewals from new sales?
Not yet. Grosslytics records captured subscription charges as sales attributed to the matching visitor; separate renewal classification (new vs renewal) currently covers Stripe, Paddle, Polar, Lemon Squeezy, and RevenueCat.
Does Grosslytics deduct Razorpay refunds?
Not yet. Grosslytics deducts partial and full Stripe refunds plus full refunds on Paddle, Dodo Payments, and Gumroad; reconcile Razorpay refunds in your Razorpay Dashboard.