Subscription TPV Integration

PayU Hosted Checkout integration for TPV (Third Party Verification) Payment Mode supports both Net Banking (NB) and Unified Payment Interface (UPI) payment methods for subscription-based or autopay payments.

Customer journey

The customer journey involves three key steps:

  1. Checkout Initiation: Customer begins the payment process on the merchant's checkout page
  1. PayU Redirect: Customer is redirected to PayU's hosted checkout page for payment completion
  1. Payment Processing: Customer completes the payment using their preferred payment method (Net Banking or UPI)

Environment

EnvironmentURL
Testhttps://test.payu.in/_payment
Productionhttps://secure.payu.in/_payment

Step 1: Create Transaction with Beneficiary and SI Details

Create a transaction request with the required beneficiary details and Standing Instruction (SI) parameters for autopay functionality.

Step 2: Post Transaction Parameters

Submit the transaction parameters to PayU's payment gateway using the appropriate environment URL.

Request parameters

Parameter Description Example
key
mandatory
String - Merchant key provided by PayU during onboarding "JPg***r"
txnid
mandatory
String - Unique transaction ID for each order "ypl938459435"
amount
mandatory
String - Transaction amount "100"
productinfo
mandatory
String - Product description "Test Product"
firstname
mandatory
String - Customer's first name "John"
email
mandatory
String - Customer's email address "[email protected]"
phone
mandatory
String - Customer's phone number "9999999999"
beneficiarydetail
mandatory
JSON Object - Account numbers and associated details for verification See structure below
si_details
mandatory
JSON Object - Standing instruction details for autopay See structure below
free_trial
optional
String - Parameter to setup free trial periods "1"
surl
mandatory
String - Success URL for transaction response "https://www.yoursurl.com"
furl
mandatory
String - Failure URL for transaction response "https://www.yourfailureurl.com"
hash
mandatory
String - SHA512 Hash for securing the transaction request. For more information, refer to Generated using hash formula

Hash calculation

If UDF parameters are defined in the hash calculation, the same UDF fields must be included in the request sent to PayU.  

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

WithOut UDF Parameters.  

sha512(key|txnid|amount|productinfo|firstname|email|||||||||||beneficiarydetail|SAL T)  

Replace SALT with the salt value provided during onboarding.

Beneficiary Detail JSON Structure

{"beneficiaryName": "Sachin Tendulkar|Nitin Jaisingh|Somya|Nikita","beneficiaryAccountNumber": "1211450021|002001600674|1234673939|87669286932","beneficiaryAccountType": "SAVINGS|SAVINGS|CURRENT|CURRENT","beneficiaryIfscCode": "ICIC0000046|HDFC0000726|ICIC0000046|SBIN0098292","verificationMode": "DEBIT_CARD|NET_BANKING| |AADHAR"} 
Field Description Example
beneficiaryName String List of Beneficiary name separated by pipe symbol (|).
Maximum 4 names.
"Sachin Tendulkar|Nitin Jaisingh|
Somya|Nikita"
beneficiaryAccountNumber String List of account numbers separated by pipe symbol (|).
Maximum 4 accounts.
"002001600674|
00000031957292212|
00000035955239352|
00000035955239352"
beneficiaryAccountType String List of corresponding account type separated by pipe symbol (|). Maximum 4 types in the same order as account numbers. "SAVINGS|SAVINGS|
CURRENT|CURRENT"
ifscCode String List of corresponding IFSC codes separated by pipe symbol (|). Maximum 4 IFSC codes in the same order as account numbers. "ICIC0000046|
HDFC0000726|
ICIC0000046|
SBIN0098292"
verificationMode String List of verification mode separated by pipe symbol (|). Maximum 4 modes in the same order as account numbers. "DEBIT_CARD|NET_BANKING
| |AADHAR"

Standing Instruction (SI) Details JSON Structure

{
    "billingAmount": "100.00",
    "billingCurrency": "INR",
    "billingCycle": "monthly",
    "paymentStartDate": "2024-01-15",
    "paymentEndDate": "2025-01-15",
    "billingInterval": "1"
}

Sample request

curl --location 'https://test.payu.in/_payment' \
--data 'key=JPg***r&txnid=ypl938459435&amount=100&productinfo=Test Product&firstname=John&[email protected]&phone=9999999999&beneficiarydetail={"beneficiaryName":"John Doe","beneficiaryAccountNumber":"002001600674","ifscCode":"KTKB0000046"}&si_details={"billingAmount":"100.00","billingCurrency":"INR","billingCycle":"monthly"}&surl=https://www.yoursurl.com&furl=https://www.yourfailureurl.com&hash=generated_hash_value'

Step 3: Handle and Validate Response

Process the response from PayU and perform reverse hash validation to ensure transaction authenticity.

📘

Response Hash Validation (Reverse Hash):

The beneficiarydetail parameter is excluded during reverse hash calculation:

With UDFs:

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

Without UDFs:

sha512(SALT|status|||||||||||email|firstname|productinfo|amount|txnid|key)

Response parameters

ParameterDescriptionExample
mihpayidUnique reference number created for the transaction on PayU's system"99995401486671"
merchantidMerchant's unique ID"12345"
txnidTransaction ID provided in the request"ypl938459435"
statusStatus of the transaction"success", "failure", "pending"
amountTransaction amount post adjustments"100.00"
bankcodeBank code used in the transaction"SBITPV", "UPITPV"
errorError code indicating issues with the transaction"E000"
error_MessageDescription of any errors"Transaction failed"
payment_sourceIndicates the payment source"payu"
hashHash provided in the response for validationGenerated hash string

Net Banking transaction

Array(
    [mihpayid] => 99995401486671
    [status] => success
    [key] => travelibibo
    [txnid] => 4245248agh5519827ec
    [amount] => 100.00
    [bankcode] => SBITPV
    [hash] => e9272f99eace9f6e0a52c871cc0226ac...
    [payment_source] => payu
)

UPI transaction

Array(
    [mihpayid] => 99995401486672
    [status] => success
    [key] => merchant_key
    [txnid] => upi_txn_12345
    [amount] => 100.00
    [bankcode] => UPITPV
    [hash] => d8374b99face8e6e0b53d981dd0337bd...
    [payment_source] => payu
)

Sample webhook response

Net Banking webhook:

mihpayid=99995401486671&mode=NB&status=success&key=merchant_key&txnid=4245248agh5519827ec&amount=100.00&hash=validation_hash

UPI webhook:

amount=100.00&PG_TYPE=UPI-COLLECT&payment_source=payu&bankcode=UPITPV&mihpayid=99995401486672&status=success&hash=validation_hash