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
Following are a few of the best practices to be followed to accept online payments using UPI Collect Flow:You should validate the VPA before initiating the payment request....
You should add a custom UPI Collect expiry based on the business re...
You should use the [Saved VPA](/payments/payment-methods/upi/saved-...
Prerequisites
- Contact our Support Team to get this feature enabled for your account.
- Keep the API key (combination of
Key_IdandKey_Secret) handy for integration. - Generate API Keys from the Dashboard if you have not done already.
- Configure the payment capture settings on the Dashboard.
UPI Collect Flow
Following is the process for accepting payments using the UPI Collect Flow:The customer selects UPI as the payment method and enters their VPA...
The customer saves the entered VPA details while completing the pay...
The next time the customer wants to make a payment using VPA, the c...
Integration Steps
1. Create a Payment and a VPA Token
Follow these steps to create and save valid VPA tokens in the payment flow:[Create a customer or fetch the customer for whom VPA should be sav...
[Create an order.](#step-12-create-an-order)
[Validate the VPA entered by the customer.](#step-13-validate-the-vpa)
[Initiate a payment.](#step-14-initiate-a-payment)
Step 1.1: Create a Customer
Skip this step if the customer is already created for your account. Create a customer whose VPAs should be saved with details such asemail and contact.
The following endpoint creates or add a customer with basic details such as name and contact details. You can use this API for various Razorpay Solution offerings.
/customers
Request Parameters
name optional
: string Customer’s name. Alphanumeric value with period (.), apostrophe (’), forward slash (/), at (@) and parentheses are allowed. The name must be between 3-50 characters in length. For example, Gaurav Kumar.
contact optional
: string The customer’s phone number. A maximum length of 15 characters including country code. For example, +919876543210.
email optional
: string The customer’s email address. A maximum length of 64 characters. For example, gaurav.kumar@example.com.
fail_existing optional
: string 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.
gstin optional
: string Customer’s GST number, if available. For example, 29XAbbA4369J1PA.
notes optional
: object This is a key-value pair that can be used to store additional information about the entity. It can hold a maximum of 15 key-value pairs, 256 characters (maximum) each. For example, "note_key": "Beam me up Scotty”.
Step 1.2: Create an Order
You need to create an order before initiating the payment. /orders Given below is the sample code whenmethod is upi.
method field. Below is a sample code for reference.
amount mandatory
: integer The transaction amount expressed in paise (currency supported is INR). For example, for an actual amount of ₹1, the value of this field should be 100.
currency mandatory
: string The currency in which the transaction should be made. You can create orders in INR only.
receipt optional
: string Receipt number that corresponds to this order, set for your internal reference. Maximum length is 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”.
method mandatory
: string The payment method used to make the payment. If this parameter is not passed, investors will be able to make payments using both netbanking and UPI payment methods. Possible values:
netbanking: Investors can make payments only using netbanking.card: Investors can make payments using debit card.upi: Investors can make payments only using UPI.
bank_account mandatory
: object Details of the bank account that the investor has provided at the time of registration.
account_number mandatory
: string The bank account number from which the investor should make the payment. For example, 765432123456789 Payments will not be processed for an incorrect account number.
name mandatory
: string The name linked to the bank account. For example, Gaurav Kumar.
ifsc mandatory
: string The bank IFSC. For example, HDFC0000053.
Step 1.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 1.4: Initiate a Payment
Once validated, 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.
save
: boolean Specifies if the VPA should be stored as tokens. Possible values:
true: Saves the VPA details.false(default): Does not save the VPA details.
customer_id mandatory
: string Unique identifier of the customer, obtained from the response of Step 1.
callback_url optional
: string URL where Razorpay will submit the final payment status.
ip mandatory
: string The client’s browser IP address. For example, 117.217.74.98
referer mandatory
: string Value of referer header passed by the client’s browser. For example, https://example.com/
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
upi
: Details of the expiry of the UPI link
flow mandatory
: string Specify the type of the UPI payment flow.
Possible values:
collect(default)intent
vpa mandatory
: string VPA of the customer where the collect request will be sent.
expiry_time mandatory
: integer Period of time (in minutes) after which the link will expire. The default value is 5.
2. Create Payments Using Tokens
On a repeat transaction, customers can make payments using the VPA tokens, which were saved earlier. Follow these steps to create a payment using a saved token:[Create an Order.](#step-21-create-an-order)
[Fetch all tokens of a customer.](#step-22-fetch-vpa-tokens-of-a-cu...
[Initiate a payment with the token selected by the customer.](#step...
[Verify Payment Signature](#step-24-verify-the-payment-signature)
Step 2.1: Create an Order
You need to create an order before initiating the payment. /orders Given below is the sample code whenmethod is upi.
method field. Below is a sample code for reference.
Request Parameters
amount mandatory
: integer The transaction amount expressed in paise (currency supported is INR). For example, for an actual amount of ₹1, the value of this field should be 100.
currency mandatory
: string The currency in which the transaction should be made. You can create orders in INR only.
receipt optional
: string Receipt number that corresponds to this order, set for your internal reference. Maximum length is 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”.
method mandatory
: string The payment method used to make the payment. If this parameter is not passed, investors will be able to make payments using both netbanking and UPI payment methods. Possible values:
netbanking: Investors can make payments only using netbanking.card: Investors can make payments using debit card.upi: Investors can make payments only using UPI.
bank_account mandatory
: object Details of the bank account that the investor has provided at the time of registration.
account_number mandatory
: string The bank account number from which the investor should make the payment. For example, 765432123456789 Payments will not be processed for an incorrect account number.
name mandatory
: string The name linked to the bank account. For example, Gaurav Kumar.
ifsc mandatory
: string The bank IFSC. For example, HDFC0000053.
Step 2.2: Fetch VPA Tokens of a Customer
You can retrieve all the card and VPA tokens of a customer if they have been previously saved. /customers/:customer_id/tokensStep 2.3: Initiate a Payment Using VPA Token
To initiate a payment using a VPA token, pass thecustomer_id and token parameters instead of the vpa parameter.
/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.
customer_id mandatory
: string Unique identifier of the customer.
token mandatory
: string Token of the saved VPA.
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.
customer_id mandatory
: string Unique identifier of the customer.
callback_url optional
: string URL where Razorpay will submit the final payment status.
ip mandatory
: string The client’s browser IP address. For example, 117.217.74.98
referer mandatory
: string Value of referer header passed by the client’s browser. For example, https://example.com/
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
Step 2.4: Verify the Payment Signature
This is a mandatory step to confirm the authenticity of the details returned to the Checkout form for successful payments.To verify the razorpay_signature returned to you by the Checkout form:
-
Create a signature in your server using the following attributes:
order_id: Retrieve theorder_idfrom your server. Do not use therazorpay_order_idreturned by Checkout.razorpay_payment_id: Returned by Checkout.key_secret: Available in your server. Thekey_secretthat was generated from the Dashboard.
-
Use the SHA256 algorithm, the
razorpay_payment_idand theorder_idto construct a HMAC hex digest as shown below:HMAC Hex Digest -
If the signature you generate on your server matches the
razorpay_signaturereturned to you by the Checkout form, the payment received is from an authentic source.
Generate Signature on Your Server
Given below is the sample code for payment signature verification:Post Signature Verification
After you have completed the integration, you can set up webhooks, make test payments, replace the test key with the live key and integrate with other APIs.Payment Capture Settings
After payment isauthorized, you need to capture it to settle the amount to your bank account as per the settlement schedule. Payments that are not captured are auto-refunded after a fixed time.
Supported Payment Methods
Following are all the payment modes that the customer can use to complete the payment on the Checkout. Some of them are available by default, while others require approval from us. Raise a request from the Dashboard to enable such payment methods.Payment Method | Code | Availability
Debit Card | debit | ✓
Credit Card | credit | ✓
Netbanking | netbanking| ✓
UPI | upi | ✓
EMI - Credit Card EMI, Debit Card EMI and No Cost EMI | emi | ✓
Cardless EMI | cardless_emi | Requires Approval.
Bank Transfer | bank_transfer | Requires Approval and Integration.
Emandate | emandate | Requires Approval and Integration.
Pay Later| paylater | Requires Approval.
Netbanking
You can select any of the listed banks. After choosing a bank, Razorpay will redirect to a mock page where you can make the paymentsuccess or a failure. Since this is Test Mode, we will not redirect you to the bank login portals.
Check the list of supported banks.
UPI
You can enter one of the following UPI IDs:success@razorpay: To make the payment successful.failure@razorpay: To fail the payment.
Related Information
- Webhooks (Recommended)
- Error Codes (Recommended)
- How Payment Gateway Works
- Payment States
- Settlements
- Refunds