QR Codes GST APIs

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.

How It Works🔗

Given below is the flow:

  1. You create a QR code.
  2. A short URL is generated.
  3. Share the URL with your customers.
  4. Customers scan the QR code with their preferred UPI PSP app and complete the payment.

API Gateway URL🔗

The Razorpay API Gateway URL is https://api.razorpay.com/v1. You need to include this before each API endpoint to make API calls.

Example🔗

Use the URL https://api.razorpay.com/v1/payments to access payment resources.

API Authorisation🔗

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

Generate API Key🔗

Follow these steps to generate API keys:

  1. Log into your Dashboard with appropriate credentials.
  2. Select the mode (Test or Live) for which you want to generate the API key.
    • Test Mode: The test mode is a simulation mode that you can use to test your integration flow. Your customers will not be able to make payments in this mode.
    • Live Mode: When your integration is complete, switch to live mode and generate live mode API keys. Replace test mode keys with live mode keys in the integration to accept payments from customers.
  3. Navigate to SettingsAPI KeysGenerate Key to generate key for the selected mode.

The Key Id and Key Secret appear on a pop-up page.

Test Mode API Keys🔗

Watch this video to see how to generate API keys in the test mode.


Live Mode API Keys🔗

Watch this video to see how to generate API keys in the live 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 and replace it wherever required.
  • Do not share your API Key secret with anyone or on any public platforms. This can pose security threats for your Razorpay account.
  • Once you generate the API Keys, only the Key Id is visible on the Dashboard and not the Key secret as it can pose security threats for your Razorpay account.

Postman Collection🔗

We have a Postman collection to make the integration quicker and easier. Click the Download Postman Collection button below to get started.

Instructions to Use Postman Collection🔗

  • All Razorpay APIs are authenticated using Basic Authentication.

    • Generate API Keys from the Dashboard.
    • Add your API Keys in Postman. Select the required API → Auth → Type = Basic Auth → Username = <Your_Key_ID>; Password = <Your_Key_secret>
  • Some APIs in the collection require data specific to your account such as qr_id (QR code ID) as a path parameter.

    • For example, the Fetch QR code by ID API requires you to add the qr_id as a path parameter.
    • Such parameters are enclosed with {} in the collection. For example, {qr_id}.
    • The API throws an error if these values are incorrect or do not exist in your system.

QR Code Entity🔗

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

  1. This parameter is only available for UPI QR Codes.
  2. This is an optional parameter.
  3. The business is responsible for the completeness and correctness of the data and not Razorpay.

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=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.

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.

Create a QR Code🔗

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:

/payments/qr_codes
type mandatory

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.
name optional

string Label entered to identify the QR code. For example, Store Front Display.

usage mandatory

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 optional

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 _ 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.

descriptionoptional

string A brief description about the QR code.

notes optional

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 optional

string Unique identifier of the customer the QR code is linked with. Know more about to the Customers API.

close_by optional

integer 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 optional

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

  1. This parameter is only available for UPI QR Codes.
  2. This is an optional parameter.
  3. The business is responsible for the completeness and correctness of the data and not Razorpay.

Close a QR Code🔗

You can close a QR code using this endpoint:

/payments/qr_codes/:qr_id/close

Path Parameter🔗

id mandatory
string The unique identifier of the QR code that is to be closed.

Fetch Multiple QR Codes🔗

You can fetch multiple QR codes using the following endpoint:

/payments/qr_codes?count=2

Query Parameters🔗

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.

Fetch a QR Code🔗

You can retrieve all the details of a QR code using the following endpoint.

/payments/qr_codes/:qr_id

Path Parameter🔗

id mandatory
string The unique identifier of the QR code whose details are to be fetched.

Fetch QR Code for a Customer ID🔗

You can fetch QR codes for a specific Customer ID using the following endpoint:

/payments/qr_codes?customer_id={customer_id}

Query Parameter🔗

id mandatory
string The unique identifier of the customer. For example, cust_FUEQArey3YFi9R.

Fetch QR Code for a Payment ID🔗

You can fetch QR codes for a specific Payment ID using the following endpoint:

/payments/qr_codes?payment_id={payment_id}

Query Parameter🔗

id mandatory
string The unique identifier of the payment.

Fetch Payments for a QR Code🔗

You can fetch payments made on a particular QR code using the following endpoint:

/payments/qr_codes/:qr_id/payments?count=2

Path Parameter🔗

id mandatory
string 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.

Query Parameters🔗

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.

Refund a Payment🔗

You can refund a payment made on a QR code using the following endpoint:

/payments/:id/refund

Path Parameter🔗

id mandatory
string The unique identifier of the payment to be refunded.

Request Parameters🔗

amount optional
string Amount to be refunded. If no value is passed, a full refund is issued.
notes optional
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”.

Response Parameters🔗

``id`
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).
For example, refund in INR, a value of 100 means 100 paise (equivalent to ₹1).
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:
    • Normal refund not possible for a payment which is more than 6 months old.
    • Instant Refund can sometimes fail because of customer's account or bank-related issues.
speed_requested
string The processing mode of the refund seen in the refund response.
This attribute is seen in the refund response only if the speed parameter is set in the refund request.
Possible values:
  • 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:
    • If the refund can be processed instantly, Razorpay will do so, irrespective of the payment method used to make the payment.
    • If an instant refund is not possible, Razorpay will initiate a refund that is processed at the normal speed. Know more about instant refunds.
speed_processed
string This is a parameter in the response which describes the mode used to process a refund.
This attribute is seen in the refund response only if the 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:

  • Fetch a particular refund or a list of refunds for a payment ID.
  • Update a refund to modify the Notes field.

×