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

# Razorpay Integration

> Accept payments in India with Razorpay

## What is Razorpay?

Razorpay is India's leading payment gateway. It supports UPI, cards, wallets, net banking, and 100+ payment methods popular in India.

**Perfect for:**

* E-commerce in India
* Accepting payments in INR
* UPI payments (PhonePe, Google Pay, etc.)
* Indian credit/debit cards
* Subscriptions and recurring billing

## What You'll Need

<Steps>
  <Step title="Razorpay Account">
    Sign up at [razorpay.com](https://razorpay.com)
  </Step>

  <Step title="Business Verification">
    Complete KYC (for live payments)
  </Step>

  <Step title="API Keys">
    Get your test keys to start
  </Step>

  <Step title="10 Minutes">
    Quick to get started!
  </Step>
</Steps>

<Tip>
  Here's a helpful video to get you started.
</Tip>

<iframe src="https://www.youtube.com/embed/rzpfZC5f5o4" title="YouTube video player" frameborder="0" className="w-full aspect-video rounded-xl" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen />

## Step 1: Get Your Razorpay Keys

### Create Account

1. Go to [razorpay.com](https://razorpay.com)
2. Click **Sign Up**
3. Enter business details
4. Verify email and phone

### Get Test Keys (For Development)

1. Login to [Razorpay Dashboard](https://dashboard.razorpay.com)
2. Make sure you're in **Test Mode** (toggle at top)
3. Go to **Settings** → **API Keys**
4. Click **Generate Test Key**
5. Copy both keys:

<CardGroup cols={2}>
  <Card title="Key ID" icon="key">
    **Starts with:** `rzp_test_`

    **Example:** `rzp_test_1A2B3C4D5E6F`

    Safe to use in frontend
  </Card>

  <Card title="Key Secret" icon="lock">
    **Random string**

    **Keep secret!** Backend only

    Example: `abcdef123456`
  </Card>
</CardGroup>

## Step 2: Tell the Agent What You Want

Describe your payment needs:

### Example 1: Basic Payment Gateway

```
I need to accept payments with Razorpay for Indian customers.

Razorpay credentials:
- Key ID: rzp_test_xxxxx
- Key Secret: xxxxx

What I'm selling:
- Product 1: ₹999
- Product 2: ₹1,499
- Product 3: ₹2,999

Payment methods needed:
- UPI (PhonePe, Google Pay, etc.)
- Credit/Debit cards
- Net banking
- Wallets (Paytm, PhonePe, etc.)

Please set this up.
```

### Example 2: Subscription Billing

```
I need Razorpay for monthly subscriptions.

Razorpay credentials:
- Key ID: rzp_test_xxxxx
- Key Secret: xxxxx

Subscription plans:
- Basic: ₹299/month
- Pro: ₹999/month
- Premium: ₹2,999/month

Features:
- Auto-recurring charges
- Cancel anytime
- Upgrade/downgrade plans
- Retry failed payments

Please build this.
```

### Example 3: E-commerce Checkout

```
Integrate Razorpay for my online store.

Razorpay credentials:
- Key ID: rzp_test_xxxxx
- Key Secret: xxxxx

Checkout flow:
1. User adds items to cart
2. Goes to checkout
3. Sees Razorpay payment options
4. Pays with UPI/card/wallet
5. Gets order confirmation

Features:
- Save payment methods
- Order tracking
- Email receipts

Please set this up.
```

<Tip>
  \*\*That's it - \*\*The agent will create the payment flow, handle webhooks, everything.
</Tip>

## Step 3: Test Payments

After setup:

<Steps>
  <Step title="Click Preview">
    In Emergent, click **Preview**
  </Step>

  <Step title="Add Item to Cart">
    Or go to whatever triggers payment
  </Step>

  <Step title="Click Pay">
    Should see Razorpay payment modal
  </Step>

  <Step title="Use Test Card">
    Card: 4111 1111 1111 1111

    CVV: Any 3 digits

    Expiry: Any future date
  </Step>

  <Step title="Complete Payment">
    Payment should succeed!
  </Step>

  <Step title="Check Dashboard">
    See payment in Razorpay dashboard
  </Step>
</Steps>

### Test Payment Methods

<CardGroup cols={2}>
  <Card title="Test Card - Success" icon="credit-card" color="#10b981">
    **Card:** 4111 1111 1111 1111

    **CVV:** Any

    **Expiry:** Any future date
  </Card>

  <Card title="Test UPI" icon="mobile" color="#10b981">
    **UPI ID:** success\@razorpay

    **Result:** ✅ Success
  </Card>
</CardGroup>

## Step 4: Go Live (Accept Real Payments)

### Complete KYC Verification

<Steps>
  <Step title="Submit Documents">
    In Razorpay Dashboard → **Account Settings**

    Upload:

    * PAN card
    * Business documents
    * Bank account details
    * Identity proof
  </Step>

  <Step title="Wait for Approval">
    Usually takes 24-48 hours
  </Step>

  <Step title="Get Live Keys">
    Once approved, switch to **Live Mode**

    Generate live API keys
  </Step>

  <Step title="Update App">
    Tell the agent:

    ```
    Switch to live Razorpay keys:
    - Key ID: rzp_live_xxxxx
    - Key Secret: xxxxx
    ```
  </Step>

  <Step title="Test Real Payment">
    Make a small real payment to verify
  </Step>
</Steps>

## Common Questions

<AccordionGroup>
  <Accordion title="What are Razorpay's fees?">
    **Standard rates (India):**

    **2% + ₹2 per transaction**

    Examples:

    * ₹100 sale = You get ₹96
    * ₹1,000 sale = You get ₹978
    * ₹10,000 sale = You get ₹9,798

    No setup fees or monthly charges!
  </Accordion>

  <Accordion title="When do I get paid?">
    **T+3 settlement** (3 business days after payment)

    Money goes directly to your bank account.

    You can see pending settlements in dashboard.
  </Accordion>

  <Accordion title="What if a customer wants a refund?">
    Tell the agent:

    ```
    I need to be able to refund payments.

    Add a refund feature where I can:
    - View all payments
    - Issue full refund
    - Issue partial refund
    ```
  </Accordion>

  <Accordion title="Can I split payments between multiple people?">
    Yes! Razorpay Route allows this. Tell the agent:

    ```
    I need to split payments:
    - 80% to seller
    - 20% platform fee to me

    Set up Razorpay Route.
    ```
  </Accordion>
</AccordionGroup>

## Something Not Working?

### Payment Modal Not Opening

**Tell the agent:**

```
When I click "Pay Now", nothing happens.
Can you debug the Razorpay integration?
```

### Payment Succeeds But Order Not Created

**Tell the agent:**

```
Payment goes through but order isn't created.
Can you check the webhook handling?
```

### Wrong Amount Charged

**Tell the agent:**

```
The payment amount is wrong.
Should charge ₹999 but charging different amount.
Can you fix this?
```

## Real Examples

### Example 1: Course Platform

```
I'm selling online courses.

Razorpay credentials: [will provide]

Courses:
- Beginner: ₹2,999
- Intermediate: ₹4,999
- Advanced: ₹7,999

Features:
- One-time payment
- Instant access after payment
- Payment confirmation email
- Invoice generation

Please set this up.
```

### Example 2: Food Delivery App

```
Integrate Razorpay for food orders.

Razorpay credentials: [will provide]

Payment flow:
1. Customer places order
2. Sees total with delivery fee
3. Pays via UPI/card
4. Order confirmed to restaurant

Features:
- COD option toggle
- Apply coupon codes
- Save payment methods

Please build this.
```

## Quick Checklist

Before going live:

* Tested with test card
* Tested UPI payment
* Payment appears in Razorpay dashboard
* Order is created correctly
* Customer gets confirmation
* Completed KYC verification
* Switched to live keys
* Made a real test payment

## Remember

**Perfect for India** - Supports all popular payment methods

**Simple pricing** - 2% + ₹2 per transaction

**Test mode first** - Use test keys for development

**KYC required** - For accepting real payments

**Quick settlements** - Money in 3 business days

<Info>
  Stuck? Tell the agent: "I need help with Razorpay payments" and describe the issue.
</Info>
