Integrate PayU Hosted Checkout
PayU’s _payment API supports LRS transactions by capturing the following information in addition to the typical PayU Hosted Checkout transaction for cross-border paymentsL
- LRS Service Type - Mandatory for LRS transactions
- PAN of Buyer - Mandatory for LRS transactions, will be captured on PayU page if not sent in the request
- First Name, Last Name of Buyer (as on PAN) - Mandatory for LRS transactions, will be captured on PayU page if not sent in the request
- Date of Birth of Buyer - Mandatory for LRS transactions, will be captured on PayU page if not sent in the request
Reference:For the customer journey for PayU Hosted Integration with Cross-Border payments with LRS, refer to Customer Journey - PayU Hosted Checkout with LRS Integration.
The steps to integrate involves:
Step 1: Request Payment with PayU
The following parameters (mandatory) must be posted using any of the following seamless integration and refer to the corresponding section of Web Checkout Integration documentation for the complete list of parameters to be posted:
Request parameters
Environment
| Test Environment | <https://test.payu.in/_payment> |
| Production Environment | <https://secure.payu.in/_payment> |
Parameter | Description | Example |
|---|---|---|
key
|
| JPg****f |
txnid
|
| ypl938459435 |
amount |
| 100.00 |
productinfo
|
| iPhone |
firstname
|
| Ashish |
lastname
|
| Kumar |
email
|
| |
phone
|
|
|
address1
|
| 34 Saikripa-Estate, Tilak Nagar |
address2
|
| |
city
|
| Mumbai |
state
|
| Maharashtra |
country
|
| India |
zipcode
|
| 400004 |
surl
|
| |
furl
|
| |
udf1
|
Note: If not sent in the payment request, it will collected on the checkout page. | AELPR****E |
udf3
|
Note: If not sent in the payment request, it will collected on the checkout page. | 02-02-1980 |
udf4
|
| XYZ Pvt. Ltd. |
udf5
|
| INV123456 |
buyer_type_business
| This parameter is used to identify whether it is a business-to-business transaction. If 1 is posted, it is a B2B transaction. | 1 |
lrs_service_type
| The LRS service type decides the tax amount based on the nature of business. For more information, refer to the lrs_service_type parameter values table. | travel |
lrs_service_type parameter values
| lrs_service_type | Txn Amount <= INR 10 lacs | Txn Amount > INR 10 lacs |
| education_loan | 0 | 0 |
| education_non_loan | 0 | 5% |
| medical | 0 | 5% |
| travel | 0 | 20% |
| others | 0 | 20% |
Sample request
curl --location 'https://test.payu.in/_payment' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'key=PRiQvJ' \
--data-urlencode 'txnid=my_order_64240' \
--data-urlencode 'amount=5' \
--data-urlencode 'productinfo=asfas' \
--data-urlencode '[email protected]' \
--data-urlencode 'phone=8688359250' \
--data-urlencode 'txn_s2s_flow=4' \
--data-urlencode 'hash={{hash}}' \
--data-urlencode 'pg=CC' \
--data-urlencode 'bankcode=CC' \
--data-urlencode 'surl=https://test.payu.in/admin/test_response' \
--data-urlencode 'furl=https://test.payu.in/admin/test_response' \
--data-urlencode 'udf1=' \
--data-urlencode 'udf2=' \
--data-urlencode 'udf3=' \
--data-urlencode 'udf4=' \
--data-urlencode 'udf5=INV123456' \
--data-urlencode 'firstname=sudhanshu' \
--data-urlencode 'user_credentials=T58CQx:sudhanshu' \
--data-urlencode 'lastname=kr' \
--data-urlencode 'address1=308,third floor' \
--data-urlencode 'address2=testing' \
--data-urlencode 'city=ggn' \
--data-urlencode 'state=UP' \
--data-urlencode 'country=IND' \
--data-urlencode 'zipcode=122018' \
--data-urlencode 'lrs_service_type=travel'Step 2: Check response from PayU
Hash validation logic for payment response (Reverse Hashing)
While sending the response, PayU takes the exact same parameters that were sent in the request (in reverse order) to calculate the hash and returns it to you. You must verify the hash and then mark a transaction as a success or failure. This is to make sure the transaction has not tampered within the response.
The order of the parameters is similar to the following code block:
sha512(SALT|status||||||udf5|udf4|udf3|udf2|udf1|email|firstname|productinfo|amount|txnid|key)Sample response (parsed)
- Success scenario
Array
(
[mihpayid] => 403993715524069222
[mode] => CC
[status] => success
[unmappedstatus] => captured
[key] => JF***g
[txnid] => EaE4ZO3vU4iPsp
[amount] => 10.00
[cardCategory] => domestic
[discount] => 0.00
[net_amount_debit] => 10
[addedon] => 2021-09-08 19:37:19
[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] => ed99957adb08fea56c907b88e8d158a79c3562c67f96c298461509826f77a7ae9e88b2a176b3234c25f50bcd451271728719656f3bb59c13a52bebabc468615a
[field1] => 0608273386032718000015
[field2] => 986987
[field3] => 10.00
[field4] => 403993715524069222
[field5] => 100
[field6] => 02
[field7] => AUTHPOSITIVE
[field8] =>
[field9] => Transaction is Successful
[payment_source] => payu
[PG_TYPE] => CC-PG
[bank_ref_num] => 0608273386032718000015
[bankcode] => CC
[error] => E000
[error_Message] => No Error
[name_on_card] => payu
[cardnum] => 512345XXXXXX2346
)
- Failure scenario
Array
(
[mihpayid] => 20869277619
[mode] => CC
[status] => failure
[unmappedstatus] => failed
[key] => L43t1c
[txnid] => 26ba7cd6a67b0a010542
[amount] => 1.00
[cardCategory] => domestic
[discount] => 0.00
[net_amount_debit] => 0.00
[addedon] => 2024-09-05 17:46:10
[productinfo] => Product Info
[firstname] => Payu-Admin
[lastname] =>
[address1] =>
[address2] =>
[city] =>
[state] =>
[country] =>
[zipcode] =>
[email] => [email protected]
[phone] => 1234567890
[udf1] =>
[udf2] =>
[udf3] =>
[udf4] =>
[udf5] =>
[udf6] =>
[udf7] =>
[udf8] =>
[udf9] =>
[udf10] =>
[hash] => ac7720e4bc33e5494bec6d37302e522171175a987f9d47286bfd29e8a7fc794f56433fcacf0bc120db781c4dc1d05a4857d71e83f00f6ed6aa9c97a1938b9467
[field1] =>
[field2] =>
[field3] =>
[field4] =>
[field5] => 05
[field6] =>
[field7] => AUTHNEGATIVE
[field8] =>
[field9] => Authorization failed at Bank
[payment_source] => payu
[pa_name] => PayU
[PG_TYPE] => CC-PG
[bank_ref_num] => 2409052690
[bankcode] => AMEX
[error] => E1903
[error_Message] => Authorization failed at Bank
[cardnum] => XXXXXXXXXXXX2003
[cardhash] => This field is no longer supported in postback params.
)
Step 3: Verify the Payment
Verify the transaction details using the Verification APIs. For API reference, refer to Verify Payment API under API Reference.
Updated 8 days ago
