Cardless EMI - Native OTP Flow
The steps involved in cardless EMI with Native OTP:
Validate the customer’s eligibility using the checkout details API.
Build and send the S2S request with all Cardless EMI parameters.
Submit the OTP entered by the customer to confirm the transaction.
Verify the transaction status to finalize the order.
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.
Know how to manage Webhooks for Payments.
Environment
| Test Environment | https://test.payu.in/merchant/postservice.php?form=2 |
| Production Environment | https://info.payu.in/merchant/postservice.php?form=2 |
Note: The hash logic for Verify Payment API is:
sha512(key|command|var1|salt) sha512
Sample request
curl --request POST
--url 'https://test.payu.in/merchant/postservice?form=2'
--header 'Content-Type: application/x-www-form-urlencoded'
--data key=JPM7Fg
--data command=verify_payment
--data var1=IhfgcZnXR4o4nB
--data hash=a0ae79fdd66c875af6e9b21c4a67f1822deb00f2df5e9f0b1948f3222f536a9bf741b24efbb1874ca0f84f76b036e6c0d641581d0100f7abe4aeed2f3264f5c9
Sample response
If credit card payment is made, the response is similar to the following:
{
"status":0,
"msg":"0 out of 1 Transactions Fetched Successfully",
"transaction_details":
{
"IhfgcZnXR4o4nB":
{
"mihpayid":"Not Found",
"status":"Not Found"
}
}
}If txnID is not found, the response is similar to the following:
{
"status":0,
"msg":"0 out of 1 Transactions Fetched Successfully",
"transaction_details":
{
"IhfgcZnXR4o4nB":
{
"mihpayid":"Not Found",
"status":"Not Found"
}
}
}Response parameters
| Parameter | Description | Example |
|---|---|---|
| status | This parameter returns the status of web service call. The status can be any of the following:
| 0 |
| msg | This parameter returns the reason string. | For example, any of the following messages are displayed:
|
| transaction_details | This parameter contains the response in a JSON format. For more information refer to JSON fields description for transaction_details parameter . | |
| request_id | PayU Request ID for a request in a Transaction. For example, a transaction can have a refund request. | 7800456 |
| bank_ref_num | This parameter returns the bank reference number. If the bank provides after a successful action. | 204519474956 |
To learn more about the possible error codes and their description, refer to Error Codes.
Updated 6 months ago
