UPI TPV Integration - PayU Hosted Checkout
For UPI integration, you need to post transaction details to PayU with beneficiary details for validation, similar to Net-Banking integration.
The request parameters for UPI integration are the same as Net-Banking integration. The beneficiarydetail
parameter should include the UPI beneficiary details.
Environment
The following environments are available for TPV integration:
Test Environment | https://test.payu.in/_payment |
Production Environment | https://secure.payu.in/_payment |
Step 1: Create transaction with beneficiary details
Create a transaction by including a JSON object with beneficiary details (account numbers and IFSC codes). You can include up to 4 accounts for validation.
Step 2: Post the parameters to PayU
Request parameters
Parameter | Description | Example |
---|---|---|
keymandatory |
String Merchant key provided by PayU during onboarding |
JPg***r |
txnidmandatory |
String The transaction ID is a unique reference for each order. Duplicate transaction IDs are not allowed. |
ypl938459435 |
amountmandatory |
String Transaction amount |
100 |
productinfomandatory |
String Product description |
Test Product |
firstnamemandatory |
String Customer's first name |
John |
emailmandatory |
String Customer's email address |
[email protected] |
phonemandatory |
String Customer's phone number |
9999999999 |
beneficiarydetailmandatory |
String JSON object that contains account numbers and corresponding IFSC codes (max 4 accounts) in the same order |
beneficiarydetail JSON Object Fields |
surlmandatory |
String Success URL - PayU will make a POST request with transaction response to this URL if the transaction is successful |
https://www.yoursurl.com |
furlmandatory |
String Failure URL - PayU will make a POST request with transaction response to this URL if the transaction fails |
https://www.yourfurl.com |
api_versionmandatory |
String Version of the API |
6 |
hashmandatory |
String SHA512 hash calculated using the formula:sha512(key|txnid|amount|productinfo| firstname|email|udf1|udf2|udf3|udf4|udf5|||||| beneficiarydetail|SALT) |
Hash calculationThe hash is calculated using the following formula:
sha512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||beneficiarydetail|SALT)
Replace
SALT
with the salt value provided during onboarding.
beneficiarydetail JSON object fields
The beneficiarydetail
parameter should be a JSON object with the following structure:
Field | Description | Example |
---|---|---|
beneficiaryAccountNumber |
| "002001600674| 00000031957292212| 00000035955239352| 00000035955239352" |
ifscCode |
| "KTKB0000046| KTKB0000023| KTKB0000035| KTKB0000035" |
Example JSON:
{
"beneficiaryAccountNumber": "002001600674|00000031957292212|00000035955239352|00000035955239352",
"ifscCode": "KTKB0000046|KTKB0000023|KTKB0000035|KTKB0000035"
}
beneficiarydetail parameter in hashing:
- The
beneficiarydetail
parameter must be included in the hash calculation.- The format should be exactly as shown in the hash formula above.
- Replace SALT with the salt value provided to you during onboarding.
Step 3: Check the response from PayU
After posting the parameters, PayU will return a response with transaction details.
Hash Validation Logic for payment response (Reverse Hashing)
To validate the authenticity of the response, you can calculate the reverse hash using:
sha512(SALT|status||||||udf5|udf4|udf3|udf2|udf1|email|firstname|productinfo|amount|txnid|key)
beneficiarydetail parameter not required in reverse hashing:The
beneficiarydetail
parameter is not required when calculating the reverse hash.
Response parameters
Param Name | Description |
---|---|
mihpayid | It is a unique reference number created for each transaction at PayU's end. |
merchantid | It is the unique ID of the merchant. |
txnid | Transaction ID provided by the merchant during the transaction request. |
transaction_fee | Transaction fee for this transaction (e.g., fixed fee of INR 10 for Net Banking). |
discount | The discount/cashback amount provided by the bank, if applicable. |
amount | The amount after discount (if any). |
paymentgatewayid | Identifier for the payment gateway/bank sending the response. |
pg | The payment gateway used for the transaction (e.g., "NB" for Net Banking). |
status | Status of the transaction. Possible values: success, failure, pending. A pending status is considered as a failed transaction. |
key | Merchant key. |
addedon | Timestamp of the transaction (e.g., 2023-02-01 12:01:22). |
bankcode | Bank code used in the transaction. |
error | Error code (e.g., "E000" indicates no error). |
error_Message | Description of any errors encountered. |
Store the mihpayid and txnid parameter values in response:Make sure to store the
mihpayid
andtxnid
parameter values from the response for future reference and reconciliation.
Sample response
Array
(
[mihpayid] => 99995401486671
[status] => success
[txnid] => 4245248agh5519827ec
[amount] => 100.00
[addedon] => 2025-01-28 18:36:35
[productinfo] => Product Info
[hash] => e9272f99eace0c7803834e94dd88f0b9d05f1e95cd86c84c7ef8e5670a39bf1ccde2222ed7e73c2a0e60eb8cd8d5457e0ebdef0d01c1c04c7d5bc20b8a2d4901
[bankcode] => SBITPV
[error_Message] => No Error
)
Updated about 8 hours ago