Step 1: Create a Customer
Create a customer whose VPAs should be saved. You can skip this step if you have already created customers in your account. /customersCurl
Request Parameters
name mandatory
: string The name of the customer.
email optional
: string The email ID of the customer.
contact optional
: integer The phone number of the customer.
notes optional
: json object Set of key-value pairs that can be associated with an entity. This can be useful for storing additional information about the entity. A maximum of 15 key-value pairs, each of 256 characters
(maximum), are supported.
Response
Theid obtained in the response should be sent as customer_id while creating the token.
Step 2: Create an Order
You should create an order before initiating a payment at your end. /ordersCurl
Request Parameters
amount mandatory
: integer The amount for which the order was created, in currency subunits.
For example, for an amount of ₹295, enter 29500.
currency mandatory
: string ISO code for the currency in which you want to accept the payment. Only INR is supported.
receipt optional
: string Receipt number that corresponds to this order, set for your internal reference. Maximum length of 40 characters.
notes optional
: json object Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, "note_key": "Beam me up Scotty”.
Step 3: Create Tokens for a Customer
While making the UPI collect payment, the customer enters the VPA on your UI. To store the VPA as a token, pass additional attributes in the create payment request:Curl
Failure Response
Request Parameters
customer_id
: string Unique identifier of the customer. This can be obtained from the response of Step 1.
amount mandatory
: integer The amount for which the order was created, in currency subunits.
For example, for an amount of ₹295, enter 29500.
currency mandatory
: string ISO code for the currency in which you want to accept the payment. Only INR is supported.
order_id mandatory
: string Order ID generated via Razorpay Orders API.
email mandatory
: string Email address of the customer.
contact mandatory
: string Phone number of the customer.
method mandatory
: string The payment method used to make the payment. Possible value is upi.
upi mandatory
: object The UPI type payment method.
vpa mandatory
: string UPI ID used for making the payment on the UPI app.
ip mandatory
: string The client’s browser IP address. For example, 105.106.107.108.
referer mandatory
: string Value of referer header passed by the client’s browser. For example, https://merchansite.com/example/paybill
user_agent mandatory
: string Value of user_agent header passed by the client’s browser.
For example, Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36
save
: boolean Specifies if the VPA should be stored as a token. Possible values are:
true: Saves the VPA details.false(default): Does not save the VPA details.
Response
The response contains an HTML page that is rendered in the customer’s browser. The customer can now complete the payment by logging in to the respective UPI app.Step 4: Fetch all Tokens of the Customer
All the card (if saved earlier) and VPA tokens of a customer can be retrieved. /customers/:customer_id/tokensCurl
Response
Pass the token that contains the VPA details of the customer,token_EeO65VIv8BXZg5 in the above example, to the payment create request.
Step 5: Create Payments using Tokens
After VPA tokenisation, customers can complete their UPI payments without having to enter their VPAs again for repeat transactions on your site. You should pass the following attributes in each payment create request, instead of thevpa field:
Curl
Failure Response
Request Parameters
customer_id
: string Unique identifier of the customer.
amount mandatory
: integer The amount for which the order was created, in currency subunits.
For example, for an amount of ₹295, enter 29500.
currency mandatory
: string ISO code for the currency in which you want to accept the payment. Only INR is supported.
order_id mandatory
: string Order ID generated via Razorpay Orders API.
email mandatory
: string Email address of the customer.
contact mandatory
: string Phone number of the customer.
method
: string The payment method used to make the payment. Possible value is upi.
token
: string Token of the saved VPA, obtained in the previous step.
Response
The response contains an HTML page that is rendered in the customer’s browser. The customer can now complete the payment by logging in to the respective UPI app.Next Steps
You can check the status of the payments using any of the following methods:- Poll the Razorpay servers to fetch a payment or fetch the payments made for an order.
- Subscribe to payments and orders Webhook events that are generated in Razorpay when the customer completes the payment on your website.