Collect payments using QR codes with Merchant Hosted Checkout integration as described in this section. After collecting the details from the customer, make the transaction request with the payment details to PayU.
QR does not work in Test environment
QR does not work in PayU Test environment, so the Try It experience is not enabled.
Environment
Environment
Test Environment | https://test.payu.in/_payment |
Production Environment | https://secure.payu.in/_payment |
Request parameters
Parameter | Description | Example |
---|---|---|
key mandatory | String This parameter is the unique merchant key provided by PayU for your merchant account. For more information, refer to Generate Merchant Key and Salt. | 8488225 |
txnid mandatory | varchar This parameter is known as Transaction ID (or OrderID). It is the order reference number generated at your (Merchantβs) end. It is an identifier which you(merchant) would use to track a particular order. If a transaction using a particular transaction ID has already been successful at PayU, the usage of same Transaction ID again would fail. Hence, it is essential that you post us a unique transaction ID for every new transaction (Please make sure that the transaction ID being sent to us hasnβt been successful earlier. In case of this duplication, the customer would get an error of βduplicate Order IDβ). | fd3e847h2 |
amount mandatory | float This parameter should contain the payment amount of the particular transaction. Note: Type-cast the amount to float type | 10 |
productinfo mandatory | varchar This parameter should contain a brief product description. It should be a string describing the product (The description type is entirely your choice). | T-shirt |
firstname mandatory | varchar This parameter must contain the first name of the customer. | Ankit |
email mandatory | varchar This parameter must contain the email of the customer) | [email protected] |
phone mandatory | integer Merchant needs to take the customerβs GPay registered phone number and pass in this field. This field will be used for further mapping the customer VPA and initiate a collect request. | |
pg mandatory | string The payment gateway is specified in this parameter. For QR, specifiy QR. | QR |
bankcode mandatory | string Each payment option is identified with a unique bank code at PayU. You must use any of the following bank code for QR:- UPIQR for accepting payments with UPI QR. - BQR for accepting payments with Bharath QR | UPIQR |
surl mandatory | The "surl" field is the success URL, which is the page PayU will redirect to if the transaction is successful. The merchant can handle the response at this URL after the customer is redirected there. | https://apiplayground-response.herokuapp.com/ |
furl mandatory | The "furl" field is the Failure URL, which is the page PayU will redirect to if the transaction is failed. The merchant can handle the response at this URL after the customer is redirected there. | https://apiplayground-response.herokuapp.com/ |
hash mandatory | string The hash calculated by the merchant using the key and salt provided by PayU. The format for calculating the hash: sha512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||SALT) For more information, refer to Generate Hash. | |
lastname optional | string The last name of the customer. | |
address1 optional | string The first line of the billing address. | |
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. | |
udf1 | string This parameter has been made for you to keep any information corresponding to the transaction. | |
udf2 optional | string This parameter has been made for you to keep any information corresponding to the transaction. | |
udf3 | string This parameter has been made for you to keep any information corresponding to the transaction. | |
udf4 optional | string This parameter has been made for you to keep any information corresponding to the transaction. | |
udf5 | string This parameter has been made for you to keep any information corresponding to the transaction. |
Sample request
curl -X \
POST "https://test.payu.in/_payment" -H \
"accept: application/json" -H \
"Content-Type: application/x-www-form-urlencoded" -d "key=JP***g&txnid=ewP8oRopzdHEtC&amount=10.00&firstname=Ashish&[email protected]&phone=9876543210&productinfo=iPhone&pg=QR&bankcode=UPIQR&surl=https://apiplayground-response.herokuapp.com/&furl=https://apiplayground-response.herokuapp.com/&hash=bff508ec0974b20fe4be6c86cceab8c8dde88c4061a2a70373ddd0bbd3d24b21ae13984915fad06f9802f56b01a30da4e367e4e749959a76c3b2e5f12eb43319"
Response parameters
Reference
For the response parameters description, refer to Additional Info for Payment APIs.
Sample response (parsed)
(
[mihpayid] => 403993715524045752
[mode] => QR
[status] => success
[unmappedstatus] => captured
[key] => JPM7Fg
[txnid] => ewP8oRopzdHEtC
[amount] => 10.00
[discount] => 0.00
[net_amount_debit] => 10
[addedon] => 2021-09-06 13:27:08
[productinfo] => iPhone
[firstname] => Ashish
[lastname] =>
[address1] =>
[address2] =>
[city] =>
[state] =>
[country] =>
[zipcode] =>
[email] => [email protected]
[phone] => 9876543210
[udf1] =>
[udf2] =>
[udf3] =>
[udf4] =>
[udf5] =>
[udf6] =>
[udf7] =>
[udf8] =>
[udf9] =>
[udf10] =>
[hash] => 1be7e6e97ab1ea9034b9a107e7cf9718308aa9637b4dbbd1a3343c91b0da02b34a40d00ac7267ebe81c20ea1129b931371c555d565bc6e11f470c3d2cf69b5a3
[field1] =>
[field2] =>
[field3] =>
[field4] =>
[field5] =>
[field6] =>
[field7] =>
[field8] =>
[field9] => Transaction Completed Successfully
[payment_source] => payu
[PG_TYPE] => QR-PG
[bank_ref_num] => 87d3b2a1-5a60-4169-8692-649f61923b3d
[bankcode] => UPIQR
[error] => E000
[error_Message] => No Error
)