# Razorpay

> Connect Razorpay so captured payments, subscription charges and processed refunds appear in rupees against their source.

Section: Revenue attribution  
Canonical page: https://statsy.co/docs/revenue/razorpay  
Last updated: 2026-09-15

Razorpay is the usual choice for businesses billing in India. It reports captured payments, subscription charges and refunds to Statsy over a signed webhook.

## Connect Razorpay

1. Copy the webhook URLIn Statsy, open **Site settings › Integrations** and press **Connect** on the Razorpay tile. The dialog shows the URL for your site, ending in `/api/hooks/razorpay/` and your `ws_` site key, with a copy button.
2. Add it as a webhook in RazorpayPaste the URL into a new webhook endpoint in Razorpay and subscribe it to the events listed below.
3. Paste the signing secret backRazorpay asks you to choose a secret when you create the webhook in the dashboard. Paste it into the second field in the dialog and press **Save and connect**. It is stored encrypted and never shown again, so keep your own copy.

## Which events to subscribe to

| Event | What Statsy does with it |
| --- | --- |
| `payment.captured` | Records the payment. Authorised-but-not-captured payments are deliberately not counted. |
| `subscription.charged` | Records a renewal. |
| `refund.processed` | Records a refund. |
| `subscription.cancelled` | Marks the customer as churned. Note the British spelling, with two *l*s. |

## Passing the visitor through

Razorpay carries a `notes` object on payments and subscriptions. The script adds `notes[statsy_vid]` to `rzp.io` payment links when a visitor clicks one.

If you open Razorpay Checkout with its JavaScript widget, put the id in the notes yourself:

```js
const vid = statsy.visitorId();

new Razorpay({
  key: 'rzp_live_xxx',
  order_id: orderId,
  notes: vid ? { statsy_vid: vid } : {},
}).open();
```

Subscription charges look for the note on the payment first and then on the subscription, so setting it on the subscription keeps renewals credited to the original source.

## Rupees and reporting

Razorpay reports in paise, and Statsy stores the amount in rupees with INR as the currency, alongside a converted USD figure. If your reporting currency is INR, the dashboard reads in rupees throughout; the attribution report always totals in USD so mixed currencies add up.

## How the webhook is verified

Razorpay signs the body with your chosen secret and sends the result in the `X-Razorpay-Signature` header. There is no timestamp, so the secret is all that stands between your dashboard and a forged payment. Rotate it if it ever leaks, and update it in Statsy at the same time.

Previous: [Polar](https://statsy.co/docs/revenue/polar)  
Next: [Payment API](https://statsy.co/docs/revenue/payment-api)