UPI QR Code API
Create UPI QR Codes and associate the received payments with respective customers using Razorpay Virtual Account APIs.
UPI QR Code is a payment method that allows you to accept payments from your customers using the generated QR code. Razorpay UPI QR Codes are built around Razorpay's Virtual Account APIs. You can create virtual accounts and tag them to individual customers to track the customers' payments. Razorpay notifies you about the payment made to any of the virtual accounts and handles the complexity of reconciling these payments.
- Send a request to create a virtual account with
receiver.type
asqr_code
. A QR code is generated as a result of virtual account creation. - Display the QR code on your app used for collecting payments.
- Customers scan and pay using any of the UPI apps on their mobile devices.
- Verify the payment status either by polling Razorpay APIs or by.
-
Ensure that you have the API key required for integration.
- Log in to the Dashboard with appropriate credentials.
- Select the mode (Test or Live) for which you want to generate the API key.
Handy Tips
You have to generate separate API Keys for the test and live modes. No money is deducted from your account in the test mode.
- Navigate to Settings → API Keys → Generate Key to generate key for the selected mode.
Watch Out!
After generating the keys from the Dashboard, download and save them securely. If you do not remember your API Keys, you need to re-generate them from the Dashboard.
-
Verify that the
product of Razorpay, this feature is enabled for your account. If you are not, then you must log in to Dashboard and complete the onboarding process of the Smart Collect product for thevirtual_account
feature enabled on your account.
If you are already using thevirtual_account
feature to be enabled for your account. -
Know about the
.
To start accepting payments using UPI QR Code, a virtual account should be created with a receiver
, which defines the payment collection method associated with it. For UPI QR Code, the receiver type is qr_code
, which allows your customers to make payments using UPI by scanning the QR code.
You need to create a virtual account by sending an API request to Razorpay for generating the QR code for each payment.
receivers
mandatory
object
Object consisting of configured receivers types.
types
mandatory
array
List of desired receiver types.
In this case, it will be qr_code
.
qr_code
mandatory
array
The payment method that should be used to make the payment.
card
optional
boolean
Indicates whether card payment should be allowed with the QR Code or not.
By default, it is set to true
. In case of UPI QR payments, set this value to false
.
upi
mandatory
boolean
Indicates whether UPI payment should be allowed with the QR Code or not.
By default, the value is set to true
.
description
optional
string
A brief description of the payment.
customer_id
optional
string
Unique identifier of the customer for whom UPI QR Code is created. Know more about the
close_by
optional
integer
Specifies the UNIX timestamp at which the virtual account is scheduled to be automatically closed. It should be set at least 15 minutes after the time of creation.
notes
optional
object
Object consisting of key value pairs that allow you to store additional data.
Know more about
amount_expected
mandatory
integer
The maximum amount you expect to receive in this virtual account. Pass 69999
= ₹699.99 (INR is the default currency).
id
string
Unique identifier of the generated QR Code.
For example, qr_4lsdkfldlteskf
entity
string
Name of the entity in the response. In this case, it is qr_code
.
short_url
string
URL of the QR code.
A sample short URL looks like this
status
string
The status of the virtual account. Possible values:
-active
- closed
closed_at
integer
Specifies the timestamp(in Unix format) at which the virtual account was closed.
To know if the customer has made the payment or not, you can track the payment status either by polling the Razorpay servers or subscribing to
.To fetch all the payments received using the QR Code, send the following API request to Razorpay:
To fetch a specific payment, send the following request to Razorpay:
id
mandatory
string
Unique identifier of a specific virtual account whose details are to be retrieved.
To fetch all the payments made to a virtual account, send the following request:
id
mandatory
string
Unique identifier of a virtual account whose payments should be retrieved.
After you have received the payment, you may choose to close the virtual account.
id
mandatory
string
Unique identifier of the virtual account that should be closed.
Was this page helpful?