Environment
| Test Environment | <https://test.payu.in/info/linkAndPay/get_emi_checkout_details> |
| Production Environment | <https://info.payu.in/linkAndPay/get_emi_checkout_details> |
Request Parameters
Header
The request header contains the following fields:
| Field | Description | Example |
|---|---|---|
Date |
The date and time should be in the GMT time conversion(not the IST). For example, current time in India is 18:00:00 IST, the time in the date header should be 12:30:00 GMT. |
Thu, 17 Feb 2022 08:17:59 GMT |
Digest |
Base 64 encode of (sha256 hash of the JSON data (post to server). |
|
Authorization |
This field is in the following format:
|
hmac username="smsplus", algorithm="hmac-sha256", headers="date digest", signature="zGmP5Zeqm1pxNa+d68DWfQFXhxoqf3st353SkYvX8HI=" |
platformId |
This field contains the platform ID and include the value as 1. |
1 |
Required parameters for calculating authorization
- Date
- Authorization
The following sample Java code contains the logic used to encrypt as described in the above table:
// date
var date = new Date();
// var date = "Wed, 28 Jun 2023 11:25:19 GMT";
date = date.toUTCString();
// authorization
var authorization = getAuthHeader(date);
console.log(authorization);
function getAuthHeader(date) {
var AUTH_TYPE = 'sha512';
var data = isEmpty(request['data'])?"":request['data'];
var hash_string = data + '|' + date + '|' + pm.variables.get("merchantSalt");
console.log("Hash String is ", hash_string);
var hash = CryptoJS.SHA512(hash_string).toString(CryptoJS.enc.Hex);
var authHeader = 'hmac username="' + pm.variables.get("merchantKey") + '", ' + 'algorithm="' + AUTH_TYPE + '", headers="date", signature="' + hash + '"'
return authHeader;
}
pm.environment.set('date', date);
pm.environment.set('authorization', authorization);
function isEmpty(obj) {
for(var key in obj) {
if(obj.hasOwnProperty(key))
return false;
}
return true;
}Body parameters
| Parameter | Description | Example |
|---|---|---|
bankCodemandatory | String Bank/lender code (e.g. LPEMI for cardless EMI). | LPEMI |
keymandatory | string The API key generated from the dashboard. | yFbXg3 |
phonemandatory | String Customer mobile number for eligibility check. | 8178959206 |
amountmandatory | String Transaction amount for which eligibility is checked. | 10000.00 |
pgmandatory | String Payment category; use EMI for EMI/Link and Pay NTB flow. | EMI |
checkCustomerEligibilityWithDetailsmandatory | Boolean When true, eligibility is checked using the provided customer details. | true |
payuTokenoptional | StringThis parameter must contain is the PayU instrument token for saved card. | |
requestIdoptional | string The payment request ID. | Testing_111 |
userCredentialsoptional | StringThis parameter must contain an unique user credential mapped against each user, to be passed by the merchant for saved card. | abc:xyz |
customerDetailsmandatory for NTB eligibility | Object Customer onboarding details for NTB eligibility. For more information, refer to customerDetails JSON Fields Description. | See example below |
customerDetails JSON Fields Description
| Field | Description | Example |
|---|---|---|
panNumbermandatory | String Customer PAN number. | EIJPS1234R |
dobmandatory | String Date of birth (DD-MM-YYYY). | 14-12-1996 |
zipcodemandatory | String Postal zip code. | 411014 |
firstNamemandatory | String Customer first name. | Shray |
lastNamemandatory | String Customer last name. | Suri |
bureauPullConsentoptional | String Consent for bureau pull (e.g. "true" or "false"). | false |
genderoptional | String Customer gender. | Male |
incomeoptional | String Customer income. | 65000 |
employeeTypeoptional | String Employment type (e.g. Salaried). | Salaried |
absoptional | String Additional business-specific field if required. | Asnw |
Sample request
Link and Pay Eligibilty
curl --location 'https://test.payu.in/info/linkAndPay/get_emi_checkout_details' \
--header 'x-credential-username: smsplus' \
--header 'Content-Type: application/json' \
--header 'authorization: hmac username="x0i6r2", algorithm="sha512", headers="date", signature="0e0ebc518c085d8ff49058b7c232bfe2e8779e9e9cafd34a4cdf1c11114035eea75b0e404a9b9e152757dbcc4926f78b6f18ba7f6643e2bf687a65942d3bde38"' \
--header 'date: Mon, 28 Oct 2024 10:34:49 GMT' \
--data '{
"Key": "yFbXg3",
"amount": 21,
"userCredentials": "yFbXg3:test_sud",
"phone": "9999999999",
"bankCode": "LAZYPAY",
"payuToken": null,
"requestId": "Testing_111"
}'NTB Eligibility
curl --location 'https://test.payu.in/info/linkAndPay/get_emi_checkout_details' \
--header 'x-credential-username: smsplus' \
--header 'Content-Type: application/json' \
--header 'authorization: hmac username="x0i6r2", algorithm="sha512", headers="date", signature="0e0ebc518c085d8ff49058b7c232bfe2e8779e9e9cafd34a4cdf1c11114035eea75b0e404a9b9e152757dbcc4926f78b6f18ba7f6643e2bf687a65942d3bde38"' \
--header 'date: Mon, 28 Oct 2024 10:34:49 GMT' \
--data '{
"bankCode": "LPEMI",
"phone": "8178959206",
"amount": "10000.00",
"pg": "EMI",
"checkCustomerEligibilityWithDetails": true,
"customerDetails": {
"panNumber": "EIJPS1234R",
"dob": "14-12-1996",
"zipcode": "411014",
"firstName": "Shray",
"lastName": "Suri",
"bureauPullConsent": "false",
"gender": "Male",
"income": "65000",
"employeeType": "Salaried",
"abs": "Asnw"
}
}'
Authorization calculation logic:For authorization calculation logic, refer to Required parameters for calculating authorization.
Sample response
Success scenario
{
"bnpl":{
"all":[
{
"Lazypay":{
"status":1,
"kfsLink":"https://",
"eligible":true,
"customerLinked":true,
"PayuToken":"Token12345"
},
"Simpl":{
"status":1,
"availableBalance":500,
"kfsLink":"https://",
"eligible":true,
"customerLinked":true,
"PayuToken":"Token78901"
}
}
]
}
}Failure scenario
- Customer eligible but not linked
{
"httpCode": "200",
"message": "",
"status": 1,
"data": {
"emi": {
"ntb": {
"cardless": {
"all": {
"LPEMI": {
"tenureOptions": {
"LPEMI12": {
"tenure": 12,
"maximumAmount": 100000.0,
"eligibility": {
"status": false,
"reason": "Tenure not available"
}
},
"LPEMI03": {
"tenure": 3,
"maximumAmount": 60000.0,
"eligibility": {
"status": true
}
},
"LPEMI09": {
"tenure": 9,
"maximumAmount": 100000.0,
"eligibility": {
"status": false,
"reason": "Tenure not available"
}
},
"LPEMI06": {
"tenure": 6,
"maximumAmount": 100000.0,
"eligibility": {
"status": true
}
},
"LPEMI": {
"tenure": 0,
"maximumAmount": 100000.0,
"eligibility": {
"status": false,
"reason": "Tenure not available"
}
}
},
"eligibility": {
"status": true
}
}
},
"hasEligible": true
}
}
}
}
}- Customer not eligible
{
"httpCode": "200",
"message": "",
"status": 1,
"data": {
"emi": {
"ntb": {
"cardless": {
"all": {
"LPEMI": {
"tenureOptions": {
"LPEMI12": {
"tenure": 12,
"maximumAmount": 100000.0,
"eligibility": {
"status": false,
"reason": "Tenure not available"
}
},
"LPEMI03": {
"tenure": 3,
"maximumAmount": 60000.0,
"eligibility": {
"status": false,
"reason": "Tenure not available"
}
},
"LPEMI09": {
"tenure": 9,
"maximumAmount": 100000.0,
"eligibility": {
"status": false,
"reason": "Tenure not available"
}
},
"LPEMI06": {
"tenure": 6,
"maximumAmount": 100000.0,
"eligibility": {
"status": false,
"reason": "Tenure not available"
}
},
"LPEMI": {
"tenure": 0,
"maximumAmount": 100000.0,
"eligibility": {
"status": false,
"reason": "Tenure not available"
}
}
},
"eligibility": {
"status": false,
"reason": "Use is not eligible for cof product"
}
}
},
"hasEligible": false
}
}
}
}
}