- 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.
User Flow
The user flow for accepting payments using tokens is as follows:1
The customer enters VPA to make UPI payments at your checkout.
The customer enters VPA to make UPI payments at your checkout.
2
The entered **VPAs are saved as tokens** by Razorpay.
The entered VPAs are saved as tokens by Razorpay.
3
On a repeat visit to your site, all the tokens saved for a customer...
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...
From the displayed list of VPAs, the customer selects VPAs of their choice to complete the payment.
Prerequisites
To authenticate API requests sent to Razorpay servers, send the API key, a combination ofKey_Id and Key_Secret, in the request header. Generate API Keys from the Dashboard.
Integration Steps
The steps required to integrate tokens in the payment flow are as follows:1.1 Create a Customer
Create a customer, whose VPAs should be saved, with details such asemail and contact.
/customers
Sample Request
1.2 Create an Order
An order must be created before initiating payment on your Checkout. /ordersSample Request
1.3 Create Tokens for a Customer
While making the UPI collect payment, the customer enters the VPA on the checkout. To save the VPA, sendcustomer_id and save attributes along with the other Checkout fields as shown below:
Custom Checkout Sample Code
customer_id
: string Unique identifier of the customer. This can be obtained from the response of Step 1.
save
: integer 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.
1.4 Fetch all Tokens of the Customer
All the VPA tokens of a customer can be retrieved as follows: /customers/:customer_id/tokensRequest
1.5 Create Payments Using 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 ofvpa, pass customer_id and token attributes along with the other Checkout fields as shown below:
Custom Checkout Sample Code
customer_id
: string Unique identifier of the customer.
token
: string Token of the saved VPA obtained in the previous step.