Cardless EMI - Native OTP Flow
The steps involved in cardless EMI with Native OTP:
Step 1: Check pre-EMI eligibility
Before initiating a payment request for a customer, it is necessary to check their eligibility using the Get Checkout Details API. For more information, refer to Get Checkout Details API.
Step 2: Initiate the payment request
Request parameters
Send the following additional parameters to PayU through a server-to-server curl request to initiate the payment. As a result of this API call, the customer will receive the OTP. For sample request and response, refer to Collect Payment API - Server-to-Server.
| Parameter | Description | Example |
|---|---|---|
panNumber mandatory | String PAN number of the customer. | ABCDE1234A |
s2s_device_info mandatory | String This parameter must have the customer agent's device. | Mozilla |
s2s_client_ip mandatory | String This parameter must have the source IP of the customer. | 10.11.101.11 |
txn_s2s_flow mandatory | String This parameter must be passed with the value as 4. | 4 |
📘 Notes for panNumber:
- Only 4-digit number of the PAN: Pass the 4-digit numeral in a sequential order as in the PAN.
- This parameter is mandatory for ICICI Bank and HDFC Bank Cardless EMI. Not mandatory for other banks.
- The data validation performed is either the whole PAN card number or 4-digit number of the PAN:
- Whole PAN card number: For validating the whole PAN card number:
- It should be ten characters long.
- The first five characters should be any uppercase alphabets.
- The next four characters should be any number from 0 to 9.
- The last (tenth) character should be any uppercase alphabet. It should not contain white spaces.
- Whole PAN card number: For validating the whole PAN card number:
Sample request
Below is a sample cURL request for initiating the payment.
curl -X POST "https://test.payu.in/_payment" \
-H "accept: application/json" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "key=JP***g" \
-d "txnid=EaE4ZO3vU4iPsp" \
-d "amount=10.00" \
-d "firstname=Ashish" \
-d "[email protected]" \
-d "phone=9876543210" \
-d "productinfo=iPhone" \
-d "pg=EMI" \
-d "bankcode=EMI03" \
-d "surl=https://apiplayground-response.herokuapp.com/" \
-d "furl=https://apiplayground-response.herokuapp.com/" \
-d "ccnum=1234" \
-d "ccexpmon=05" \
-d "ccexpyr=2022" \
-d "ccvv=123" \
-d "ccname=undefined" \
-d "store_card_token=1234 4567 2456 3566" \
-d "storecard_token_type=1" \
-d 'additional_info={"last4Digits": "1234", "tavv": "ABCDEFGH","trid":"1234567890", "tokenRefNo":"abcde123456"}' \
-d "panNumber=ABCDE1234A" \
-d "s2s_device_info=Mozilla" \
-d "s2s_client_ip=10.11.101.11" \
-d "txn_s2s_flow=4" \
-d "hash=fc3206829a6b4f8e300aeefb8f91add568b83dc90d01383a8e16553cc9600a3aefd4be2e370d32f0315ef1b9f28740515a9556b55abfefa7b54b434f894c9304"Additional examples for this request have been provided in JavaScript, Python, PHP, Java, and C#. Each programming language script includes detailed API integration examples for initiating a Cardless EMI payment.
Step 3: Submit the OTP
Once your customer enters the OTP on the payment page (postUrl/acsTemplate), pass the OTP using the Submit OTP API. For more information, refer to Submit OTP API.
Sample Response
- Success scenario
{
"metaData": {
"txnId": "43242dfsdf",
"referenceId": "348adsdas7d9ad798as7d87dsad87a9s",
"txnStatus": "Enrolled",
"unmappedStatus": "pending",
"statusCode": "",
"message": "",
"submitOtp": {
"status": "success"
}
},
"result": {
"mihpayid": "412345678912343542",
"mode": "EMI",
"status": "success",
"key": "hUmBue",
"txnid": "0b33346c19c1d18e878b",
"amount": "10.00",
"addedon": "2019-12-09 11:42:41",
"productinfo": "ProductInfo",
"firstname": "Payu-Admin",
"lastname": "",
"address1": "",
"address2": "",
"city": "",
"state": "",
"country": "",
"zipcode": "",
"email": "[email protected]",
"phone": "1234567890",
"unmappedstatus": "captured",
"hash": "04792dd6264c1dad0d4621..."
}
}- Failure scenario
{
"metaData": {
"txnId": "43122dfsdf",
"referenceId": "348adsdas7d9ad798as7d87dsad87a9s",
"txnStatus": "Enrolled",
"unmappedStatus": "pending",
"statusCode": null,
"message": null,
"submitOtp": {
"status": "failed",
"attemptsLeft": 2
}
},
"result": {}
}Resend OTP
If the customer enters the incorrect OTP or an expired OTP, use Resend OTP API to handle the Resend OTP request made by a customer.
Step 4. Verify the Payment
Upon receiving the response, PayU recommends you performing a reconciliation step to validate all transaction details. You can verify your payments using either of the following methods:
Configure the webhooks to monitor the status of payments.
Webhooks enable a server to communicate with another server by sending an HTTP callback or message.
These callbacks are triggered by specific events or instances and operate at the server-to-server (S2S) level.
👉 For more details, refer to Webhooks for Payments.
Updated 3 days ago
