Restricted MCC Codes
MCC Code | Category
5816 | Digital Goods: Games
6540 | POI Funding Transactions (excluding MoneySend)
4812 | Telecommunication Equipment and Telephone Sales
4814 | Telecommunication Services
7408 | Lending Platform
6513 | Real Estate Agents and Managers - Rentals
7995 | Betting/Lottery
5412 | Grocery Stores, Supermarkets
5413 | Grocery Stores, SupermarketsBest Practices
Follow these best practices to accept online payments using the UPI collect flow:- Validate the VPA before initiating the payment request.
- Add a custom UPI Collect expiry based on the business requirement to provide enough time for the customer to complete the payment.
- Use the Saved VPA feature offered by Razorpay to provide a better customer experience.
Prerequisites
- Reach out to our Support Team to enable VPA validation and saved VPA features for your account.
- Keep the API keys (
Key_IdandKey_Secret) handy for integration. - Generate API Keys from the Dashboard.
User Flow
Let us understand the process for accepting payments via the UPI collect flow:- The customer selects UPI as the payment method and enters the VPA of their choice on the UI. Razorpay validates the entered VPA.
- The customer saves the entered VPA details while completing the payment. Razorpay saves all the valid VPA details as tokens.
- On a repeat visit, the customer selects the VPA token to complete the payment.
Create VPA Tokens
Given below are the steps to create VPA tokens:[Create a customer](#step-1-create-a-customer) or fetch the custome...
[Create an order](#step-2-create-an-order).
[Validate the VPA](#step-3-validate-the-vpa) entered by the customer.
[Initiate payment](#step-4-initiate-a-payment) with a collect reque...
[Handle Payment Success and Error Events](#step-5-handle-payment-su...
Step 1: Create a Customer
email and contact.
/customers
Request Parameters
name mandatory
: string The name of the customer.
email optional
: string The email id of the customer.
contact optional
: string The phone number of the customer.
fail_existing optional
: string The request throws an exception by default if a customer with the exact details already exists. You can pass an additional parameter fail_existing to get the existing customer’s details in the response. Possible values:
1(default): If a customer with the same details already exists, throws an error.0: If a customer with the same details already exists, fetches details of the existing 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.
Step 2: Create an Order
You should create an order before initiating a payment at your end. /ordersRequest 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: Validate the VPA
Collect the VPA details of the customer and validate it as follows: /payments/validate/vpaRequest Parameters
vpa mandatory
: string The virtual payment address (VPA) you want to validate. For example, gauravkumar@exampleupi.
Step 4: Initiate a Payment
Once validated, you can now save the VPA provided by the customer. Create a payment with the validvpa as follows:
/payments/create/upi
Request Parameters
amount mandatory
: integer The amount associated with the payment in the smallest unit of the supported currency. For example, 2000 means ₹20.
currency mandatory
: string ISO code of the currency associated with the payment amount. Only INR is supported.
order_id mandatory
: string Unique identifier of the order obtained in the response of the previous step.
notes optional
: json object Key-value pairs that can hold additional information about the payment.
Refer to the Notes section of the API Reference Guide.
description optional
: string Descriptive text of the payment.
contact mandatory
: string Phone number of the customer.
email mandatory
: string Email address of the customer.
Step 5: Handle Payment Success and Error Events
Once the customer completes the payment, aPOST request is made to the callback_url provided in the payment request. The data contained in this request will depend on whether the payment was a success or a failure.
Success Callback
If the payment made by the customer is successful, the following fields are sent:razorpay_payment_idrazorpay_order_idrazorpay_signature
Failure Callback
If the payment has failed, the callback will contain details of the error. Refer to Errors for details.Create Payments using Tokens
The customer can make payments using the VPA tokens (which were saved earlier) on a repeat transaction.[Create an order](#step-1-create-an-order).
[Fetch all tokens of a customer](#step-2-fetch-vpa-tokens-of-a-cust...
[Initiate a payment](#step-3-initiate-a-payment-using-vpa-token) wi...
[Handle Payment Success and Error Events](#step-4-handle-payment-su...
Step 1: Create an Order
You should create an order before initiating the payment. /ordersRequest Parameters
amount mandatory
: integer The amount for which the order was created, in currency subunits. For example, for an amount of ₹295, enter 29500. Payment can only be made for this amount against the order.
currency mandatory
: string ISO code for the currency in which you want to accept the payment. Refer the list of supported currencies.
receipt optional
: string Receipt number that corresponds to this order, set for your internal reference. Can have a 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 2: Fetch VPA Tokens of a Customer
Use the API given below to retrieve all the card (if saved earlier) and VPA tokens of a customer. /customers/:customer_id/tokensStep 3: Initiate a Payment Using VPA Token
In each payment create request, instead of thevpa field, pass the customer_id and token attributes:
/payments/create/upi
Request Parameters
customer_id
: string Unique identifier of the customer.
token
: string Token of the saved VPA.
Response Parameters
Once the payment is successfully created, you will receive a response containing thenext array. This array tells you the next steps that you should take to process the payment:
razorpay_payment_id
: string Unique identifier for the payment returned by Checkout only for successful payments.
next
: array A list of action objects available to you to continue the payment process. Present when the payment requires further processing.
action
: string The action that you need to perform further. In this case, the value is poll
url
: string Contains the URL that you must poll to fetch the status of the payment, either authorized or failed.
Step 4: Handle Payment Success and Error Events
Once the customer completes the payment, aPOST request is made to the callback_url provided in the payment request. The data contained in this request will depend on whether the payment was a success or a failure.
Success Callback
If the payment made by the customer is successful, the following fields are sent:razorpay_payment_idrazorpay_order_idrazorpay_signature
Failure Callback
If the payment has failed, the callback will contain details of the error. Refer to Errors for details.Verify Payment Status
You can verify the status of the payments using any of the following methods:- Poll Razorpay servers periodically for the payments made for the order using our Fetch Payment APIs.
- Subscribe to the webhook events created in our system for each of the following entities:
Payment failure and re-initiating payment
If the Order is not markedpaid within 2-3 minutes, then you can re-initiate payment for the same.