> ## Documentation Index
> Fetch the complete documentation index at: https://docs.partnero.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrate Razorpay

This guide will walk you through the steps to integrate Partnero with Razorpay payments to track referral visits, capture sign-ups, and monitor sales.

These instructions can also be found on your Partnero account, under  **Integration** > **Guides** tab > **Razorpay**:<img src="https://mintcdn.com/partnero/TD1h4eRbwmmE0XYt/images/articles/integrate-razorpay/2242d200.webp?fit=max&auto=format&n=TD1h4eRbwmmE0XYt&q=85&s=5d479a41cff0655c50ef2e7a7f2e835c" alt="" width="2878" height="1502" data-path="images/articles/integrate-razorpay/2242d200.webp" />

***

### Step 1: Start tracking website visitors

To track visitors on your website, you need to install the PartneroJS snippet as custom code.

#### Install the PartneroJS Snippet

1. Open the program you'd like to integrate and go to **Integration** > **Guides** tab > **Razorpay**. Click **Instructions**.
2. Copy the PartneroJS snippet:<img src="https://mintcdn.com/partnero/TD1h4eRbwmmE0XYt/images/articles/integrate-razorpay/6d7be41b.webp?fit=max&auto=format&n=TD1h4eRbwmmE0XYt&q=85&s=5958bc6c14c6353b8ef1f134fd651461" alt="" width="2874" height="1492" data-path="images/articles/integrate-razorpay/6d7be41b.webp" />
3. Add the PartneroJS snippet to your website's header section. This should be done before any Razorpay payment buttons or forms:
   * Place it in the `<head>` section of your HTML pages
   * Ensure it loads before any Razorpay checkout scripts
   * Include it on all pages where users might land from referral links

***

### Step 2: Track customer signups

If your site has user registration before payment, you can track customer signups using the signup tracking snippet. Copy the snippet from the integration guide:<img src="https://mintcdn.com/partnero/TD1h4eRbwmmE0XYt/images/articles/integrate-razorpay/3242b521.webp?fit=max&auto=format&n=TD1h4eRbwmmE0XYt&q=85&s=767e04f09d17c43762bb2e13ee1a720d" alt="" width="2878" height="1500" data-path="images/articles/integrate-razorpay/3242b521.webp" />

Paste the script to your website after successful user registration or account creation.

***

### Step 3: Track customer payments

You can successful Razorpay payments by modifying your payment success handler. There are integration methods for different Razorpay implementations.

#### Method 1: JavaScript Integration (Client-side)

If you're using Razorpay's JavaScript checkout, modify your payment success handler using the provided code snippet:

<img src="https://mintcdn.com/partnero/TD1h4eRbwmmE0XYt/images/articles/integrate-razorpay/afb5d01f.webp?fit=max&auto=format&n=TD1h4eRbwmmE0XYt&q=85&s=d1e374b39420b1686d4ef293cb38c33b" alt="" width="2878" height="1500" data-path="images/articles/integrate-razorpay/afb5d01f.webp" />

Make sure to replace placeholder values with actual customer data from your forms or user accounts.

#### Method 2: Server-side Webhooks

Alternatively, you can set up Razorpay webhooks to send payment data to your server:

1. Log in to your Razorpay Dashboard
2. Go to **Settings** → **Webhooks**
3. Add a new webhook with URL: `https://yoursite.com/webhook/razorpay`
4. Subscribe to *payment.captured* events.

Use the sample PHP webhook handler to adapt it to your backend technology:<img src="https://mintcdn.com/partnero/TD1h4eRbwmmE0XYt/images/articles/integrate-razorpay/1cac0f90.webp?fit=max&auto=format&n=TD1h4eRbwmmE0XYt&q=85&s=9b8e7e8f1b3bc884b48bd064285b7f47" alt="" width="2878" height="1496" data-path="images/articles/integrate-razorpay/1cac0f90.webp" />

***

### Step 3: Pass partner data to Razorpay

To ensure partner attribution works with webhooks, pass the partner key through Razorpay's notes field:<img src="https://mintcdn.com/partnero/TD1h4eRbwmmE0XYt/images/articles/integrate-razorpay/a1726bfa.webp?fit=max&auto=format&n=TD1h4eRbwmmE0XYt&q=85&s=1bc0d3622b6672160c1d9f8621be5a0a" alt="" width="2878" height="1498" data-path="images/articles/integrate-razorpay/a1726bfa.webp" />

***

### Step 4: Track subscription payments

For recurring subscription payments with Razorpay Subscriptions, track both initial and recurring payments:

<img src="https://mintcdn.com/partnero/TD1h4eRbwmmE0XYt/images/articles/integrate-razorpay/f1d243b4.webp?fit=max&auto=format&n=TD1h4eRbwmmE0XYt&q=85&s=9af03674d6f5b17e39fadc6a39fe1cbd" alt="" width="2872" height="1496" data-path="images/articles/integrate-razorpay/f1d243b4.webp" />

***

### Razorpay-specific best practices

* **Currency handling**: Remember Razorpay amounts are in paise (INR) - divide by 100 for Partnero
* **Webhook security**: Always verify webhook signatures to prevent fraud
* **Error handling**: Implement retry logic for failed API calls to Partnero
* **Customer data**: Use Razorpay's notes field to pass additional customer information
* **Multi-currency**: Handle different currencies if you accept international payments
* **Refunds**: Consider tracking refunds as negative transactions in Partnero

***

### Common integration issues

* **Missing partner attribution**: Ensure the partner key is passed through Razorpay notes
* **Amount mismatch**: Convert paise to rupees when sending to Partnero
* **Webhook failures**: Check your server logs and Razorpay webhook logs
* **Cookie expiration**: Consider extending cookie lifetime for longer purchase journeys

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.