The dynamic QR generation API returns a UPI QR which can be used for offline payment collections.
Environment
| Environment | URL |
|---|---|
| Production | https://secure.payu.in/_payment |
Request parameters
PayU Dynamic BQR API Parameters
| Parameter | Description | Example |
|---|---|---|
key mandatory |
Data type: stringMerchant key provided by PayU during onboarding. For more information, refer to Access Production Key and Salt. |
"gtKFFx" |
txnid mandatory |
Data type: stringThe transaction ID is a reference number for a specific order that is generated by the merchant. |
"TXN123456789" |
amount mandatory |
Data type: stringThe payment amount for the transaction. |
"100.00" |
productinfo mandatory |
Data type: stringA brief description of the product. |
"Mobile Phone" |
firstname mandatory |
Data type: stringThe first name of the customer. |
"John" |
email mandatory |
Data type: stringThe email address of the customer. |
"[email protected]" |
phone mandatory |
Data type: stringThe phone number of the customer. |
"9876543210" |
pg mandatory |
Data type: stringIt 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. |
"DBQR" |
bankcode mandatory |
Data type: stringEach payment option is identified with a unique bank code at PayU. It must include "UPIDBQR" for Dynamic BQR transaction. |
"UPIDBQR" |
hash mandatory |
Data type: 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) |
"c9c2d74b..." |
s2s_client_ip mandatory |
Data type: 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. |
"192.168.1.1" |
s2s_device_info mandatory |
Data type: 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. |
"Mozilla/5.0 (Windows NT 10.0; Win64; x64)" |
txn_s2s_flow mandatory |
Data type: stringThis parameter must be posted with the value "4" for transaction flow. |
"4" |
expiry_time optional |
Data type: 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. |
"1800" |
address1 optional |
Data type: stringThe 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. |
"123 Main Street" |
address2 optional |
Data type: stringThe second line of the billing address. |
"Apt 4B" |
city optional |
Data type: stringThe city where your customer resides as part of the billing address. |
"Mumbai" |
state optional |
Data type: stringThe state where your customer resides as part of the billing address. |
"Maharashtra" |
country optional |
Data type: stringThe country where your customer resides. |
"India" |
zipcode optional |
Data type: stringBilling address zip code is mandatory for the cardless EMI option. Character Limit: 20 |
"400001" |
udf1 optional |
Data type: stringUser-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. |
"custom_value_1" |
udf2 optional |
Data type: stringUser-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. |
"custom_value_2" |
udf3 optional |
Data type: stringUser-defined fields (udf) are used to store any information corresponding to a particular transaction. |
"custom_value_3" |
udf4 optional |
Data type: stringUser-defined fields (udf) are used to store any information corresponding to a particular transaction. |
"custom_value_4" |
udf5 optional |
Data type: stringUser-defined fields (udf) are used to store any information corresponding to a particular transaction. |
"custom_value_5" |
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=30Sample 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:
- Check UPI transaction status: Check the transaction status using the Verify Payment API (verify_payment) API. For more information, refer to Verify Payment API.
- 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.
