Saved VPA

Check the Saved VPA feature for Custom Web Integration.


Razorpay enables you to save the VPAs of a customer. The VPAs entered by the customer is stored and secured as tokens in Razorpay. The customers can select the saved VPA and complete the payment on subsequent visits.

  • This saves the customer the hassle of entering the VPA again for every transaction.
  • Without Saved VPAs, the customers may enter invalid VPAs or forget their VPAs, which could lead to higher drop-off rates.

Feature Request

This is an on-demand feature. Please raise a request with our

to get this feature activated on your Curlec account.

The user flow for accepting payments using tokens is as follows:

  1. The customer enters VPA to make UPI payments at your checkout.
  2. The entered VPAs are saved as tokens by Razorpay.
  3. On a repeat visit to your site, all the tokens saved for a customer are displayed on your checkout.
  4. From the displayed list of VPAs, the customer selects VPAs of their choice to complete the payment.

To authenticate API requests sent to Razorpay servers, send the API key, a combination of Key_Id and Key_Secret, in the request header.

from the Dashboard.

The steps required to integrate tokens in the payment flow are as follows:

Create a customer, whose VPAs should be saved, with details such as email and contact.

POST
/customers
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
-X POST https://api.razorpay.com/v1/customers \
-H "Content-Type: application/json" \
-d '{
"name": "Gaurav Kumar",
"email": "gaurav.kumar@example.com",
"contact": "9900000000",
"fail_existing": 0
}'

Know more about

.

An order must be created before initiating payment on your Checkout.

POST
/orders
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
-X POST https://api.razorpay.com/v1/orders \
-H "Content-Type: application/json" \
-d '{
"amount": 200,
"currency": "INR"
}'

Know more about

.

While making the UPI collect payment, the customer enters the VPA on the checkout. To save the VPA, send customer_id and save attributes along with the other

as shown below:

razorpay.createPayment({
amount: 200,
contact: '9900000000',
email_id: 'gaurav.kumar@example.com',
customer_id: 'cust_EIW4T2etiweBmG',
save: 1,
order_id: 'order_Ee0biRtLOqzRjP',
method: 'upi'
vpa: '9900000000@upi'
});

customer_id

string Unique identifier of the customer. This can be obtained from the response of

.

save

boolean Specifies if the VPA should be stored as tokens. Possible values are:

  • 1 - Saves the VPA details
  • 0(default) - Does not save the VPA details.

All the VPA tokens of a customer can be retrieved as follows:

GET
/customers/:customer_id/tokens
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
-X GET https://api.razorpay.com/v1/customers/cust_EIW4T2etiweBmG/tokens

Once the VPAs are tokenized, in all the repeat transactions on your website, customers can complete their UPI payments without having to enter their VPAs again.

In subsequent payments, instead of vpa, pass customer_id and token attributes along with the other

as shown below:

.... //beginning of your custom code
razorpay.createPayment({
amount: 100,
contact: '9900000000',
email_id: 'gaurav.kumar@example.com',
customer_id: 'cust_EIW4T2etiweBmG',
order_id: 'order_EAFrKULhM6Eopk',
method: 'upi',
token: 'token_EeO65VIv8BXZg5'
});
...... //rest of the code

customer_id

string Unique identifier of the customer.

token

string Token of the saved VPA obtained in the

.


Is this integration guide useful?