Recurring Payments API - Custom Integration
Learn how you can integrate Recurring Payments using Razorpay APIs.
Feature Request
This feature is available only on request. It is not available by default. Raise a request on our
to get this feature enabled on your Dashboard.The integration flow varies depending on how you choose to create the authorization transaction.
This is possible only via APIs. The integration flow to collect recurring payments using Razorpay APIs is:
- Create a customer. This returns a
customer_id
. - Create an order. This returns an
order_id
. The order amount for:- Emandate is ₹0.
- Cards is a minimum of ₹1.
- Paper NACH is ₹0.
- UPI is ₹1.
- Pass the
customer_id
,order_id
and a few additional parameters in your Checkout to create the authorization payment. The customer completes the authorization payment, which generates atoken
. This payment can be authorized using one of the following instruments:- Emandate.
- Card.
- Paper NACH. The following additional steps have to be completed for NACH:
- The customer either downloads a pre-filled NACH form or you can send it to the customer.
- The customer signs the pre-filled NACH form.
- The customer either uploads the signed form or sends it to you to upload for processing.
- UPI.
- Retrieve and check the status of the token. Once the token status changes to
confirmed
, you can create and charge subsequent payments. - Create and charge subsequent payments. To do this, you have to manually:
- Create a new order.
- Create a recurring payment.
You can create registration links from the
or using APIs.Following is the integration flow to collect recurring payments using a registration link:
-
Create a registration link and send it to your customer
The customer completes the authorisation payment, which generates atoken
. This payment can be authorised using one of the following instruments:- Emandate
- Card
- Paper NACH. The following additional steps have to be completed for NACH:
- The customer either downloads a pre-filled NACH form or you can send it to the customer.
- The customer signs the pre-filled NACH form.
- The customer either uploads the signed form or sends it to you to upload for processing.
Know more about .
- UPI
No Need to Create a Customer and Order Separately
If you use a registration link to create the authorisation transaction, Razorpay automatically creates a customer and the order on your behalf.
-
Retrieve and check the token status
After the token status changes toconfirmed
, you can create and charge subsequent payments. -
Create and charge subsequent payments
To do this, you have to manually:- Create a new order.
- Create a recurring payment.
The Razorpay API Gateway URL is https://api.razorpay.com/v1
. You need to include this before each API endpoint to make API calls.
Use the URL https://api.razorpay.com/v1/payments
to access payment resources.
All Razorpay APIs are authenticated using Basic Auth
. Basic auth requires the following:
[YOUR_KEY_ID]
[YOUR_KEY_SECRET]
Basic auth expects an Authorization
header for each request in the Basic base64token
format. Here, base64token
is a base64 encoded string of YOUR_KEY_ID:YOUR_KEY_SECRET
.
Watch Out!
The Authorization
header value should strictly adhere to the format mentioned above. Invalid formats will result in authentication failures.
Few examples of invalid headers are: BASIC base64token
, basic base64token
, Basic "base64token"
and Basic $base64token
.
Follow these steps to generate API keys:
- Log in to your with the appropriate credentials.
- Select the mode (Test or Live) for which you want to generate the API key.
- Test Mode: The test mode is a simulation mode that you can use to test your integration flow. Your customers will not be able to make payments in this mode.
- Live Mode: When your integration is complete, switch to live mode and generate live mode API keys. In the integration, replace test mode keys with live mode keys to accept customer payments.
- Navigate to Account & Settings → API Keys (under Website and app settings) → Generate Key to generate key for the selected mode.
The Key Id
and Key Secret
appear on a pop-up page.
Watch this video to see how to generate API keys in the test mode.
Watch Out!
- After generating the keys from the Dashboard, download and save them securely. You can use only one set of API keys. If you don't remember your API keys, you must from the dashboard and update them wherever the previous keys were used for payment gateway integrations.
- API Keys are universal; that is, they are applicable to all websites and apps that you have whitelisted for your Merchant ID.
- Do not share your API Key secret with anyone or on any public platforms. This can pose security threats to your Razorpay account.
- Once you generate the API Keys, only the Key Id is visible on the Dashboard, not the Key secret, as it can pose security threats to your Razorpay account.
- Use the Live API Keys to accept live payments and the Test API Keys for test transactions.
Was this page helpful?