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

# Integrate Cardless EMI

> Integrate Cardless EMI with the Razorpay Server-to-Server (S2S) integration. Fetch providers, create an order and a payment, and verify the payment signature.

Available in
🇮🇳 India

Cardless EMI lets customers convert a purchase into EMIs using a credit line from a bank or lending partner, without using a card. The customer selects a provider on your checkout, completes the payment on the provider's page and returns to your website.

> [!NOTE]
>
> **Handy Tips**
>
> * Contact our [Support team](https://razorpay.com/support/) to enable Cardless EMI and the providers you want for your account.
> * Customers must have an account or a pre-approved credit limit with the provider they choose.

## Integration Steps

Follow the steps below to integrate the S2S JSON API and accept Cardless EMI payments:

1. [Fetch the List of Cardless EMI Providers](#11-fetch-the-list-of-cardless-emi-providers)
2. [Create an Order](#12-create-an-order)
3. [Create a Payment](#13-create-a-payment)
4. [Handle Payment Success and Error Events](#14-handle-payment-success-and-error-events)
5. [Fetch Payment Details and Status](#15-fetch-payment-details-and-status)
6. [Verify Payment Signature](#16-verify-payment-signature)
7. [Integrate Payments Rainy Day Kit](#17-integrate-payments-rainy-day-kit)
8. [Verify Payment Status](#18-verify-payment-status)

### 1.1 Fetch the List of Cardless EMI Providers

Use the Methods API to get the Cardless EMI providers enabled for your account. The `cardless_emi` object in the response lists each provider code. A provider with the value `true` is available for payments.

The response contains only the providers enabled for your account. Show only these providers on your checkout and pass the provider code in the `provider` parameter when you create the payment.

This API uses only your API key id, passed as the `key_id` query parameter. Do not send your key secret.

**Endpoint:** `GET https://api.razorpay.com/v1/methods`

```bash Request theme={null}
curl -X GET 'https://api.razorpay.com/v1/methods?key_id=[YOUR_KEY_ID]'
```

```json Response theme={null}
{
  "entity": "methods",
  "cardless_emi": {
    "earlysalary": true,
    "zestmoney": true,
    "hdfc": true,
    "idfb": true,
    "icic": true,
    "walnut369": true
  }
}
```

The response also contains the other payment methods enabled for your account. They are omitted here.

#### Supported Providers

Given below is the list of supported Cardless EMI providers:

| Provider | Provider Code | Minimum Order Amount |
| - | - | - |
| ICICI Bank | `icic` | ₹7,000 |
| IDFC FIRST Bank | `idfb` | ₹5,000 |
| HDFC Bank | `hdfc` | ₹5,000 |
| axio | `walnut369` | ₹900 |
| Fibe | `earlysalary` | ₹3,000 |
| ZestMoney | `zestmoney` | ₹99 |

#### Check Customer Eligibility (Optional)

Before checkout, you can call the Eligibility Check API (`POST /v1/customers/eligibility`) with the customer's details and the order amount. Use the result to show only the providers the customer is eligible for. Know more about the [Eligibility Check API](https://razorpay.com/docs/payments/payment-gateway/emi%C2%B2/eligibility-check).

### 1.2 Create an Order

To process a payment, create a Razorpay Order that corresponds to the order in your system.

* Create an order for every payment.
* Create the order using the Orders API. It is a server-side API call. Know how to [authenticate](https://razorpay.com/docs/api/authentication.md#generate-api-keys) the Orders API.
* Pass the `order_id` received in the response when you create the payment. This ties the order to the payment and secures the request from being tampered with.

**Endpoint:** `POST https://api.razorpay.com/v1/orders`

```bash Request theme={null}
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
-X POST https://api.razorpay.com/v1/orders \
-H "content-type: application/json" \
-d '{
  "amount": 300000,
  "currency": "INR",
  "receipt": "receipt#1"
}'
```

```json Response theme={null}
{
  "id": "order_U1F9kujEf1iytn",
  "entity": "order",
  "amount": 300000,
  "amount_paid": 0,
  "amount_due": 300000,
  "currency": "INR",
  "receipt": "receipt#1",
  "offer_id": null,
  "status": "created",
  "attempts": 0,
  "notes": [],
  "created_at": 1794918714
}
```

#### Request Parameters

**amount** `integer` *required*

The payment amount in paise. For example, for ₹3,000, enter `300000`. The amount must be at least the minimum order amount of the provider the customer chooses.

**currency** `string` *required*

The currency of the payment. Cardless EMI supports only `INR`.

**receipt** `string`

Your receipt number for the order. Maximum 40 characters.

**notes** `object`

Key-value pairs for additional information. Maximum 15 pairs, 256 characters each.

#### Response Parameters

Descriptions for the response parameters are present in the [Orders Entity](https://razorpay.com/docs/api/orders/entity.md) parameters table.

#### Error Response Parameters

The error response parameters are available in the [API Reference Guide](https://razorpay.com/docs/api/orders/create.md).

### 1.3 Create a Payment

After you create the order, create a payment with `method` set to `cardless_emi` and `provider` set to the provider code the customer selected.

**Endpoint:** `POST https://api.razorpay.com/v1/payments/create/json`

```bash Request theme={null}
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
-X POST https://api.razorpay.com/v1/payments/create/json \
-H "content-type: application/json" \
-d '{
  "amount": 300000,
  "currency": "INR",
  "order_id": "order_U1F9kujEf1iytn",
  "email": "gaurav.kumar@example.com",
  "contact": "9000090000",
  "method": "cardless_emi",
  "provider": "earlysalary",
  "callback_url": "https://example.com/callback",
  "ip": "105.106.107.108",
  "referer": "https://example.com/checkout",
  "user_agent": "Mozilla/5.0"
}'
```

```json Response theme={null}
{
  "razorpay_payment_id": "pay_U1F9lTlNaHhB7x",
  "next": [
    {
      "action": "redirect",
      "url": "https://api.razorpay.com/v1/payments/U1F9lTlNaHhB7x/authenticate"
    }
  ]
}
```

#### Request Parameters

**amount** `integer` *required*

The payment amount in paise. It must match the amount of the order. For example, for ₹3,000, enter `300000`.

**currency** `string` *required*

The currency of the payment. Pass `INR`. It must match the currency of the order.

**order\_id** `string` *required*

The unique identifier of the order created in [step 1.2](#12-create-an-order).

**email** `string` *required*

The customer's email address. For example, `gaurav.kumar@example.com`.

**contact** `string` *required*

The customer's mobile number. Use an Indian mobile number; providers identify the customer by this number. For example, `9000090000`.

**method** `string` *required*

The payment method. Pass `cardless_emi`.

**provider** `string` *required*

The code of the Cardless EMI provider the customer selected. For example, `earlysalary`. Use a provider code returned by the Methods API in [step 1.1](#11-fetch-the-list-of-cardless-emi-providers). See the list of [supported providers](#supported-providers).

**callback\_url** `string`

The URL on your website to which the customer is redirected after the payment is completed on the provider's page. Razorpay sends the payment result to this URL as a `POST` request. Pass this URL to receive the success and failure callbacks described in [step 1.4](#14-handle-payment-success-and-error-events).

**ip** `string`

The customer's IP address.

**referer** `string`

The referer header of the customer's browser request.

**user\_agent** `string`

The user agent of the customer's browser.

**notes** `object`

Key-value pairs for additional information. Maximum 15 pairs, 256 characters each.

#### Response Parameters

If the payment request is valid, the response contains the following fields:

**razorpay\_payment\_id** `string`

Unique identifier of the payment. Present in all successful responses.

**next** `array`

A list of action objects that you use to continue the payment.

**properties**

**action** `string`

The next step to continue the payment. Possible value:

* `redirect`: Redirect the customer to the URL to complete the payment on the provider's page.

**url** `string`

The URL to use for the action.

Store the `razorpay_payment_id` on your server. You need it to check the payment status and for reconciliation.

Redirect the customer to the `url` in the `next` array. Use the URL exactly as you receive it. Do not build it yourself. The customer is taken to the provider's page, where they log in, select an EMI plan and approve the payment. After this, the customer is redirected back to your `callback_url`.

### 1.4 Handle Payment Success and Error Events

When the customer completes the payment, Razorpay makes a `POST` request to the `callback_url` you passed in the payment request. The fields in this request depend on whether the payment succeeded or failed.

#### Success Callback

If the payment is successful, the following fields are sent:

**razorpay\_payment\_id** `string`

The unique id of the payment.

**razorpay\_order\_id** `string`

The order id the payment belongs to.

**razorpay\_signature** `string`

The signature you verify in [step 1.6](#16-verify-payment-signature).

```json Callback Example theme={null}
{
  "razorpay_payment_id": "pay_U1F9lTlNaHhB7x",
  "razorpay_order_id": "order_U1F9kujEf1iytn",
  "razorpay_signature": "ecaf89fd97ab1a07c1e119bacf5b4b8a5c8d5c79b54e53289ef653508ff166be"
}
```

#### Failure Callback

If the payment fails, the callback contains an `error` object with the details of the failure. The callback is a form-encoded POST; the example below shows its fields as JSON. `error.metadata` contains the `payment_id` and `order_id`. Refer to [Errors](https://razorpay.com/docs/errors) for details.

```json Callback Example theme={null}
{
  "error": {
    "code": "BAD_REQUEST_ERROR",
    "description": "Your payment has been cancelled. Try again or complete the payment later.",
    "source": "customer",
    "step": "payment_authentication",
    "reason": "payment_cancelled",
    "metadata": {
      "order_id": "order_U1FA3fmsTyuvvL",
      "payment_id": "pay_U1FA4DRYqmkz6f"
    }
  }
}
```

Common reasons a Cardless EMI payment fails:

* The customer cancelled the payment on the provider's page.
* The customer did not complete the payment in time.
* The customer is not registered with the provider.
* The customer's credit limit is exhausted, not activated, not approved or expired.
* The amount is less than the provider's minimum amount or more than the provider's maximum limit.
* The provider declined the payment.

When a payment fails, ask the customer to retry with another provider or another payment method.

### 1.5 Fetch Payment Details and Status

After you receive the `razorpay_payment_id` at your `callback_url`, fetch the payment to check its status.

**Endpoint:** `GET https://api.razorpay.com/v1/payments/:id`

```bash Request theme={null}
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
-X GET https://api.razorpay.com/v1/payments/pay_U1F9lTlNaHhB7x
```

```json Response theme={null}
{
  "id": "pay_U1F9lTlNaHhB7x",
  "entity": "payment",
  "amount": 300000,
  "currency": "INR",
  "status": "authorized",
  "order_id": "order_U1F9kujEf1iytn",
  "invoice_id": null,
  "international": false,
  "method": "cardless_emi",
  "amount_refunded": 0,
  "refund_status": null,
  "captured": false,
  "description": null,
  "card_id": null,
  "bank": "",
  "wallet": "earlysalary",
  "vpa": null,
  "email": "gaurav.kumar@example.com",
  "contact": "+919000090000",
  "notes": [],
  "fee": 0,
  "tax": 0,
  "error_code": null,
  "error_description": null,
  "error_source": null,
  "error_step": null,
  "error_reason": null,
  "acquirer_data": {
    "transaction_id": "U1F9lTlNaHhB7x"
  },
  "created_at": 1794918715
}
```

For Cardless EMI payments, the `wallet` field contains the provider code. In this example, the payment is `authorized` because automatic capture is not enabled on the account. Capture the payment or enable automatic capture to move it to `captured`.

### 1.6 Verify Payment Signature

Signature verification is a mandatory step. It confirms that the callback was sent by Razorpay. Regenerate the `razorpay_signature` on your server and compare it with the one in the callback:

1. Create a string from the `order_id` you created in [step 1.2](#12-create-an-order) and the `razorpay_payment_id` from the callback, separated by `|`.
2. Hash this string with HMAC-SHA256, using your key secret as the key.
3. Compare the result with `razorpay_signature`.

Use the `order_id` stored on your server, not the `razorpay_order_id` from the callback.

```js Pseudocode theme={null}
generated_signature = hmac_sha256(order_id + "|" + razorpay_payment_id, secret);

if (generated_signature == razorpay_signature) {
  payment is successful
}
```

### 1.7 Integrate Payments Rainy Day Kit

Use the Payments Rainy Day kit to handle payment exceptions such as:

* [Late Authorisation](https://razorpay.com/docs/payments/payments/late-authorisation.md)
* [Payment Downtime](https://razorpay.com/docs/api/payments/downtime.md)
* [Payment Errors](https://razorpay.com/docs/errors)

### 1.8 Verify Payment Status

> [!NOTE]
>
> **Handy Tips**
>
> On the Razorpay Dashboard, ensure that the payment status is `captured`. Refer to the [payment capture settings](https://razorpay.com/docs/payments/payments/capture-settings.md) page to know how to capture payments automatically.

You can track the payment status in three ways:

#### Verify Status from Dashboard

1. Log in to the Razorpay Dashboard and navigate to **Transactions → Payments**.
2. Check if a payment id has been generated and note its status. A successful payment is marked as **Captured**.

#### Subscribe to Webhook Events

Use Razorpay webhooks to receive notifications when a specific event occurs. When an event is triggered, Razorpay sends an HTTP `POST` payload in JSON to the URL you configured. Know how to [set up webhooks](https://razorpay.com/docs/webhooks/setup-edit-payments.md).

For example, subscribe to:

* `payment.captured` to be notified when a payment is captured.
* `order.paid` to be notified when a customer pays for an order.
* `payment.authorized` to be notified when a payment is authorized.
* `payment.failed` to be notified when a payment fails.

#### Poll APIs

[Poll Payment APIs](https://razorpay.com/docs/api/payments/fetch-all-payments.md) to check the payment status.

## Next Steps

[Step 2: Test Integration](https://razorpay.com/docs/payments/payment-gateway/s2s-integration/json/v2/test-integration)
