Prerequisite
Ensure you have read the product document before you proceed with the API integration.API Authentication
All Razorpay APIs are authenticated usingBasic Auth. Basic auth requires the following:
[YOUR_KEY_ID][YOUR_KEY_SECRET]
Authorization header for each request in the Basic base64token format. Here, base64token is a base64 encoded string of YOUR_KEY_ID:YOUR_KEY_SECRET.
API Gateway
For most of the Razorpay APIs, the Gateway URL ishttps://api.razorpay.com/v1. You need to include this before each API endpoint to make API calls. However, certain APIs are on V2. Hence, the gateway URL may differ for certain APIs.
Example
-
Use the URL
https://api.razorpay.com/v1/paymentsto access payment resources. -
Use the URL
https://api.razorpay.com/v2/accountsto access Route (Linked Account)-related resources.
Generate API Keys
Follow these steps to generate API keys: Watch this video to see how to generate API keys in the Test mode. Watch this video to see how to generate API keys in the Live mode.1
Step 1
Log in to your Dashboard with the appropriate credentials.
2
Step 2
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.
3
Step 3
Navigate to Account & Settings → API Keys (under Website and app settings) → Generate Key to generate key for the selected mode.
Customer Identifiers Workflow
To start accepting payments using Customer Identifiers, you must:- Create a customer (optional)
- Create a Customer Identifier
- Share Customer Identifier details with customer
- Setup webhooks to receive payment notifications (optional)
Smart Collect Entity
id
: string The unique identifier of the virtual account.
name
: string The merchant billing label as it appears on the Dashboard.
entity
: string Indicates the type of entity. Here, it is virtual account.
status
: string Indicates whether the virtual account is in active or closed state.
description
: string A brief description about the virtual account.
amount_paid
: integer The amount paid by the customer into the virtual account.
notes
: json object Any custom notes you might want to add to the virtual account can be entered here. Refer Notes section of the API Reference Guide to learn more.
customer_id
: string Unique identifier of the customer the virtual account is linked with. Refer the Customer API section to learn more.
receivers
: json object Configuration of desired receivers for the virtual account.
id
: string The unique identifier of the virtual bank account or virtual UPI ID. Sample IDs for:
- virtual bank account -
ba_Di5gbQsGn0QSz3 - virtual UPI ID -
vpa_CkTmLXqVYPkbxx - virtual qr code -
qr_F7BtWoRgpM7eOn.
entity
: string Name of the entity. Possible values are
bank_accountvpaqr_code
ifsc
: string The IFSC for the virtual bank account created. For example, RAZR0000001. This parameter appears in the response only when bank_account is passed as the receiver type.
bank_name
: string The bank associated with the virtual bank account. For example, RBL Bank. This parameter appears in the response only when bank_account is passed as the receiver type.
account_number
: string The unique account number provided by the bank. For example, 1112220061746877. This parameter appears in the response only when bank_account is passed as the receiver type.
name
: string The merchant billing label as it appears on the Dashboard. This parameter appears in the response only when bank_account is passed as the receiver type.
notes
: json object Any custom notes you might want to add to the virtual bank account or virtual UPI ID can be entered here. Refer Notes section of the API Reference Guide to learn more. This parameter appears in the response only when bank_account is passed as the receiver type.
username
: string The UPI ID consists of the username and the bank handle. The username consists of the namespace (assigned by the bank to Razorpay), the merchant prefix (which can be customised by you) and the descriptor (which you provide to identify the customer). The unique identifier which forms the first half of the virtual UPI ID. For example, rpy.payto00000gaurikumari. This parameter appears in the response only when vpa is passed as the receiver type.
handle
: string The bank name that forms the second half of the virtual UPI ID. For example, icici. This parameter appears in the response only when vpa is passed as the receiver type.
address
: string The UPI ID that combines the username and the handle with the @ symbol. For example, rpy.payto00000gaurikumari@icici. This parameter appears in the response only when vpa is passed as the receiver type.
reference
: string The reference number. This parameter appears in the response only when qr_code is passed as the receiver type.
short_url
: string The URL to download the QR code. For example, https://rzp.io/i/y0hrZw2. This parameter appears in the response only when qr_code is passed as the receiver type.
close_by
: integer UNIX timestamp at which the virtual account is scheduled to be automatically closed. The time must be at least 15 minutes after current time. The date range can be set till 2147483647 in UNIX timestamp format (equivalent to Tuesday, January 19, 2038 8:44:07 AM GMT+05:30).
Note:
Any request beyond
2147483647 UNIX timestamp will fail.closed_at
: integer UNIX timestamp at which the virtual account is automatically closed.created_at
: integer UNIX timestamp at which the virtual account was created.Sample Entity