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.
Handy Tips
- Contact our Support team 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:- Fetch the List of Cardless EMI Providers
- Create an Order
- Create a Payment
- Handle Payment Success and Error Events
- Fetch Payment Details and Status
- Verify Payment Signature
- Integrate Payments Rainy Day Kit
- 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. Thecardless_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
Request
Response
Supported Providers
Given below is the list of supported Cardless EMI providers: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.
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 the Orders API.
- Pass the
order_idreceived in the response when you create the payment. This ties the order to the payment and secures the request from being tampered with.
POST https://api.razorpay.com/v1/orders
Request
Response
Request Parameters
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.Response Parameters
Descriptions for the response parameters are present in the Orders Entity parameters table.Error Response Parameters
The error response parameters are available in the API Reference Guide.1.3 Create a Payment
After you create the order, create a payment withmethod set to cardless_emi and provider set to the provider code the customer selected.
Endpoint: POST https://api.razorpay.com/v1/payments/create/json
Request
Response
Request Parameters
The payment amount in paise. It must match the amount of the order. For example, for ₹3,000, enter
300000.The unique identifier of the order created in step 1.2.
The customer’s mobile number. Use an Indian mobile number; providers identify the customer by this number. For example,
9000090000.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. See the list of supported providers.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.Response Parameters
If the payment request is valid, the response contains the following fields: Store therazorpay_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 aPOST 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:The signature you verify in step 1.6.
Callback Example
Failure Callback
If the payment fails, the callback contains anerror 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 for details.
Callback Example
- 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.
1.5 Fetch Payment Details and Status
After you receive therazorpay_payment_id at your callback_url, fetch the payment to check its status.
Endpoint: GET https://api.razorpay.com/v1/payments/:id
Request
Response
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 therazorpay_signature on your server and compare it with the one in the callback:
- Create a string from the
order_idyou created in step 1.2 and therazorpay_payment_idfrom the callback, separated by|. - Hash this string with HMAC-SHA256, using your key secret as the key.
- Compare the result with
razorpay_signature.
order_id stored on your server, not the razorpay_order_id from the callback.
Pseudocode
1.7 Integrate Payments Rainy Day Kit
Use the Payments Rainy Day kit to handle payment exceptions such as:1.8 Verify Payment Status
Handy TipsOn the Razorpay Dashboard, ensure that the payment status is
captured. Refer to the payment capture settings page to know how to capture payments automatically.Verify Status from Dashboard
- Log in to the Razorpay Dashboard and navigate to Transactions → Payments.
- 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 HTTPPOST payload in JSON to the URL you configured. Know how to set up webhooks.
For example, subscribe to:
payment.capturedto be notified when a payment is captured.order.paidto be notified when a customer pays for an order.payment.authorizedto be notified when a payment is authorized.payment.failedto be notified when a payment fails.