Calculate EMI for a merchant before the request is forwarded downstream.
Use this endpoint to calculate EMI for a merchant. merchant_id must be digits. reseller_id is removed before the downstream call, and amount and bankcode are not validated here. A success body is the POST /calculateEmi/v2 response, returned unchanged.
POST
/partner/calculateEmi
Environment
| Environment | URL |
|---|---|
| Test Environment | https://test-partnerapilayer.payu.in/apilayer/partner/calculateEmi |
| Production Environment | https://api.payu.in/partner/calculateEmi |
Sample Request
curl -X POST https://test-partnerapilayer.payu.in/apilayer/partner/calculateEmi \
-H "Content-Type: application/json" \
-H "Authorization: Bearer d4e5f6a7b8c90123456789abcdef0123456789abcdef0123456789abcdef0123" \
-d '{
"merchant_id": "8739528",
"amount": "1000.00",
"bankcode": "HDFC",
"reseller_id": "11ed-933c-ece48d50-a41d-023f883eb17c"
}'import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class PartnerRequest {
public static void main(String[] args) throws Exception {
String body = "{\"merchant_id\": \"8739528\", \"amount\": \"1000.00\", \"bankcode\": \"HDFC\", \"reseller_id\": \"11ed-933c-ece48d50-a41d-023f883eb17c\"}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://test-partnerapilayer.payu.in/apilayer/partner/calculateEmi"))
.header("Content-Type", "application/json")
.header("Authorization", "Bearer d4e5f6a7b8c90123456789abcdef0123456789abcdef0123456789abcdef0123")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}import requests
url = "https://test-partnerapilayer.payu.in/apilayer/partner/calculateEmi"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer d4e5f6a7b8c90123456789abcdef0123456789abcdef0123456789abcdef0123"
}
payload = {
"merchant_id": "8739528",
"amount": "1000.00",
"bankcode": "HDFC",
"reseller_id": "11ed-933c-ece48d50-a41d-023f883eb17c"
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://test-partnerapilayer.payu.in/apilayer/partner/calculateEmi",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"merchant_id\": \"8739528\", \"amount\": \"1000.00\", \"bankcode\": \"HDFC\", \"reseller_id\": \"11ed-933c-ece48d50-a41d-023f883eb17c\"}",
CURLOPT_HTTPHEADER => ["Content-Type: application/json", "Authorization: Bearer d4e5f6a7b8c90123456789abcdef0123456789abcdef0123456789abcdef0123"],
CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($curl);
curl_close($curl);const response = await fetch("https://test-partnerapilayer.payu.in/apilayer/partner/calculateEmi", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer d4e5f6a7b8c90123456789abcdef0123456789abcdef0123456789abcdef0123"
},
body: JSON.stringify({
"merchant_id": "8739528",
"amount": "1000.00",
"bankcode": "HDFC",
"reseller_id": "11ed-933c-ece48d50-a41d-023f883eb17c"
})
});
console.log(await response.text());using var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://test-partnerapilayer.payu.in/apilayer/partner/calculateEmi");
request.Headers.TryAddWithoutValidation("Authorization", "Bearer d4e5f6a7b8c90123456789abcdef0123456789abcdef0123456789abcdef0123");
request.Content = new StringContent("{\"merchant_id\": \"8739528\", \"amount\": \"1000.00\", \"bankcode\": \"HDFC\", \"reseller_id\": \"11ed-933c-ece48d50-a41d-023f883eb17c\"}", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());require "net/http"
require "json"
uri = URI("https://test-partnerapilayer.payu.in/apilayer/partner/calculateEmi")
request = Net::HTTP::Post.new(uri)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer d4e5f6a7b8c90123456789abcdef0123456789abcdef0123456789abcdef0123"
request.body = {"merchant_id": "8739528", "amount": "1000.00", "bankcode": "HDFC", "reseller_id": "11ed-933c-ece48d50-a41d-023f883eb17c"}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
puts response.body
Mandatory ParametersParameters marked with * are mandatory.
| Parameter | Description |
|---|---|
Content-Type* | string Send the body as application/json. |
Authorization* | string Partner access token. Send as Authorization Bearer token. |
merchant_id* | string Merchant id. |
amount | string Forwarded. Not validated in PartnerService.calculateEmi. |
bankcode | string Forwarded. Not validated in PartnerService.calculateEmi. |
reseller_id | string Removed before the downstream EMI call. |
Sample Response
{
"message": "Success",
"status": 1,
"result": {
"YES": {
"EMIY18": {
"transactionAmount": 10000.0,
"payBackAmount": 0.0,
"emiAmount": 555.56,
"additionalCost": "0.0",
"emiMdrNote": 0.0,
"emiBankInterest": 15.0,
"bankRate": 0.0,
"bankCharge": 0.0,
"amount": 555.56,
"cardType": "credit card",
"tenure": "18 months",
"loanAmount": 10000.0,
"offerKeys": null,
"offerDiscount": {
"total": 0.0,
"instant": 0.0,
"cashback": 0.0
},
"nceDiscount": {
"total": 1266.78,
"instant": 1266.78,
"cashback": 0.0
},
"sku": [
{
"skuId": "Product1",
"amountPerSku": 8000.0,
"amount": 8000.0,
"quantity": 1,
"offerKeys": null,
"emiAmount": 444.44,
"emiBankInterest": 15.0,
"emiValue": 444.44,
"emiInterestPaid": 1013.42,
"offerDiscount": {
"total": 0.0,
"instant": 0.0,
"cashback": 0.0
},
"nceDiscount": {
"total": 1013.42,
"instant": 1013.42,
"cashback": 0.0
},
"totalPayableAmount": 7999.92,
"nceDiscountAmount": 1013.42,
"subventionAmount": 8000.0,
"revisedPrincipal": 8000.0,
"additionalCharge": 0.0
}
],
"totalPayableAmount": 10000.0,
"nceDiscountAmount": 1266.78,
"revisedPrincipal": 10000.0,
"subventionAmount": 10000.0,
"gstSubvention": true,
"nceViaConfig": true,
"bankCode": "YESB",
"emi_value": 555.55,
"emi_interest_paid": 1266.78
}
}
}
}| Parameter | Description |
|---|---|
message | Response message. The sample value is Success. |
status | 1 for success and 0 for failure. |
result | EMI options grouped by bank code. Parameter descriptions are explained in the result Object Parameters section. |
result Object
result Object| Parameter | Description |
|---|---|
YES | Bank code for one group of plans. The sample bank is YES. Other bank codes use the same plan fields. Parameter descriptions are explained in the YES Object Parameters section. |
YES Object
YES Object| Parameter | Description |
|---|---|
EMIY18 | EMI plan code. The sample plan is an 18-month plan. Parameter descriptions are explained in the EMIY18 Object Parameters section. |
EMIY18 Object
EMIY18 Object| Parameter | Description |
|---|---|
transactionAmount | The total transaction amount for which the EMI is calculated. |
payBackAmount | The amount to be paid back over the EMI tenure, including interest. |
emiAmount | The EMI amount to be paid in each installment. |
additionalCost | Any additional cost apart from the EMI amount. |
emiMdrNote | Merchant discount rate note related to EMI. |
emiBankInterest | Interest rate charged by the bank for the EMI. |
bankRate | Bank rate for the EMI calculation. |
bankCharge | Additional bank charges associated with the EMI. |
amount | Amount per EMI installment, including any charges. |
cardType | Type of card used for the transaction. |
tenure | Duration of the EMI plan. |
loanAmount | Principal loan amount for EMI. |
offerKeys | Keys associated with any offers applied. |
offerDiscount | Offer discount on the plan. Parameter descriptions are explained in the offerDiscount Object Parameters section. |
nceDiscount | No-cost EMI discount on the plan. Parameter descriptions are explained in the nceDiscount Object Parameters section. |
sku | array of objects SKU details. Parameter descriptions are explained in the sku Object Parameters section. |
totalPayableAmount | Total amount payable after discounts and EMI. |
nceDiscountAmount | Total no-cost EMI discount amount applied. |
revisedPrincipal | Revised principal loan amount. |
subventionAmount | Subvention amount considered for the transaction. |
gstSubvention | Indicates if GST is included in subvention. |
nceViaConfig | Indicates if the no-cost EMI discount is via configuration. |
bankCode | Bank code of the bank providing EMI. |
emi_value | EMI value calculated. |
emi_interest_paid | Total interest paid over the EMI tenure. |
offerDiscount Object
offerDiscount Object| Parameter | Description |
|---|---|
total | Total discount amount provided as part of the offer. |
instant | Instant discount amount applied. |
cashback | Cashback amount provided as part of the offer. |
nceDiscount Object
nceDiscount Object| Parameter | Description |
|---|---|
total | Total no-cost EMI discount amount. |
instant | Instant no-cost EMI discount applied. |
cashback | Cashback from the no-cost EMI discount. |
sku Object
sku Object| Parameter | Description |
|---|---|
skuId | SKU identifier for the product. |
amountPerSku | Amount per SKU. |
amount | Total amount for the SKUs provided. |
quantity | Quantity of the SKU. |
offerKeys | Keys associated with any offers on the SKU. |
emiAmount | EMI amount specific to the SKU. |
emiBankInterest | EMI bank interest for the SKU. |
emiValue | EMI value calculated for the SKU. |
emiInterestPaid | Interest paid for EMI on the SKU. |
offerDiscount | Offer discount on the SKU. The fields are total, instant, and cashback. |
nceDiscount | No-cost EMI discount on the SKU. The fields are total, instant, and cashback. |
totalPayableAmount | Total amount payable for the SKU. |
nceDiscountAmount | No-cost EMI discount amount applied on the SKU. |
subventionAmount | Subvention amount for the SKU. |
revisedPrincipal | Revised principal amount for the SKU. |
additionalCharge | Additional charge applicable to the SKU. |
Errors
Below are the failure scenarios.
merchant_id param is missing in the body
{
"error": "merchant_id param is missing in the body"
}Reason: This error occurs when merchant_id is missing from the request body.
Recommended Fix: Include merchant_id in the request body and retry.
Invalid Auth token
{
"error": "Invalid Auth token"
}Reason: This error occurs when the auth token is missing or invalid.
Recommended Fix: Generate a new auth token and send it in the Authorization header.
