How It Works🔗
Given below is the flow:
- You create a QR code.
- A short URL is generated.
- Share the URL with your customers.
- Customers scan the QR code with their preferred UPI PSP app and complete the payment.
List of Razorpay APIs for QR Codes GST.
Razorpay QR codes enables you to create QR codes and share them with customers to accept digital payments.
You can create, close and fetch QR codes using our APIs.
Given below is the flow:
The QR Code APIs are listed below:
The Razorpay API Gateway URL is https://api.razorpay.com/v1
. You need to include this before each API endpoint to make API calls.
Use the URL https://api.razorpay.com/v1/payments
to access payment resources.
All Razorpay APIs are authenticated using Basic Auth
. Basic auth requires the following:
[YOUR_KEY_ID]
[YOUR_KEY_SECRET]
Basic auth expects an Authorization
header for each request in the Basic base64token
format. Here, base64token
is a base64 encoded string of YOUR_KEY_ID:YOUR_KEY_SECRET
.
Watch Out!
The Authorization
header value should strictly adhere to the format mentioned above. Invalid formats will result in authentication failures. Few examples of invalid headers are:
BASIC base64token
basic base64token
Basic "base64token"
Basic $base64token
Follow these steps to generate API keys:
The Key Id
and Key Secret
appear on a pop-up page.
Watch this video to see how to generate API keys in the test mode.
Watch this video to see how to generate API keys in the live mode.
Watch Out!
We have a Postman collection to make the integration quicker and easier. Click the Download Postman Collection button below to get started.
All Razorpay APIs are authenticated using Basic Authentication.
Some APIs in the collection require data specific to your account such as qr_id
(QR code ID) as a path parameter.
qr_id
as a path parameter.id
string
The unique identifier of the QR code.
entity
string
Indicates the type of entity. Here, it is qr_code
.
tax_invoice
json object
This block contains information about the invoices. If not provided, the transaction will default to non-GST compliant UPI flow.
number
string
This is the invoice number against which the payment is collected. If not provided, the transaction will default to non-GST compliant UPI flow.
date
integer
Timestamp, in Unix format, that indicates the issue date of the invoice. For example. 1589994898
. If not provided, it will default to the current date.
customer_name
string
Customer name on the invoice. If not provided, the transaction will default to non-GST compliant UPI flow.
gst_amount
integer
GST amount on the invoice in paise. If not provided, the transaction will default to the non-GST compliant UPI flow.
cess_amount
integer
CESS Amount on the invoice in paise. If not provided, the transaction will default to the non-GST compliant UPI flow.
supply_type
string
Indicates whether the transaction is interstate or intrastate. Possible values:
interstate
intrastate
If not provided, the transaction will default to the non-GST compliant UPI flow.
business_gstin
string
The GSTIN mentioned on the invoice. For example, 06AABCU9603R1ZR
. If not passed, it will be picked up from the database.
Note
string
The type of QR code. Possible values:
upi_qr
: Create a QR code that accepts only UPI payments.bharat_qr
: Create a QR code that accepts UPI and card payments. This is an on-demand feature. Learn more about Bharat QR.image_url
string
The URL of the QR code. A sample short URL looks like this http://rzp.io/l6MS
. Click the link to download the code.
name
string
Label entered to identify the QR code. For example, Store Front Display
.
usage
string
Indicates if the QR code should be allowed to accept single payment or multiple payments. Possible values:
single_use
: QR code will accept only one payment and then close automatically.multiple_use
(default): QR code will accept multiple payments.fixed_amount
boolean
Indicates if the QR should accept payments of specific amounts or any amount. Possible values:
true
: QR code accepts only a specific amount.false
(default): QR code will accept any amount.payment_amount
if fixed_amount=trueinteger
The amount allowed for a transaction. If this is specified, then any transaction of amount less than or more than this value will not be allowed. For example, if this amount is set as 500000
, the customer cannot pay an amount less than or more than ₹5000.
status
string
Indicates the status of the QR code. Possible values:
active
closed
description
string
A brief description about the QR code.
payments_amount_received
integer
The total amount received on the QR code. All captured payments are considered.
payments_count_received
integer
The total number of payments received on the QR code. All captured payments are considered.
notes
object
Key-value pair that can be used to store additional information about the QR code. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, "note_key": "Beam me up Scotty”
.
customer_id
string
Unique identifier of the customer the QR code is linked with. Know more about to the Customers API.
close_by
integer
UNIX timestamp at which the QR code is scheduled to be automatically closed. The time must be at least 15 minutes after the current time. The date range can be set to 2147483647
in UNIX timestamp format (equivalent to Tuesday, January 19, 2038 8:44:07 AM GMT+05:30).
Watch Out
Any request beyond 2147483647 UNIX timestamp will fail.
closed_at
integer
UNIX timestamp at which the QR code is automatically closed.
created_at
integer
UNIX timestamp at which the QR code was created.
close_reason
string
The reason for the closure of the QR code. Possible values:
on_demand
: When you close the QR code using the APIs or the Razorpay Dashboard.paid
: If the QR code is created with usage=single_payment
parameter, the QR code closes automatically once the customer makes the payment, with the reason marked as paid
.null
: The QR code has not been closed yet.You can create a QR code and share the short URL with customers to accept payments. You can also print and download it. QR codes can be created for single or multiple use and for specific or all customers.
The following API endpoint creates a QR code:
type
mandatorystring
The type of QR code. Possible values:
upi_qr
: Create a QR code that accepts only UPI payments.bharat_qr
: Create a QR code that accepts UPI and card payments. This is an on-demand feature. Learn more about Bharat QR.name
optionalstring
Label entered to identify the QR code. For example, Store Front Display
.
usage
mandatorystring
Indicates if the QR code should be allowed to accept single payment or multiple payments. Possible values:
single_use
: QR code will accept only one payment and then close automatically.multiple_use
(default): QR code will accept multiple payments.fixed_amount
optionalboolean
Indicates if the QR should accept payments of specific amounts or any amount. Possible values:
true
: QR code accepts only a specific amount.false
(default): QR code will accept any amount.payment_amount
_ mandatory if fixed_amount=true_integer
The amount allowed for a transaction. If this is specified, then any transaction of amount less than or more than this value will not be allowed. For example, if this amount is set as 500000
, the customer cannot pay an amount less than or more than ₹5000.
Note
This is a mandatory parameter if fixed_amount is selected.
description
optionalstring
A brief description about the QR code.
notes
optionalobject
Key-value pair that can be used to store additional information about the QR code. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, "note_key": "Beam me up Scotty”
.
customer_id
optionalstring
Unique identifier of the customer the QR code is linked with. Know more about to the Customers API.
close_by
optionalinteger
UNIX timestamp at which the QR code is scheduled to be automatically closed. The time must be at least 2 minutes after the current time. The date range can be set to 2147483647
in UNIX timestamp format (equivalent to Tuesday, January 19, 2038 8:44:07 AM GMT+05:30).
Watch Out
Any request beyond 2147483647 UNIX timestamp will fail.
tax_invoice
optionaljson object
This block contains information about the invoices. If not provided, the transaction will default to non-GST compliant UPI flow.
number
string
This is the invoice number against which the payment is collected. If not provided, the transaction will default to non-GST compliant UPI flow.
date
integer
Timestamp, in Unix format, that indicates the issue date of the invoice. For example. 1589994898
. If not provided, it will default to the current date.
customer_name
string
Customer name on the invoice. If not provided, the transaction will default to non-GST compliant UPI flow.
gst_amount
integer
GST amount on the invoice in paise. If not provided, the transaction will default to the non-GST compliant UPI flow.
cess_amount
integer
CESS Amount on the invoice in paise. If not provided, the transaction will default to the non-GST compliant UPI flow.
supply_type
string
Indicates whether the transaction is interstate or intrastate. Possible values:
interstate
intrastate
If not provided, the transaction will default to the non-GST compliant UPI flow.
business_gstin
string
The GSTIN mentioned on the invoice. For example, 06AABCU9603R1ZR
. If not passed, it will be picked up from the database.
Note
You can close a QR code using this endpoint:
id
mandatorystring
The unique identifier of the QR code that is to be closed.You can fetch multiple QR codes using the following endpoint:
from
integer
Timestamp, in seconds, from when QR codes are to be fetched.to
integer
Timestamp, in seconds, till when QR codes are to be fetched.count
integer
Number of QR codes to be fetched. The default value is 10
and the maximum value is 100
. This can be used for pagination, in combination with skip
.skip
integer
Number of records to be skipped while fetching the QR codes. This can be used for pagination, in combination with count
.You can retrieve all the details of a QR code using the following endpoint.
id
mandatorystring
The unique identifier of the QR code whose details are to be fetched.You can fetch QR codes for a specific Customer ID using the following endpoint:
id
mandatorystring
The unique identifier of the customer. For example, cust_FUEQArey3YFi9R
.You can fetch QR codes for a specific Payment ID using the following endpoint:
id
mandatorystring
The unique identifier of the payment.You can fetch payments made on a particular QR code using the following endpoint:
id
mandatorystring
The unique identifier of the QR code whose payment details are to be fetched.The response parameters are the same as those mentioned in the Fetch a Payment API.
from
integer
Timestamp, in seconds, from when payments are to be fetched.to
integer
Timestamp, in seconds, till when payments are to be fetched.count
integer
Number of payments to be fetched. The default value is 10
and the maximum value is 100
. This can be used for pagination, in combination with skip
.skip
integer
Number of records to be skipped while fetching the payments. This can be used for pagination, in combination with count
.You can refund a payment made on a QR code using the following endpoint:
id
mandatorystring
The unique identifier of the payment to be refunded.amount
optionalstring
Amount to be refunded. If no value is passed, a full refund is issued.notes
optionalobject
Key-value pair that can be used to store additional information about the QR code. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, "note_key": "Beam me up Scotty”
.string
Unique identifier of the refund.entity
string
Indicates the type of entity. Here, it is refund
.amount
integer
The amount to be refunded (in the smallest unit of currency). currency
string
The currency of the amount for which refund is initiated.payment_id
string
Unique identifier of the payment for which the refund is initiated.created_at
integer
Timestamp, in Unix format, when the refund was created.batch_id
string
This parameter is populated if the refund was created as part of a batch upload. For example, batch_00000000000001
notes
json object
Key-value store for storing your reference data. A maximum of 15 key-value pairs can be included.receipt
string
A unique identifier provided by you for your internal reference.acquirer_data
array
A dynamic array consisting of a unique reference number (either RRN, ARN or UTR) that is provided by the banking partner when a refund is processed. This reference number can be used by the customer to track the status of the refund with the bank.status
string
Indicates the state of the refund. Possible values:
pending
: This state indicates that Razorpay is attempting to process the refund.processed
: This is the final status of the refund, indicating that the refund is paid.failed
: A refund can attain the failed state in the following scenarios:speed_requested
string
The processing mode of the refund seen in the refund response. speed
parameter is set in the refund request.normal
: Indicates that the refund will be processed via the normal speed. That is, the refund will take 5-7 working days. Know more about normal refunds.optimum
: Indicates that the refund will be processed at an optimal speed based on Razorpay's internal fund transfer logic. That is:
speed_processed
string
This is a parameter in the response which describes the mode used to process a refund. speed
parameter is set in the refund request. Possible values:
instant
: This means that the refund has been processed instantly via fund transfer.normal
: This means that the refund has been processed by the payment processing partner. That is, the refund will take 5-7 working days.Know more about Refunds API to perform other refund-related operations:
ON THIS PAGE