General Flow for BNPL

This section describes the general steps to integrate BNPL.

Steps to Integrate:

  1. Check the BNPL eligibility
  2. Initiate the payment
  3. Check the response from PayU

Step 1: Check the BNPL eligibility

When your customer makes a payment through BNPL, you can check the customer’s eligibility using the Get Checkout Details API and then initiate payment.

🚧

Minimum amount for BNPL transaction

The minimum amount for BNPL transactions shall vary for each bank, so you need to check with the banks for the minimum amount.

For request parameters and response to perform BNPL Eligibility Check, refer to Get Checkout Details API.

Step 2: Initiate the payment

You need to ensure that BNPL for the pg parameter and BNPL provider code based on the desired BNPL for the bankcode parameter is posted. For API reference, refer to Collect Payments API under API Reference.

Environment

Post Request Syntax & Composition

<body>
<form action='https://test.payu.in/_payment' method='post'>
<input type="hidden" name="key" value="J*****g" />
<input type="hidden" name="txnid" value="t6svtqtjRdl34W" />
<input type="hidden" name="productinfo" value="iPhone" />
<input type="hidden" name="amount" value="1000" />
<input type="hidden" name="email" value="[email protected]" />
<input type="hidden" name="firstname" value="Ashish" />
<input type="hidden" name="lastname" value="Kumar" />
<input type="hidden" name="pg" value="BNPL" />
<input type="hidden" name="bankcode" value="LAZYPAY" />
<input type="hidden" name="surl" value="your own success url" />
<input type="hidden" name="furl" value="your own failure url" />
<input type="hidden" name="phone" value="9988776655” />
<input type="hidden" name="hash" value="eabec285da28fd0e3054d41a4d24fe9f7599c9d0b66646f7a9984303fd6124044b6206daf831e9a8bda28a6200d318293a13d6c193109b60bd4b4f8b09c90972" />
<input type="submit" value="submit"> </form>
</body>
</html>

Along with the mandatory parameters mentioned in Collect Payments API - BNPL under API Reference, you must post the following parameters for the BNPL:

ParameterDescription
pgString It defines the payment category using the Merchant Hosted Checkout integration. For a BNPL payment, "BNPL" must be specified in the pg parameter.
bankcode_String_The merchant must post this parameter with the corresponding payment option’s bank code value in it. For the list of bankcodes for BNPL, refer to BNPL Codes.

Checked the response mentioned in Collect Payments API - BNPL under API Reference..

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 -X POST "https://test.payu.in/_payment" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "key=J****g&txnid=5jJ9xYceXX1ydT&amount=1000.00&firstname=Ashish&[email protected]&phone=9876543210&productinfo=iPhone&pg=BNPL&bankcode=LAZYPAY&surl=https://apiplayground-response.herokuapp.com/&furl=https://apiplayground-response.herokuapp.com/&hash=6840ba0d1a14554f7ee5d20966dfbac6b221718e72dd823f05b6da01420286315b4956c28325898b66520b111604020ea2c547608606674766eb7e4164dc0baa"

Step 3: Check the 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

Array
(
    [mihpayid] => 403993715523409521
    [mode] => BNPL
    [status] => success
    [unmappedstatus] => captured
    [key] => J****g
    [txnid] => 5jJ9xYceXX1ydT
    [amount] => 1000.00
    [discount] => 0.00
    [net_amount_debit] => 1000
    [addedon] => 2021-07-02 15:03:50
    [productinfo] => iPhone
    [firstname] => PayU User
    [lastname] => 
    [address1] => 
    [address2] => 
    [city] => 
    [state] => 
    [country] => 
    [zipcode] => 
    [email] => [email protected]
    [phone] => 9876543210
    [udf1] => 
    [udf2] => 
    [udf3] => 
    [udf4] => 
    [udf5] => 
    [udf6] => 
    [udf7] => 
    [udf8] => 
    [udf9] => 
    [udf10] => 
    [hash] => 716f92a6452adadba68d133ba7f5ca3f3403f03f554e3ef850911f3e6727ee73402b249054170ad276c8b55ca12368a5e27cc69ffb0642ef6403dae9a5708794
    [field1] => 9876543210
    [field2] => 5jJ9xRceXX1ydT
    [field3] => 
    [field4] => PayU User
    [field5] => AXIhh4ExnaJ9dKiJvPxsewHwxMMmT3ba7UY
    [field6] => 
    [field7] => Transaction completed successfully
    [field8] => 
    [field9] => Transaction completed successfully
    [payment_source] => payu
    [PG_TYPE] => BNPL-PG
    [bank_ref_num] => 5jJ9xRceXX1ydT
    [bankcode] => LAZYPAY
    [error] => E000
    [error_Message] => No Error
)