Dynamic QR Generation API

The dynamic QR generation API returns a UPI QR which can be used for offline payment collections.

Environment

EnvironmentURL
Productionhttps://secure.payu.in/\_payment

Request parameters

Parameter

Description

key mandatory

StringMerchant key provided by PayU during onboarding. For more information, refer to Access Production Key and Salt.

txnid
mandatory

StringThe transaction ID is a reference number for a specific order that is generated by the merchant.

amount
mandatory

StringThe payment amount for the transaction.

productinfo mandatory

StringA brief description of the product.

firstname
mandatory

String The first name of the customer.

email
mandatory

StringThe email address of the customer.

phone
mandatory

StringThe phone number of the customer.

pg
mandatory

String It defines the payment category that the merchant wants the customer to see by default on the PayU’s payment page. This field must contain the value as "DBQR" for Dynamic BQR transactions.

bankcode mandatory

String Each payment option is identified with a unique bank code at PayU. It must include "UPIDBQR" for Dynamic BQR transaction

hash
mandatory

StringIt is the hash calculated by the merchant. The hash calculation logic is:
sha512(key\|txnid\|amount\|productinfo\|firstname\|email\|udf1\|udf2\|udf3\|udf4\|udf5\||\||\||SALT)

s2s_client_ip
mandatory

StringThis parameter must have the source IP of the user's device.

  • *Note: **This information is helpful when it comes to issues related to fraud detection and chargebacks. Hence, it is must to provide the correct information.

s2s_device_info
mandatory

StringThis parameter must have the user agent of device

  • *Note: **This information is helpful when it comes to issues related to fraud detection and chargebacks. Hence, it is must to provide the correct information.

txn_s2s_flow
mandatory

StringThis parameter must be posted with the values a 4 for transaction flow.

expiry_time
optional

StringIf you want the QR to expire after a particular time, you can pass the value in seconds in this key, if nothing is sent the default expiry time is 30 minutes

address1
optional

String The first line of the billing address.

  • *For Fraud Detection**: This information is helpful when it comes to issues related to fraud detection and chargebacks. Hence, it is must to provide the correct information.

address2
optional

String The second line of the billing address.

city
optional

String The city where your customer resides as part of the billing address.

state
optional

String The state where your customer resides as part of the billing address,

country
optional

String The country where your customer resides.

zipcode
optional

String Billing address zip code is mandatory for the cardless EMI option.
Character Limit-20

udf1
optional

String User-defined fields (udf) are used to store any information corresponding to a particular transaction. You can use up to five udfs in the post designated as udf1, udf2, udf3, udf4, udf5.

udf2
optional

String User-defined fields (udf) are used to store any information corresponding to a particular transaction. You can use up to five udfs in the post designated as udf1, udf2, udf3, udf4, udf5.

udf3
optional

String User-defined fields (udf) are used to store any information corresponding to a particular transaction.

udf4
optional

String User-defined fields (udf) are used to store any information corresponding to a particular transaction.

udf5
optional

String User-defined fields (udf) are used to store any information corresponding to a particular transaction.

Hashing

You must hash the request parameters using the following hash logic:

sha512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||SALT)

For more information, refer to Generate Hash.

Sample request

curl --request POST \
     --url https://test.payu.in/_payment \
     --header 'accept: text/plain' \
     --header 'content-type: application/x-www-form-urlencoded' \
     --data key=JPM7Fg \
     --data txnid=aso6787 \
     --data amount=100.00 \
     --data productinfo=Test \
     --data firstname=Ashish \
     --data email=Kumar \
     --data phone=934123456 \
     --data pg=DBQR \
     --data bankcode=UPIDBQR \
     --data hash=8b58ae0706c955d870f2ce7d9ee25bae5c6711436b64074ad35e07a6a3f669d2d2b32259607109ea59fd07e9df60af544221b3edddc955b2e97dd177e6536321 \
     --data s2s_client_ip=192.1.1.1 \
     --data s2s_device_info=Mozilla Firefox \
     --data txn_s2s_flow=4 \
     --data expiry_time=30

Sample response

{
  "metaData": {
    "message": null,
    "referenceId": "81d99ec11b341fdcb7bc1a7be39eac61",
    "statusCode": null,
    "txnId": "202501081516542581",
    "txnStatus": "pending",
    "unmappedStatus": "pending"
  },
  "result": {
    "paymentId": "22095839016",
    "merchantName": "bajajfinserv",
    "merchantVpa": "bajajfinserv.QR2.payu@indus",
    "amount": "3223.00",
    "qrString": "upi://pay?pa=bajajfinserv.QR2.payu@indus&pn=Bajaj Finance limited&tr=22095839016&tid=PPPL22095839016080125151654677e498e&am=3223.00&cu=INR&tn=UPI Transaction",
    "otpPostUrl": "https://secure.payu.in/ResponseHandler.php"
  }
}

📘

Next steps:

After your perform the above, you need to perform the following:

  1. Check UPI transaction status: Check the transaction status using the Verify Payment API (verify_payment) API. For more information, refer to Verify Payment API.
  2. Check the S2S callback response: The response to this call would be a base64 encoded JSON containing transaction ID and other transaction details. This is similar to Step4 of UPI Collection - S2S.