EMI Integration
When your customer wants to opt for the EMI option with cards, you can use EMI APIs to check the customer’s eligibility and get the EMI amount, interest, processing fee, or No-Cost EMI and tenure. If the customer is eligible, you can post the transaction with EMI conversion.
You can collect payments from customers with leading wallets using the v2/payments API > Merchant Hosted integration. You need to ensure that EMI for the paymentMethod.name field and EMI bank code based on the desired wallet for the paymentMethod.bankcode field.
Steps to Integrate
Step 1: Initiate the payment with PayU
Environment
Test Environment | https://apitest.payu.in/v2/payments |
Production Environment | https://api.payu.in/v2/payments> |
Request header
Request Headers
Parameter | Description |
---|---|
date | The current date and time. For example, format of the date is Wed, 28 Jun 2023 11:25:19 GMT. |
authorization | The actual HMAC signature generated using the specified algorithm (sha512) and includes the hashed data. For more information, refer to authorization fields description. |
authorization fields description
Field | Description |
---|---|
username | Represents the username or identifier for the client or merchant, for example smsplus. |
algorithm | Use SHA512 algorithm for hashing and send this as header value. |
headers | Specifies which headers have been used in generating the hash, for example date. |
signature | The HMAC signature generated using the specified algorithm. For more information, refer to hashing algorithm. |
hashing algorithm
You must hash the request parameters using the following hash logic:
Hash logic: sha512(<Body data>
+ '|' + date + '|' + merchant_secret)
Where <Body data>
contains the request body posted with the request.
Sample header code
var merchant_key = 'smsplus';
var merchant_secret = 'izF09TlpX4ZOwmf9MvXijwYsBPUmxYHD';
// date
var date = new Date();
date = date.toUTCString();
// authorization
var authorization = getAuthHeader(date);
function getAuthHeader(date) {
var AUTH_TYPE = 'sha512';
var data = isEmpty(request['data']) ? "" : request['data'];
var hash_string = data + '|' + date + '|' + merchant_secret;
var hash = CryptoJS.SHA512(hash_string).toString(CryptoJS.enc.Hex);
return `hmac username="${merchant_key}", algorithm="${AUTH_TYPE}", headers="date", signature="${hash}"`;
}
Request body
Parameter | Description | Example |
---|---|---|
accountId |
|
MERCHANT123 |
txnId |
|
REF123456 |
paymentMethod |
|
{"name": "EMI", "bankCode": "EMI6"} |
order |
|
|
additionalInfo |
|
|
callBackActions |
|
|
billingDetails |
|
paymentMethod object fields description
Field | Description | Example |
---|---|---|
name |
|
EMI |
bankCode |
|
EMI6 |
paymentCard |
|
paymentCard object fields description
paymentCard object fields
Parameter | Description | Example |
---|---|---|
cardNumbermandatory for physical card |
Card number. | 5497774415170603 |
validThroughmandatory for physical card |
Expiry date in MM/YYYY format. | 05/2025 |
ownerNameoptional |
Name of the card owner. | Ashish |
cvvmandatory for physical card |
CVV number of the card. | 123 |
tavvmandatory for saved card |
Cryptogram of the card for tokenized payments. | AAABAWFlmQAAAABjRWWZEEFgFz |
last4Digitsmandatory for saved card |
Last four digits of the card. | 0603 |
cardTokenTypemandatory for saved card |
Card token type. Valid values: PAYU, NETWORK, ISSUER. | PAYU |
cardTokenmandatory for saved card |
Card token of the stored card. | b5f2d8785768087678fm9 |
order object fields description
order object fields
Parameter | Description | Example |
---|---|---|
productInfomandatory |
Product details. | Product details |
orderedItemoptional |
Details about the items ordered. | Array of Objects |
userDefinedFieldsoptional |
Custom fields for additional information. Fields: udf1, udf2, udf3, udf4, udf5, udf6, udf7, udf8, udf9, udf10. For more information, refer to | Object |
paymentChargeSpecificationmandatory |
Includes amount and charges. For more information, refer to paymentChargeSpecification object fields description | Object |
paymentChargeSpecification object fields description
Parameter | Description | Example |
---|---|---|
pricemandatory |
The transaction amount. | 1000 |
netAmountDebitoptional |
Net amount to be debited. | 1000 |
taxSpecificationoptional |
Tax details of the product/order. | Object |
convenienceFeeoptional |
Fees format (e.g., CC:12). | CC:12 |
offersoptional |
Offers applied or available for the payment. | Object |
userDefinedFields object fields description
Field | Description |
---|---|
udf1 | User defined field. |
udf2 | User defined field. |
udf3 | User defined field. |
udf4 | User defined field. |
udf5 | User defined field. |
udf6 | User defined field. |
udf7 | User defined field. |
udf8 | User defined field. |
udf9 | User defined field. |
udf10 | User defined field. |
additionalInfo object fields description
additionalInfo object fields
Parameter | Description | Example |
---|---|---|
enforcePaymethodoptional |
Use **EMI** for EMI. | |
txnS2sFlow |
|
4 |
createOrder |
|
false |
createOrderoptional |
A flag to store the order details (true/false). | true |
callBackActions object fields description
callBackActions object fields
Parameter | Description | Example |
---|---|---|
successActionmandatory |
URL to be called on payment success. | https://example.com/success |
failureActionmandatory |
URL to be called on payment failure. | https://example.com/failure |
cancelActionmandatory |
URL to be called if user cancels the payment. | https://example.com/cancel |
codActionoptional |
URL for Cash on Delivery (COD) action. | https://example.com/cod |
billingDetails object fields description
billingDetails object fields
Parameter | Description | Example |
---|---|---|
firstNamemandatory |
First name of the billing contact. | Ashish |
lastNameoptional |
Last name of the billing contact. | Kumar |
address1mandatory |
Primary billing address. | 123 Main Street |
address2optional |
Secondary billing address. | Apt 4B |
phoneoptional |
Phone number of the billing contact. | 9123456789 |
emailmandatory |
Email address of the billing contact. | [email protected] |
cityoptional |
City of the billing address. | Bharatpur |
stateoptional |
State of the billing address. | Rajasthan |
countryoptional |
Country of the billing address. | India |
zipCodeoptional |
Postal/Zip code of the billing address. | 321028 |
Sample request
curl --location 'https://apitest.payu.in/v2/payments' \
--header 'date: Thu, 27 Mar 2025 10:12:27 GMT' \
--header 'authorization: hmac username="smsplus", algorithm="sha512", headers="date", signature="ec84843a663143bb89391f6fa2d4b9404bab1543a3eee81263b4a507ebf5d289d8fad1fbcdd59da820951e3e0f9b0b0b3d1bad9b41338804e7c42a8a6197c6e9"' \
--header 'Content-Type: application/json' \
--data-raw '{
"accountId": "smsplus",
"referenceId": "b5f2d8785768087678fn4",
"amount": 10000,
"currency": "INR",
"paymentSource": "WEB",
"paymentMethod": {
"name": "EMI",
"bankCode": "EMI6",
"paymentCard": {
"cardNumber": "5004461234560000",
"validThrough": "04/2025",
"ownerName": "John Doe",
"cvv": "123"
}
},
"order": {
"productInfo": "EMI Payment for Electronics",
"userDefinedFields": {
"udf1": "",
"udf2": "",
"udf3": "",
"udf4": "",
"udf5": "",
"udf6": "",
"udf7": "",
"udf8": "",
"udf9": "",
"udf10": ""
},
"paymentChargeSpecification": {
"price": "10000.00"
}
},
"additionalInfo": {
"txnS2sFlow": "4",
"createOrder": "false"
},
"callBackActions": {
"successAction": "https://yoursite.com/success",
"failureAction": "https://yoursite.com/failure",
"cancelAction": "https://yoursite.com/cancel"
},
"billingDetails": {
"firstName": "John",
"lastName": "Doe",
"phone": "9876543210",
"email": "[email protected]",
"city": "Mumbai",
"state": "Maharashtra",
"country": "India",
"zipCode": "400001"
}
}'
Sample response
{
"referenceId": "b5f2d8785768087678fn4",
"paymentId": "1999110000001769",
"message": "Please call verify api to get the transaction status"
}
Step 2: Verify the payment
Verify the transaction details using the Verification APIs. For API reference, refer to Verify Payment API under API Reference.
TipThe transaction ID that you posted in Step 1 with PayU must be used here.
Updated 5 days ago