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 Settings β†’ API Keys β†’ Generate 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.
type

string The type of the 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 accepts any amount.
payment_amount if fixed_amount=true

integer The amount allowed for a transaction. If this is specified, then any transaction of an amount less than or more than this value is not 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 the 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 the 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 accepts any amount.
payment_amount _ mandatory if fixed_amount=true_

integer The amount allowed for a transaction. If this is specified, then any transaction of an amount less than or more than this value is not 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 retrieved.
to
integer Timestamp, in seconds, till when QR Codes are to be retrieved.
count
integer Number of QR Codes to be retrieved. 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 takes 5-7 working days to be processed.

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.

Γ—