The validate_offer API validates the payment request against an offer key. This API doesn’t apply the offer and only validates the request.
Endpoints
Test Environment | <https://sandbox.payu.in/offers/transactions/validate> |
Production Environment | <https://api.payu.in/offers/transactions/validate> |
Request headers
The request header contains the following fields:
The following sample Java code contains the logic used to encrypt as described in the above table:
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import org.apache.commons.codec.binary.Base64;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class HmacAuth {
public static String getSha256(String input) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-256");
byte[] digest = md.digest(input.getBytes());
return Base64.encodeBase64String(digest);
} catch (NoSuchAlgorithmException ignored) {}
return null;
}
public static JsonObject getRequestBody(){
JsonObject requestJson = new JsonObject();
requestJson.addProperty("firstname","John");
requestJson.addProperty("lastname","Doe");
return requestJson;
}
public static void main(String[] args) throws NoSuchAlgorithmException, InvalidKeyException {
String key = "smsplus";
String secret = "admin";
Gson gson = new Gson();
String date = DateTimeFormat.forPattern("EEE, dd MMM yyyy HH:mm:ss 'GMT'").withZoneUTC().print(new DateTime());
System.out.println(date);
JsonObject requestJson = getRequestBody();
String digest = getSha256(gson.toJson(requestJson));
System.out.println(digest);
String signingString = new StringBuilder()
.append("date: " + date)
.append("\ndigest: " + digest).toString();
Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
SecretKeySpec secret_key = new SecretKeySpec(secret.getBytes(), "HmacSHA256");
sha256_HMAC.init(secret_key);
String signature = Base64.encodeBase64String(sha256_HMAC.doFinal(signingString.getBytes()));
String authorization = new StringBuilder()
.append("hmac username=\"")
.append(key)
.append("\", algorithm=\"hmac-sha256\", headers=\"date digest\", signature=\"")
.append(signature)
.append("\"").toString();
System.out.println(authorization);
}
}
The sample header is similar to the following:
Note:
You need to include the current date and time in the Date field of the header.
'Date: Tue, 09 Aug 2022 12:14:51 GMT'
'Digest: omlvf5r6yimCxH+TfScrGryCGslY3CIF50/zIt/AMk4='
'Authorization: hmac username="smsplus", algorithm="hmac-sha256", headers="date digest", signature="PojEYoRaldbjj5NgO+B3c8R1Id4Sefm5mYdFN+MYf2E="'
Request parameters
Parameter | Description | Example |
---|---|---|
amount |
|
10000 |
clientId |
|
8000123 |
mid |
|
7043873219 |
autoApply |
|
false |
merchantNceParamActive |
|
false |
offerKeys |
|
offer@123 |
paymentDetail |
|
{ |
paymentId |
|
|
cardBin |
|
|
category |
|
UPI |
paymentCode |
|
HDFC |
vpa |
|
|
userDetail |
|
|
skuDetail |
JSON` This parameter is in a JSON format. For more information, refer to Description of skusDetail JSON Fields. |
Description of paymentDetail JSON fields
Parameter | Description | Example |
---|---|---|
cardNumber |
|
|
cardToken |
|
1234 4567 2456 3566 |
cardTokenType |
|
1 |
cardHash |
|
|
cardMask |
|
|
category |
|
CREDITCARD |
paymentCode |
|
|
vpa |
|
anything@payu |
Sample paymentDetail JSON
"paymentDetail": {
"cardNumber": 5123**789012346,
"cardToken" : null,
"cardTokenType" : null
"cardHash": "card hash",
"cardMask": "card mask",
"category": "DEBITCARD",
"paymentCode": null,
"vpa": null
}
Description of userDetail JSON Fields
Parameter | Description | Example |
---|---|---|
email |
|
|
phoneNo |
|
8042296254 |
userToken |
|
Sample userDetail JSON
"userDetail": {
"email": "string",
"phoneNo": "string",
"userToken": "useToken123456"
}
Description of skusDetails JSON fields
In addition to the request parameters listed in this section, the skusDetail parameter with skus in an JSON array is posted, where each skus contain the following fields are posted in an array:
Field | Description |
---|---|
autoApply |
The flag to specify to automatically apply the offer. |
skuAmount |
The price of one/ single unit of SKU is specified in this field. |
offerKeys
|
The offer keys to filter at SKU-level is specified in this field. |
quantity
|
The quantity for the product is specified in this field. |
skuId |
The product identifier to select offer is specified in this field. For more information on creating a SKU offer, refer to SKU-Based Offer using Merchant Hosted Checkout. |
Sample skusDetails
"skusDetail": {
"skus": [
{
"skuAmount": 1000,
"autoApply": true,
"offerKeys": [
"SummerSpecialOffer2021@q1Bh0jsogwqP"
],
"quantity": 1,
"skuId": "1"
}
]
}
Sample request and response for normal transactional offers
With autoApply=true
Sample request
{
"amount": 300,
"autoApply": true,
"offerKeys": [],
"paymentDetail": {
"cardNumber": 1234567890123456,
"cardToken": null,
"cardTokenType": null,
"category": "CREDITCARD",
"paymentCode": "CC",
"vpa": null
},
"paymentId": 11111135,
"platformId": 1,
"userDetail": {
"email": "string",
"phoneNo": "string",
"userToken": "sds"
}
}
Sample response
{
"code": "200",
"message": "Offer Validated Successfully",
"status": 1,
"result": {
"flagToFail": false,
"paymentId": 11111135,
"clientId": 42693,
"mid": 180012,
"amount": 300,
"downPaymentAmount": null,
"emiAmount": null,
"paymentCode": "CC",
"category": "CREDITCARD",
"isValid": true,
"offerDiscount": {
"offerKey": "TestOffer@fY6HdoP7da8L",
"offerType": "INSTANT",
"discount": 100.00,
"discountedAmount": 200.00,
"discountType": "ABSOLUTE"
},
"offerDetail": {
"offerId": 66057,
"offerKey": "TestOffer@fY6HdoP7da8L",
"anchorOfferKey": null,
"offerType": "INSTANT",
"offerCategory": null,
"title": "TestOffer",
"description": "offer",
"validFrom": "2024-10-14 00:00:00",
"validTo": "2024-11-30 23:59:00",
"tnc": "tnc",
"tncLink": null,
"discountType": "ABSOLUTE",
"offerPercentage": null,
"maxDiscountPerTxn": 100.00,
"minTxnAmount": 101.00,
"maxTxnAmount": 111111.00,
"minRangeDiscount": null,
"maxRangeDiscount": null,
"status": "ACTIVE",
"isNce": false,
"disallowTransactionInvalidOffer": null,
"isSkuOffer": false,
"isSubventedOffer": false,
"isBaseOffer": false,
"amount": 300,
"discount": 100.00,
"discountedAmount": 200.00,
"isValid": true,
"failureReason": "Offer Validated Successfully",
"recordType": "OFFER",
"isGstSubvented": false,
"isCohortOffer": false,
"isDpEmi": false,
"minDpRange": null,
"maxDpRange": null,
"downPaymentUnit": null,
"issuerId": null,
"issuerName": null
},
"totalDiscountDetail": {
"totalCashbackDiscount": 0,
"totalInstantDiscount": 100.00,
"totalDiscountedAmount": 200.00
},
"offers": [
{
"offerId": 66057,
"offerKey": "TestOffer@fY6HdoP7da8L",
"anchorOfferKey": null,
"offerType": "INSTANT",
"offerCategory": null,
"title": "TestOffer",
"description": "offer",
"validFrom": "2024-10-14 00:00:00",
"validTo": "2024-11-30 23:59:00",
"tnc": "tnc",
"tncLink": null,
"discountType": "ABSOLUTE",
"offerPercentage": null,
"maxDiscountPerTxn": 100.00,
"minTxnAmount": 101.00,
"maxTxnAmount": 111111.00,
"minRangeDiscount": null,
"maxRangeDiscount": null,
"status": "ACTIVE",
"isNce": false,
"disallowTransactionInvalidOffer": null,
"isSkuOffer": false,
"isSubventedOffer": false,
"isBaseOffer": false,
"amount": 300,
"discount": 100.00,
"discountedAmount": 200.00,
"isValid": true,
"failureReason": "Offer Validated Successfully",
"recordType": "OFFER",
"isGstSubvented": false,
"isCohortOffer": false,
"isDpEmi": false,
"minDpRange": null,
"maxDpRange": null,
"downPaymentUnit": null,
"issuerId": null,
"issuerName": null
}
],
"skusDetail": null,
"failureReason": "Offer Validated Successfully",
"failureReasonsBreakup": [
{
"offerKey": "title@xsSMQwiE5wcq",
"failureCode": "ERR6014"
}
],
"autoApply": true,
"isSkuOffer": false
},
"traceId": "59bd685f-2923-459c-ab06-5edaf8e0ee50"
}
With autoApply=false
Sample request
{
"amount": 300,
"autoApply": false,
"offerKeys": ["TestOffer@fY6HdoP7da8L"],
"paymentDetail": {
"cardNumber": 1234567890123456,
"cardToken": null,
"cardTokenType": null,
"category": "CREDITCARD",
"paymentCode": "CC",
"vpa": null
},
"paymentId": 11111135,
"platformId": 1,
"userDetail": {
"email": "string",
"phoneNo": "string",
"userToken": "sds"
}
}
Sample response
{
"code": "200",
"message": "Offer Validated Successfully",
"status": 1,
"result": {
"flagToFail": false,
"paymentId": 11111135,
"clientId": 42693,
"mid": 180012,
"amount": 300,
"downPaymentAmount": null,
"emiAmount": null,
"paymentCode": "CC",
"category": "CREDITCARD",
"isValid": true,
"offerDiscount": {
"offerKey": "TestOffer@fY6HdoP7da8L",
"offerType": "INSTANT",
"discount": 100.00,
"discountedAmount": 200.00,
"discountType": "ABSOLUTE"
},
"offerDetail": {
"offerId": 66057,
"offerKey": "TestOffer@fY6HdoP7da8L",
"anchorOfferKey": null,
"offerType": "INSTANT",
"offerCategory": null,
"title": "TestOffer",
"description": "offer",
"validFrom": "2024-10-14 00:00:00",
"validTo": "2024-11-30 23:59:00",
"tnc": "tnc",
"tncLink": null,
"discountType": "ABSOLUTE",
"offerPercentage": null,
"maxDiscountPerTxn": 100.00,
"minTxnAmount": 101.00,
"maxTxnAmount": 111111.00,
"minRangeDiscount": null,
"maxRangeDiscount": null,
"status": "ACTIVE",
"isNce": false,
"disallowTransactionInvalidOffer": null,
"isSkuOffer": false,
"isSubventedOffer": false,
"isBaseOffer": false,
"amount": 300,
"discount": 100.00,
"discountedAmount": 200.00,
"isValid": true,
"failureReason": "Offer Validated Successfully",
"recordType": "OFFER",
"isGstSubvented": false,
"isCohortOffer": false,
"isDpEmi": false,
"minDpRange": null,
"maxDpRange": null,
"downPaymentUnit": null,
"issuerId": null,
"issuerName": null
},
"totalDiscountDetail": {
"totalCashbackDiscount": 0,
"totalInstantDiscount": 100.00,
"totalDiscountedAmount": 200.00
},
"offers": [
{
"offerId": 66057,
"offerKey": "TestOffer@fY6HdoP7da8L",
"anchorOfferKey": null,
"offerType": "INSTANT",
"offerCategory": null,
"title": "TestOffer",
"description": "offer",
"validFrom": "2024-10-14 00:00:00",
"validTo": "2024-11-30 23:59:00",
"tnc": "tnc",
"tncLink": null,
"discountType": "ABSOLUTE",
"offerPercentage": null,
"maxDiscountPerTxn": 100.00,
"minTxnAmount": 101.00,
"maxTxnAmount": 111111.00,
"minRangeDiscount": null,
"maxRangeDiscount": null,
"status": "ACTIVE",
"isNce": false,
"disallowTransactionInvalidOffer": null,
"isSkuOffer": false,
"isSubventedOffer": false,
"isBaseOffer": false,
"amount": 300,
"discount": 100.00,
"discountedAmount": 200.00,
"isValid": true,
"failureReason": "Offer Validated Successfully",
"recordType": "OFFER",
"isGstSubvented": false,
"isCohortOffer": false,
"isDpEmi": false,
"minDpRange": null,
"maxDpRange": null,
"downPaymentUnit": null,
"issuerId": null,
"issuerName": null
}
],
"skusDetail": null,
"failureReason": "Offer Validated Successfully",
"failureReasonsBreakup": [],
"autoApply": false,
"isSkuOffer": false
},
"traceId": "9bfb1312-d154-4160-acc6-415b0c78c974"
}
Failure scenarios
- Merchant ID does not exists
{
"code": "404",
"message": "Merchant with merchant Id :1800122 does not exists",
"status": 0,
"exceptionId": "9cf201ab-2ad3-439e-a7a6-f707d2f76e48"
}
- Client ID does not exist or not matching with platform ID
{
"code": "404",
"message": "client with clientId :4 , platformId :12 does not exists.",
"status": 0,
"exceptionId": "6985749b-9de4-4d39-9242-d19d35a82d0c"
}
- Service Unavailable
{
"code": "500",
"message": "Service Unavailable",
"status": 0,
"exceptionId": "65466805-5be1-4fa4-912d-d28cf620d687"
}
Sample request and response for SKU-based offers
With autoApply=true
Sample request
{
"amount": 300,
"autoApply": false,
"offerKeys": [],
"paymentDetail": {
"cardNumber": 1234567890123456,
"cardToken": null,
"cardTokenType": null,
"category": "CREDITCARD",
"paymentCode": "CC",
"vpa": null
},
"paymentId": 11111135,
"platformId": 1,
"userDetail": {
"email": "string",
"phoneNo": "string",
"userToken": "sds"
},
"skusDetail": {
"skus": [
{
"skuCategory": "sku_only",
"skuAmount": 300,
"quantity": 1,
"autoApply": true,
"skuId": "sampleProductId",
"offerKeys": []
}
]
}
}
Sample response
{
"code": "200",
"message": "Offer Validated Successfully",
"status": 1,
"result": {
"flagToFail": false,
"paymentId": 11111135,
"clientId": 42693,
"mid": 180012,
"amount": null,
"downPaymentAmount": null,
"emiAmount": null,
"paymentCode": "CC",
"category": "CREDITCARD",
"isValid": false,
"offerDiscount": null,
"offerDetail": null,
"totalDiscountDetail": null,
"offers": null,
"skusDetail": {
"skusDiscountDetail": {
"totalCashbackDiscount": 0,
"totalInstantDiscount": 50.00,
"totalDiscountedAmount": 250.00
},
"skus": [
{
"skuId": "sampleProductId",
"skuCategory": "sku_only",
"skuName": "sampleProductName",
"quantity": 1,
"skuAmount": 300,
"isValid": true,
"discountDetail": {
"offerKey": "hellosku@rFTxczzbDmj6",
"offerType": "INSTANT",
"discount": 50.00,
"discountedAmount": 250.00,
"discountType": "ABSOLUTE"
},
"skuTotalDiscountDetail": {
"totalCashbackDiscount": 0,
"totalInstantDiscount": 50.00,
"totalDiscountedAmount": 250.00
},
"offerDetail": {
"offerId": 66067,
"offerKey": "hellosku@rFTxczzbDmj6",
"anchorOfferKey": null,
"offerType": "INSTANT",
"offerCategory": null,
"title": "hello sku",
"description": "qwe4",
"validFrom": "2024-10-15 00:00:00",
"validTo": "2024-10-16 23:59:59",
"tnc": "123e",
"tncLink": null,
"discountType": "ABSOLUTE",
"offerPercentage": null,
"maxDiscountPerTxn": 50.00,
"minTxnAmount": 11.00,
"maxTxnAmount": 1000000.00,
"minRangeDiscount": null,
"maxRangeDiscount": null,
"status": "ACTIVE",
"isNce": false,
"disallowTransactionInvalidOffer": null,
"isSkuOffer": true,
"isSubventedOffer": false,
"isBaseOffer": false,
"amount": 300,
"discount": 50.00,
"discountedAmount": 250.00,
"isValid": true,
"failureReason": "Offer Validated Successfully",
"recordType": "OFFER",
"isGstSubvented": false,
"isCohortOffer": false,
"isDpEmi": false,
"minDpRange": null,
"maxDpRange": null,
"downPaymentUnit": null,
"issuerId": null,
"issuerName": null
},
"offers": [
{
"offerId": 66067,
"offerKey": "hellosku@rFTxczzbDmj6",
"anchorOfferKey": null,
"offerType": "INSTANT",
"offerCategory": null,
"title": "hello sku",
"description": "qwe4",
"validFrom": "2024-10-15 00:00:00",
"validTo": "2024-10-16 23:59:59",
"tnc": "123e",
"tncLink": null,
"discountType": "ABSOLUTE",
"offerPercentage": null,
"maxDiscountPerTxn": 50.00,
"minTxnAmount": 11.00,
"maxTxnAmount": 1000000.00,
"minRangeDiscount": null,
"maxRangeDiscount": null,
"status": "ACTIVE",
"isNce": false,
"disallowTransactionInvalidOffer": null,
"isSkuOffer": true,
"isSubventedOffer": false,
"isBaseOffer": false,
"amount": 300,
"discount": 50.00,
"discountedAmount": 250.00,
"isValid": true,
"failureReason": "Offer Validated Successfully",
"recordType": "OFFER",
"isGstSubvented": false,
"isCohortOffer": false,
"isDpEmi": false,
"minDpRange": null,
"maxDpRange": null,
"downPaymentUnit": null,
"issuerId": null,
"issuerName": null
}
],
"statusMessage": "Offer Validated Successfully",
"autoApply": true
}
]
},
"failureReason": null,
"failureReasonsBreakup": [],
"autoApply": false,
"isSkuOffer": false
},
"traceId": "d2851fa2-cf37-4669-b316-41b7143282f4"
}
With autoApply=false
Sample request
{
"amount": 300,
"autoApply": false,
"offerKeys": [],
"paymentDetail": {
"cardNumber": 1234567890123456,
"cardToken": null,
"cardTokenType": null,
"category": "CREDITCARD",
"paymentCode": "CC",
"vpa": null
},
"paymentId": 11111135,
"platformId": 1,
"userDetail": {
"email": "string",
"phoneNo": "string",
"userToken": "sds"
},
"skusDetail": {
"skus": [
{
"skuCategory": "sku_only",
"skuAmount": 300,
"quantity": 1,
"autoApply": false,
"skuId": "sampleProductId",
"offerKeys": [
"hellosku@rFTxczzbDmj6"
]
}
]
}
}
Sample response
{
"code": "200",
"message": "Offer Validated Successfully",
"status": 1,
"result": {
"flagToFail": false,
"paymentId": 11111135,
"clientId": 42693,
"mid": 180012,
"amount": null,
"downPaymentAmount": null,
"emiAmount": null,
"paymentCode": "CC",
"category": "CREDITCARD",
"isValid": false,
"offerDiscount": null,
"offerDetail": null,
"totalDiscountDetail": null,
"offers": null,
"skusDetail": {
"skusDiscountDetail": {
"totalCashbackDiscount": 0,
"totalInstantDiscount": 50.00,
"totalDiscountedAmount": 250.00
},
"skus": [
{
"skuId": "sampleProductId",
"skuCategory": "sku_only",
"skuName": "sampleProductName",
"quantity": 1,
"skuAmount": 300,
"isValid": true,
"discountDetail": {
"offerKey": "hellosku@rFTxczzbDmj6",
"offerType": "INSTANT",
"discount": 50.00,
"discountedAmount": 250.00,
"discountType": "ABSOLUTE"
},
"skuTotalDiscountDetail": {
"totalCashbackDiscount": 0,
"totalInstantDiscount": 50.00,
"totalDiscountedAmount": 250.00
},
"offerDetail": {
"offerId": 66067,
"offerKey": "hellosku@rFTxczzbDmj6",
"anchorOfferKey": null,
"offerType": "INSTANT",
"offerCategory": null,
"title": "hello sku",
"description": "qwe4",
"validFrom": "2024-10-15 00:00:00",
"validTo": "2024-10-16 23:59:59",
"tnc": "123e",
"tncLink": null,
"discountType": "ABSOLUTE",
"offerPercentage": null,
"maxDiscountPerTxn": 50.00,
"minTxnAmount": 11.00,
"maxTxnAmount": 1000000.00,
"minRangeDiscount": null,
"maxRangeDiscount": null,
"status": "ACTIVE",
"isNce": false,
"disallowTransactionInvalidOffer": null,
"isSkuOffer": true,
"isSubventedOffer": false,
"isBaseOffer": false,
"amount": 300,
"discount": 50.00,
"discountedAmount": 250.00,
"isValid": true,
"failureReason": "Offer Validated Successfully",
"recordType": "OFFER",
"isGstSubvented": false,
"isCohortOffer": false,
"isDpEmi": false,
"minDpRange": null,
"maxDpRange": null,
"downPaymentUnit": null,
"issuerId": null,
"issuerName": null
},
"offers": [
{
"offerId": 66067,
"offerKey": "hellosku@rFTxczzbDmj6",
"anchorOfferKey": null,
"offerType": "INSTANT",
"offerCategory": null,
"title": "hello sku",
"description": "qwe4",
"validFrom": "2024-10-15 00:00:00",
"validTo": "2024-10-16 23:59:59",
"tnc": "123e",
"tncLink": null,
"discountType": "ABSOLUTE",
"offerPercentage": null,
"maxDiscountPerTxn": 50.00,
"minTxnAmount": 11.00,
"maxTxnAmount": 1000000.00,
"minRangeDiscount": null,
"maxRangeDiscount": null,
"status": "ACTIVE",
"isNce": false,
"disallowTransactionInvalidOffer": null,
"isSkuOffer": true,
"isSubventedOffer": false,
"isBaseOffer": false,
"amount": 300,
"discount": 50.00,
"discountedAmount": 250.00,
"isValid": true,
"failureReason": "Offer Validated Successfully",
"recordType": "OFFER",
"isGstSubvented": false,
"isCohortOffer": false,
"isDpEmi": false,
"minDpRange": null,
"maxDpRange": null,
"downPaymentUnit": null,
"issuerId": null,
"issuerName": null
}
],
"statusMessage": "Offer Validated Successfully",
"autoApply": false
}
]
},
"failureReason": null,
"failureReasonsBreakup": [],
"autoApply": false,
"isSkuOffer": false
},
"traceId": "c80dde13-cfcb-473a-b200-b3be788ac7f2"
}
Failure scenarios
- Merchant ID does not exists
{
"code": "404",
"message": "Merchant with merchant Id :1800122 does not exists",
"status": 0,
"exceptionId": "9cf201ab-2ad3-439e-a7a6-f707d2f76e48"
}
- Client ID does not exist or not matching with platform ID
{
"code": "404",
"message": "client with clientId :4 , platformId :12 does not exists.",
"status": 0,
"exceptionId": "6985749b-9de4-4d39-9242-d19d35a82d0c"
}
- Service Unavailable
{
"code": "500",
"message": "Service Unavailable",
"status": 0,
"exceptionId": "65466805-5be1-4fa4-912d-d28cf620d687"
}
- Invalid request
{
"code": "400",
"message": "Invalid Request",
"status": 0,
"exceptionId": "252e1602-2a9a-449a-8f17-f55fe1f0949a"
}
- Offer key is mandatory when autoApply=false
{
"code": "400",
"message": "Offer key is mandatory when offer is not auto applied",
"status": 0,
"exceptionId": "0e2012e76b4347f48d58808bf3c39122",
"traceId": "4baa1329-b3c5-479c-b98e-b3f2a99f0158"
}
Sample request with Using a saved card
curl --location --request POST 'https://sandbox.payu.in/offers/transactions/validate' \
--header 'Date: Tue, 09 Aug 2022 12:14:51 GMT' \
--header 'Digest: omlvf5r6yimCxH+TfScrGryCGslY3CIF50/zIt/AMk4=' \
--header 'Authorization: hmac username="smsplus", algorithm="hmac-sha256", headers="date digest", signature="PojEYoRaldbjj5NgO+B3c8R1Id4Sefm5mYdFN+MYf2E="' \
--header 'Content-Type: application/json' \
--header 'Cookie: PHPSESSID=fucavghe82bnd1baej5mdgmaem' \
--data-raw '{
{
"amount": 500,
"offerKeys": [
"SummerSpecialOffer2021@07qIdabo1AHl"
],
"paymentDetail": {
"cardToken": 1234 4567 2456 3566,
"cardTokenType": 1,
"cardHash": "card hash",
"cardMask": "card mask",
"category": "DEBITCARD",
"paymentCode": null,
"vpa": null,
},
"paymentId": 2500,
"userDetail": {
"email": "string",
"phoneNo": "string",
"userToken": "userToken"
}
}
}'
Response parameters
The response involves the following parameters and the result parameter contains the offer results:
result parameter JSON Details
The result parameter contains the result in a JSON format and the fields in the JSON are described in the following table. The offerDiscount and offerDetail fields in this JSON contains the offer details as described in the following subsections:
This field contains any of the following values to specify whether the offer is valid or not valid:
Field | Description | Example |
---|---|---|
paymentid |
|
2500 |
clientId |
|
1 |
mid |
|
1 |
amount |
|
10000.00 |
paymentcode |
|
HDFC |
category |
|
creditcard |
isValid |
This field contains any of the following values to specify whether the offer is valid or not valid:
|
true |
offerDiscount |
|
Refer to the offerDiscount Field JSON Details subsection. |
offerDetail |
|
Refer to the offerDetail Field JSON Details subsection. |
failureReason |
|
"Success" |
skusDetail |
|
|
The sample value for result parameter in a JSON is similar to the following:
"result": {
"paymentId": 2500,
"clientId": 1,
"mid": 1,
"amount": 500,
"paymentCode": null,
"category": "DEBITCARD",
"isValid": true,
"offerDiscount": {
"offerKey": "SummerSpecialOffer2021@07qIdabo1AHl",
"offerType": "INSTANT",
"discount": 100.00,
"discountedAmount": 400.00,
"discountType": "ABSOLUTE"
},
"offerDetail": {
"offerId": 10005,
"offerKey": "SummerSpecialOffer2021@07qIdabo1AHl",
"offerType": "INSTANT",
"title": "SummerSpecialOffer",
"description": "SummerSpecialOffer discount",
"validFrom": "2021-07-01 17:02:11",
"validTo": "2022-08-05 15:53:16",
"tnc": "abc",
"tncLink": "abcd",
"discountType": "ABSOLUTE",
"offerPercentage": null,
"maxDiscountPerTxn": 100.00,
"minTxnAmount": 10.00,
"maxTxnAmount": 25000.00,
"status": "ACTIVE",
"isNce": false,
"disallowTransactionInvalidOffer":true
},
"failureReason": "Success"
}
offerDiscount Field JSON Details
The offerDiscount field in the result JSON contains the offer discount details in a JSON format as described in the following table:
Field | Description | Example |
---|---|---|
offerKey |
|
SummerSpecialOffer2021@q1Bh0jsogwqP |
offerType |
|
INSTANT |
discount |
This field contains the total discount available on the transaction once applied the specific offer. |
100.00 |
discountedAmount |
This field contains the final Net amount of the transaction after applying the specific offer. |
400.00 |
discountType |
This field contains any of the following discount type that were defined:
|
ABSOLUTE |
The sample value for offerDiscount field in a JSON is similar to the following:
"offerDiscount": {
"offerKey": "SummerSpecialOffer2021@07qIdabo1AHl",
"offerType": "INSTANT",
"discount": 100.00,
"discountedAmount": 400.00,
"discountType": "ABSOLUTE"
},
offerDetail Field JSON Details
The offerDetail field in the result JSON contains the offer details in a JSON format as described in the following table:
Field | Description | Example |
---|---|---|
offerId |
|
10005 |
offerKey |
|
SummerSpecialOffer2021@q1Bh0jsogwqP |
anchorOfferKey |
|
|
offerType |
|
MERCHANT |
title |
|
festive_500 |
description |
|
festive discount |
validFrom |
|
2021-07-01 17:02:11 |
validTo |
|
2022-08-05 15:53:16 |
tnc |
|
abc |
tncLink |
|
abcd |
discountType |
|
ABSOLUTE |
offerPercentage |
|
10 |
maxDiscountPerTxn |
|
100.00 |
minTxnAmount |
|
10.00 |
maxTxnAmount |
|
25000.00 |
status |
|
ACTIVE |
isNce |
|
|
disallowTransactionI |
|
true |
isSkuOffer |
|
true |
isSubventedOffer |
|
false |
isBaseOffer |
|
false |
amount |
|
300 |
discount |
|
|
discountedAmount |
|
true |
isValid |
|
|
failureReason |
|
Offer Validated Successfully |
recordType |
|
OFFER |
isGstSubvented |
|
false |
isCohortOffer |
|
false |
isDpEmi |
|
false |
minDpRange |
|
|
maxDpRange |
|
|
downPaymentUnit |
|
|
issuerId |
|
|
issuerName |
|
The sample value for offerDetail field in a JSON is similar to the following:
"offerDetail" {
"offerId": 66057,
"offerKey": "TestOffer@fY6HdoP7da8L",
"anchorOfferKey": null,
"offerType": "INSTANT",
"offerCategory": null,
"title": "TestOffer",
"description": "offer",
"validFrom": "2024-10-14 00:00:00",
"validTo": "2024-11-30 23:59:00",
"tnc": "tnc",
"tncLink": null,
"discountType": "ABSOLUTE",
"offerPercentage": null,
"maxDiscountPerTxn": 100.00,
"minTxnAmount": 101.00,
"maxTxnAmount": 111111.00,
"minRangeDiscount": null,
"maxRangeDiscount": null,
"status": "ACTIVE",
"isNce": false,
"disallowTransactionInvalidOffer": null,
"isSkuOffer": false,
"isSubventedOffer": false,
"isBaseOffer": false,
"amount": 300,
"discount": 100.00,
"discountedAmount": 200.00,
"isValid": true,
"failureReason": "Offer Validated Successfully",
"recordType": "OFFER",
"isGstSubvented": false,
"isCohortOffer": false,
"isDpEmi": false,
"minDpRange": null,
"maxDpRange": null,
"downPaymentUnit": null,
"issuerId": null,
"issuerName": null
}
skusDetail Parameter Description
In addition to the request parameters listed in the Fetch Offers API section, the skusDetail parameter is posted with the following fields are posted in an array:
Field | Description |
---|---|
skuAmount |
|
skuId |
|
quantity
|
|
offerKeys |
|