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

# Connect your app to Razorpay

> Connect your app to Razorpay, an Indian payments provider, to take UPI, card, netbanking, and wallet payments in your Lovable app.

[Razorpay](https://razorpay.com/) is an Indian payments provider that supports UPI (Unified Payments Interface), cards, netbanking, and wallets. The Razorpay connector lets your Lovable app create orders in your own Razorpay account, take payment with Razorpay Checkout, and confirm each payment with Razorpay. It's designed for apps whose owners sell in India and take payments with Razorpay.

Razorpay is available as an [app + chat connector](https://docs.lovable.dev/integrations/app-connectors.md): one shared connection that works in [Chats](https://docs.lovable.dev/features/chats.md), in the project chat while you build, and in your published apps.

With Razorpay, your app can:

* Take one-off payments with Razorpay Checkout, using the payment methods enabled on your Razorpay account
* Mark an order as paid only after Razorpay confirms the full amount
* Send customers a payment link instead of a checkout page
* Refund a payment in full or in part
* Charge customers every week, month, or year with Razorpay Subscriptions, including a free trial before the first charge
* List recent payments and their status

If you don't have a Razorpay account, [Lovable payments](https://docs.lovable.dev/features/payments.md) can set up Stripe or Paddle for you instead. Built-in payments require the Pro plan or higher. When you ask Lovable to add payments without naming a provider, it recommends those built-in payments.

## Common use cases and example apps

These examples show what you can build with Razorpay, each with a prompt to start from.

| Example app | Example prompt | Description |
| :- | :- | :- |
| **Webshop checkout** | *Use Razorpay and build a checkout for my clothing store so customers can pay for their cart with UPI or a card.* | **Take payment for a cart in one step.** The app creates a Razorpay order for the cart total, opens Razorpay Checkout, and marks the order paid when Razorpay confirms the payment. |
| **Coaching membership** | *Use Razorpay and build a monthly membership for my fitness coaching site with a 7-day free trial.* | **Charge members every month.** The app subscribes each member to a Razorpay plan and gives access while the subscription is active. |
| **Event tickets** | *Use Razorpay and build a ticket page for our college fest where students buy passes and get a confirmation.* | **Sell tickets with UPI.** The app confirms each booking only after Razorpay reports the payment for the full ticket price. |
| **Invoice payments** | *Use Razorpay and build a page where I enter a client and an amount and send them a payment link.* | **Get paid without a checkout page.** The app creates a Razorpay payment link for the amount and marks the invoice paid when Razorpay reports the link as paid. |
| **Course purchase** | *Use Razorpay and build a page where students buy my online course in rupees and get access after paying.* | **Unlock content after payment.** The app creates a Razorpay order for the course and grants access when Razorpay confirms the payment. |
| **Payments admin** | *Use Razorpay and build an admin page that lists this week's payments and lets me refund an order.* | **Review and refund payments in one place.** The app reads payments from your Razorpay account and issues full or partial refunds. |

## How to connect Razorpay

Who can create Razorpay connections depends on your plan and workspace settings. App + chat connectors are available by default. On Business and Enterprise plans, [Who can create connections and clients](https://docs.lovable.dev/integrations/admin-controls.md#who-can-create-connections-and-clients) starts at **Admins**. Some Enterprise workspaces start at **No one**, which disables the connector. An admin or owner changes it in **Connectors → Admin settings → App + chat connectors**.

You can create multiple Razorpay connections using different key pairs, which is useful for keeping a test connection next to a live one or for connecting different Razorpay accounts.

When the connection is created, you can [link it to the projects](https://docs.lovable.dev/integrations/app-connectors.md#link-a-connection-to-a-project) where you want to use it. Anyone building in a project can ask Lovable in the project chat to link their project to it. Linking follows the connection's access rules.

When you're ready to take real payments, [unlink the test connection](https://docs.lovable.dev/integrations/app-connectors.md#unlink-projects-from-a-connection) from the project and link the live one. Your app uses one Razorpay connection, so linking a second one does not switch it.

### Prerequisites

Before connecting Razorpay, make sure you have:

* A Razorpay account. Test mode is available as soon as you sign up. Live mode is available after Razorpay activates your account, which includes a review of your website.
* A Razorpay key ID and key secret, generated in the mode you want to connect
* For recurring payments, Razorpay Subscriptions set up on your account, as described in Razorpay's [Subscriptions](https://razorpay.com/docs/payments/subscriptions/) documentation
* Permission to **create connections** in your Lovable workspace (see [Who can create connections and clients](https://docs.lovable.dev/integrations/admin-controls.md#who-can-create-connections-and-clients))

> [!NOTE]
>
> Payments made through this connector go to your Razorpay account. Razorpay charges its transaction fees directly, and billing is handled by Razorpay, not Lovable.

### Step 1: Get your Razorpay API keys

A Razorpay key pair, a key ID and its key secret, lets your Lovable app create and read payments in your Razorpay account. Test mode and live mode each have their own key pair. A test key ID starts with `rzp_test_` and moves no real money. A live key ID starts with `rzp_live_`.

Only Owner and Admin users in your Razorpay account can generate API keys.

To generate a Razorpay key pair:

**1. Open your Razorpay Dashboard**

Sign in to the [Razorpay Dashboard](https://dashboard.razorpay.com/) and switch it to test mode or live mode.

**2. Open API keys**

Go to [Account & Settings → API Keys](https://dashboard.razorpay.com/app/website-app-settings/api-keys).

**3. Generate a key**

Click **Generate Key**.

**4. Copy the key ID and key secret**

Copy both values and store them securely. Razorpay shows the key secret only once. If you lose it, generate a new key.

> [!WARNING]
>
> Your key secret functions like a password. Keep it secure and never share it publicly. You'll need it in the next step.

See Razorpay documentation for more: [API keys](https://razorpay.com/docs/payments/dashboard/account-settings/api-keys/).

### Step 2: Connect Razorpay to Lovable

Use your test keys for the first connection, so you can try payments without moving real money.

**1. Open Razorpay in Connectors**

Open [Connectors](https://lovable.dev/dashboard?connectors) and select **Razorpay**. For the other places to open the catalog from, see [Where to find connectors](https://docs.lovable.dev/integrations/introduction#where-to-find-connectors).

**2. Add a connection**

Click **Connect** on the connector page. The form is split into collapsible sections, **Details**, **Configure connection**, and **Sharing**.

**3. Name the connection**

Under **Details**, Lovable fills in a name for the connection, which you can change. The name is only used inside Lovable to identify the connection, for example `Razorpay Test` or `Razorpay Live`.

**4. Configure the connection**

Under **Configure connection**, enter:

1. **Key ID**: paste your Razorpay key ID. It must start with `rzp_test_` or `rzp_live_`.
2. **Key secret**: paste the key secret generated with that key ID, in the same mode.

**Open API keys** next to each field opens the API keys page in the Razorpay Dashboard.

**5. Choose who can use this connection**

Under **Sharing**, the connection is private to you by default and shows a **Private** label. To share it, click **Share with others**. Then add workspace members by email, or click **Invite entire workspace** to make the connection available to everyone in your Lovable workspace.

See [Who can use connections and clients](https://docs.lovable.dev/integrations/admin-controls.md#who-can-use-connections-and-clients) for more information.

**6. Connect**

Click **Connect** at the bottom of the form. Lovable verifies the key pair against the Razorpay API before saving the connection.

When connected, anyone building in a project can ask Lovable in the project chat to link their project to Razorpay. Linking follows the connection's access rules. Your Lovable apps can then create orders, take payments, and confirm them through Razorpay.

## How payments are confirmed

Your app marks an order as paid only after it reads the order back from Razorpay and Razorpay reports the full amount as paid. Returning from Razorpay Checkout doesn't mean the customer has paid.

Razorpay reports payment events by calling a webhook, a public address in your app. Lovable builds the webhook with the checkout and gives you its address.

To connect Razorpay's events to your app:

**1. Get the webhook address**

Ask Lovable in the project chat for the Razorpay webhook address.

**2. Add the webhook in Razorpay**

In the Razorpay Dashboard, go to **Accounts & Settings → Webhooks** and click **+ Add New Webhook**. Paste the address as the URL, and under **Active Events**, select `payment.captured`, `payment.authorized`, and `order.paid`. Leave **Secret** empty, because your app confirms each event by reading the order from Razorpay. Click **Create Webhook**.

Test mode and live mode each need their own webhook. Add it with the Razorpay Dashboard in the mode your connection uses, and again in live mode when you switch to live keys.

To try a payment with test keys, pay with a test card or test netbanking from Razorpay's [test card details](https://razorpay.com/docs/payments/payments/test-card-details/). Test netbanking opens a demo bank page where you choose whether the payment succeeds or fails.

## Limitations

The Razorpay connector cannot:

* Add the webhook in Razorpay for you. You add it in the Razorpay Dashboard.
* Support marketplace payments where each seller connects their own Razorpay account. Each connection represents a single Razorpay account shared across all projects linked to it.

## Troubleshooting

Use these checks when connecting fails or a payment does not go through.

> [accordion] Razorpay did not validate your credentials.
>
> Razorpay rejected the key pair you submitted. Check that you copied the whole key ID and key secret, and that both come from the same key in the same mode. If you no longer have the key secret, generate a new key. Click **Show error** to see Razorpay's own response.

> [accordion] A UPI app cannot pay the QR code in Razorpay Checkout
>
> The connection uses test keys. A test-mode QR code cannot be paid with real money. Pay with a test card or test netbanking instead, or switch the project to a live connection.

## Manage your Razorpay connection

Connections are managed from [**Connectors**](https://lovable.dev/dashboard?connectors): select **Razorpay**, then open the connection.

* **Unlink projects** to remove Razorpay access from specific projects while keeping the connection available for others. See [Unlink projects from a connection](https://docs.lovable.dev/integrations/app-connectors.md#unlink-projects-from-a-connection) for the steps.
* **Delete the connection** to remove it from the workspace entirely. Deleting is permanent. It removes the credentials from all linked projects, and app features that use Razorpay stop working until a new connection is added. See [Delete a connection](https://docs.lovable.dev/integrations/app-connectors.md#delete-a-connection) for the steps and who can delete.
