API Reference

FetchAllClientCoupons

Description

Validate coupon for a client.

Endpoint

POST /coupons/validate

Parameters

  • coupon_details (array of object): coupon details (mandatory)
    • coupon_id (string): coupon id or "bulk" (when using bulk user coupons) (mandatory)
    • coupon_code (string): coupon id (mandatory)
  • source_id (string): source id (optional)
  • order : Order details (optional)
    • original_amount (float64): original amount (mandatory)
    • selling_amount (float64): selling amount (mandatory)
    • status (string): status [pending, completed, reverted] (optional)
    • shipping (float64): shipping (optional)
    • tax (float64): tax (optional)
    • payment_mode (string): payment mode (optional)
    • metadata(object): metadata (optional)
      • key1 (string): meta key 1
      • key2 (float64): meta key 2
    • items (array of object): product items (optional)
      • original_price (float64): original price (mandatory)
      • selling_price (float64): original price (mandatory)
      • product_id (string): product id (mandatory)
      • sku (string): sku (optional)
      • name (string): name (optional)
      • quantity (float64): quantity (optional)
      • metadata(object): metadata (optional)
        • itemkey1 (string): meta key 1
        • itemkey2 (float64): meta key 2

Responses

  • 200 OK

  • 400 Bad Request

    • code (error code): NOT_FOUND_CODE
    • message (error message): Campaign not found details
    • details (error details): Error details
    • request_id (string): Request ID

Security

  • Basic Authentication

Authentication

This endpoint requires Basic Authentication.

  • Username: apiKey
  • Password: apiSecret

Request Body Example

{
  "coupon_details": [{
    "coupon_id": "coupm_rq4XiTPbrhq0d0i92EkSx",
    "coupon_code": "CUP-21"
  }],
  "source_id": "customerA_123",
  "order": {
    "order_id": "order_123",
    "status": "pending",	
    "original_amount": 190,
    "selling_amount": 135.97,
    "shipping": 5.0,
    "tax": 3.47,
    "payment_mode": "UPI",
    "metadata": {
      "created_by": "JohnDoe",
      "created_date": "2023-06-13T10:00:00",
      "source": "Website"
    },
    "items": [
      {
        "product_id": "ABC123",
        "sku": "SKU123",
        "name": "Example Product 1",
        "original_price": 190.99,
        "selling_price": 149.99,
        "quantity": 2,
        "metadata": {
          "color": "blue",
          "size": "L"
        }
      }
    ]
  }
}

 

Rehook Platform API provides resource oriented URLs to work with your business data. Our API uses JSON for request and response. API errors are returned using standard HTTP response codes.

Introduction

Validate coupon API will enable you to validate an applied coupon code for it's redemption or applicability. Your application can consume this API at applicable touch points on your app or web.

On successful API call, Rehook will validate the coupon code and returns with a response body which specifies whether applied coupon code can redeemed or not.

You can consume this API on following cases:

  1. When customer apply the coupon code on cart.
  2. When customer entered the coupon code manually.
  3. When customer modify the cart details after applying the coupon.
  4. or any other check point as per your application purchase journey.

API details

API Endpoint: https://api.rehook.ai/coupons/validate

HTTP Method: POST

Prerequisites

  1. API Key and Secret Key for your application
  2. If you don't know the API key and secret key, please go to setting module on admin panel to view API details for your application. To know more about application setting, please visit Application setting
  3. API key and secret key are auto generated and cannot be changed.

Authentication

You need to provide the API key and Secret of your application in every new request as Authorization. Rehook use Basic authentication method to authenticate the API calls.

AuthorizationValue
UsernameAPI key of your application
PasswordSecret key of your application

Parameters

Query Parameters

This API doesn't requires any query parameters. you have to provide the details in API body.

Body Parameters

Please refer to the complete request body as given below.

{
    "coupon_details": [
        {
            "coupon_id":"coupm_tfKRcTxedjr17FH3m267V",
            "coupon_code":"KS"
        }
    ],
    "source_id":"krish123",
    "order": {
        "order_id": "1223456",
        "status": "pending",
        "original_price_subtotal": 800,
        "selling_price_subtotal": 800,
        "shipping": 100,
        "tax":20,
        "payment_mode": "UPI",
        "metadata": {
            "cart_qty": "4"
        },
        "items": [
            {
                "product_id": "123",
                "sku": "",
                "name":"",
                "original_price": 200,
                "selling_price": 200,
                "quantity": 1,
                "shipping": 0,
                "metadata": {
                    "brand": "brand A",
                    "category": "grocery"
                }
            },
             {
                "product_id": "654",
                "sku": "",
                "name":"",
                "brand": "wrangler",
                "original_price": 200,
                "selling_price": 200,
                "quantity": 2,
                "shipping": 0,
                "metadata": {
                    "brand": "brand B",
                    "category": "vegetables"
                }
            }
        ]
    }
}

Parameters without an object (Optional)

Filed nameData typeDefinitionExample
source_idstringOptional
Unique customer Id from your application
Krishna_123

Order details object (Optional)

Field nameData typeDefinitionExample
order_idstringOptional
Unique transaction Id from your application
rehook12345
original_price_subtotalIntMandatory
Sum of original price of all the items (MRP)
[selling_price * quantity]
500
selling_price_subtotalfloat64Mandatory
Sum of selling price of all the items
[original_price * quantity]
300
statusstringOptional
Status of transaction from your application.
'pending', 'completed', 'reverted'
shippingfloat64Optional
shipping charge at an order
30
taxfloat64Optional
total tax amount applied at an order
20

Item details - Array of object (Optional)

Field nameData typeDefinitionExample
product_idstringRequired
Product identification id from your application
abc_124
skustringOptional
Assigned SKU to a product from your application
124
namestringOptional
name of the product
Coke
original_pricefloat64Required
original price of the product or MRP
100
selling_pricefloat64Required
selling price of the product
80
quantityfloat64Optional
quantity of the product in the cart
2
shippingfloat64mandantory
shipping charge at an item level (value is not mandantory but you have to this field in all the payload)
10

Coupon details object(Mandatory)

Filed nameData typeDefinitionExample
coupon_idstringRequired
coupon id generated by Rehook against fixed coupon distributed. you will get the coupon_id against a coupon code in fetch API response
coupon_123
coupon_codestringRequired
coupon code entered or applied by customer on your application
DIWALI100

Meta data (Optional)

You can provide the meta data in order object or item object using key value pair

meta data key namemeta data value
Key 1value 1
Key 2value 2

Example:

meta data key namemeta data value
brandRehook
categorygrocery

📘

Meta data -limitation

  1. Meta data details are optional in the request body.
  2. If you want to pass any other custom fields in the API payload, then such fields can be passed as key value pairs inside metadata object.
  3. Our system will validate the meta data only if same meta data with key value pair with same data type is created in any campaign on rebook dashboard, otherwise, Rehook API will nullify the meta data provided in the request body.
  4. Meta data object can be passed at order or item level.

Sample request body

Below table shows what details to be shared in the request body in following cases.

CaseSub caseRequest bodyResponse body
Logged in userwithout validation1. source_id or without source_id
2. coupon_details
when source_id is passed: Rehook will validate the source_id with coupon_code or coupon_id and return the validity status with coupon details for it's redemption.
when source_id not passed: Rehook will validate only order and item object with coupon code configuration and return the validity status with coupon details for it's redemption
Logged in userwith cart/item validation1. source_id

2. coupon_details

3. order object with mandatory fields if validation to be done on order object.
Mandatory fields: original_price_subtotal and selling_price_subtotal is mandatory

4. item object with mandatory fields if validation to be done on item object
Mandatory fields: original_price, selling_price, product_id are mandatory

4. pass both cart and item object with mandatory fields if validation to be done on both objects.
Rehook will validate the source_id with
coupon code or coupon_id and perform
validation check on cart or item object and
returns the validity status with coupon details for it's redemption.
Non logged in userwithout validation1. coupon_detailsRehook will validate only coupon coupon code or coupon_id and returns validity status with coupon details for it's redemption.
Non logged in userwith cart/item validation1. coupon_details

2. order object with mandatory fields if validation to be done on order object
Mandatory fields: original_price_subtotal and selling_price_subtotal are mandatory

3. item object with mandatory fields if validation to be done on item object
Mandatory fields: original_price, selling_price, product_id are mandatory

4. pass both cart and item object with mandatory fields if validation to be done on both objects.
Rehook will validate only coupon code or coupon_id and perform validation check on cart or item object and returns validity status with coupon details for it's redemption.

Sample request body and API behaviour details are given below for the above mentioned cases:

Complete payload and response

Complete request body:

{
    "coupon_details": [
        {
            "coupon_id":"coupm_tfKRcTxedjr17FH3m267V",
            "coupon_code":"KS"
        }
    ],
    "source_id":"krish123",
    "order": {
        "order_id": "1223456",
        "status": "pending",
        "original_price_subtotal": 800,
        "selling_price_subtotal": 800,
        "shipping": 100,
        "tax":20,
        "payment_mode": "UPI",
        "metadata": {
            "cart_qty": "4"
        },
        "items": [
            {
                "product_id": "123",
                "sku": "",
                "name":"",
                "original_price": 200,
                "selling_price": 200,
                "quantity": 1,
                "shipping": 0,
                "metadata": {
                    "brand": "brand A",
                    "category": "grocery"
                }
            },
             {
                "product_id": "654",
                "sku": "",
                "name":"",
                "brand": "wrangler",
                "original_price": 200,
                "selling_price": 200,
                "quantity": 2,
                "shipping": 0,
                "metadata": {
                    "brand": "brand B",
                    "category": "vegetables"
                }
            }
        ]
    }
}

📘

API Behaviour:

  • Above payload contains the complete details of API payload for coupon validation
  • For assigned user coupons, passing source_id is mandantory, otherwise system will return error message asking user to login to redeem the coupon code
  • In coupon details object, you have to share either coupon code or coupon id. Rehook will validate the coupon code if any of the fields are correct.
  • Coupon details are mandatory in the validation API call
  • For bulk user coupon - same coupon code can be passed in coupon_code and coupon_id fields.
  • Order object and Item object are optional, please provide the mandatory details of order and item if you want to validate the coupon codes based on cart and item validations.
  • All other parameters in cart validations and product validations is optional.
  • If you don't want to perform any validations on cart to item, then just provide coupon details in the request body with or without source_id based on logged in status.
  • If validation is applied on mandatory parameters and such parameters are not passed in the request body, API will return the validation error messages.
  • If validation is applied on optional parameters and parameters are not passed in the request body, API will not return error, however validation error is only returned when optional parameters are passed.
  • If you want to pass any other custom fields in the API payload, then such fields can be passed as key value pairs inside metadata object.
  • We suggest you to pass the order and item object in all the API calls to avoid fraud coupon redemption.

case 1: Response body with validation is true

{
    "coupon_code": "SELECTED",
    "coupon_code_id": "coupm_5lzR4H2wRja7sVGzZ9HOV",
    "coupon_name": "selected items",
    "coupon_terms_and_conditions": [
        ""
    ],
    "is_applicable": true,
    "coupon_savings": {
        "order": {
            "order_id": "1223456",
            "source_id": "KMN@123",
            "status": "pending",
            "original_price_subtotal": 800,
            "selling_price_subtotal": 800,
            "total_discount": 100,
            "discount_calculated_on_property": "selected_items_selling_price_subtotal",
            "total_amount": 700,
            "total_cashback": 0,
            "shipping": 100,
            "payment_mode": "UPI",
            "coupon_details": {},
            "metadata": {
                "cart_qty": "4"
            },
            "items": [
                {
                    "discount_value": 100,
                    "final_amount": 100,
                    "metadata": {
                        "brand": "brand A",
                        "category": "grocery"
                    },
                    "name": "",
                    "original_price": 200,
                    "product_id": "123",
                    "quantity": 1,
                    "selling_price": 200,
                    "shipping": 0,
                    "sku": ""
                },
                {
                    "brand": "wrangler",
                    "discount_value": 0,
                    "final_amount": 400,
                    "metadata": {
                        "brand": "brand B",
                        "category": "vegetables"
                    },
                    "name": "",
                    "original_price": 200,
                    "product_id": "654",
                    "quantity": 2,
                    "selling_price": 200,
                    "shipping": 0,
                    "sku": ""
                }
            ]
        }
    },
    "request_id": "c1a9dd45-a8b7-97be-a846-def9a0e18ddc"
}

case 2: response body when validation is false

{
    "coupon_code": "WHOLECART",
    "coupon_code_id": "coupm_9ZbJ2ryi4ia2eyz6I7sRc",
    "coupon_name": "WHOLE CART",
    "coupon_terms_and_conditions": [
        ""
    ],
    "is_applicable": false,
    "message": "selling_price_subtotal should be greater than 3000.00",
    "coupon_savings": {
        "order": {
            "order_id": "",
            "source_id": "",
            "status": "",
            "selling_price_subtotal": 0,
            "total_discount": 0,
            "total_amount": 0,
            "total_cashback": 0,
            "shipping": 0,
            "coupon_details": {}
        }
    },
    "request_id": ""
}

sample response fields and definition

FieldsDefinition
coupon_codeFixed coupon code configured on Rehook
coupon_code_idcoupon Id generated against a coupon code
coupon_name[Return]name of the coupon configured on Rehook
coupon_description[Return]description of the coupon
coupon_terms_and_conditions[Return]terms and condition of the coupon. this array will have multiple values.
is_applicable[Return]Indicates if coupon code is applicable or not (values: true/false)
coupon_savings (array of objects)
Order object details
total_amount[Return]selling_price_subtotal - total_discount
total_discount[Return]total_discount to be given for a coupon code
total_cashback[Return]total cashback to be given for a coupon code
discount_calculated_on_property[Return]specifies on which property discount to be applied
(values: selling_price_subtotal, original_price_subtotal, selected_items selling_price_subtotal, selected_items_original_price_subtotal, valid_cart_selling_price_subtotal, valid_cart_original_price_subtotal)
request id[Return]API request id generated by Rehook for your request
Item object details
discount_value[Return]

discount amount to be applied at an item. this value will exists only for selected items or whole cart with exclude items discount.
final_amount[Return]

Net amount of an item = (selling_price * quantity) - discount_value

Discount_calculated_on_property - value and definition

value returneddefinition
selling_price_subtotaldiscount to be applied on selling_price_subtotal
original_price_subtotaldiscount to be applied on original_price_subtotal
shippingdiscount to be applied on shipping amount
selected_items_selling_price_subtotalThis is applicable only in case of selected items discount.
discount to be applied on eligible selected items selling price subtotal , in this case, rehook will return the item level discount_value in eligible item object
selected_items_original_price_subtotalThis is applicable only in case of selected items discount.
discount to be applied on eligible selected items original price subtotal, in this case, rehook will return the item level discount_value in eligible item object
valid_cart_selling_price_subtotalThis is applicable only in case of valid cart selling price subtotal (that means, system will apply discount on whole cart by excluding the specified items).
example: Get 50% discount on whole excluding items from tobaco.
valid_cart_original_price_subtotalsame as above but discount is applied on orginal_price_subtotal of eligible items

When customer is logged in

case 1: Without any validations

{
		"source_id": "101",
		"coupon_details": [{
			"coupon_id": "XYZ",
			"coupon_code": "RVKAC"
		}]
}

📘

API Behaviour:

  • If you want to validate coupon code applicable for a logged in customer without any validation on cart or item, you just need to provide the source_id and coupon details in the API request body.
  • For above payload, Rehook API will validate the coupon code for given source id returns validity status with coupon details for it's redemption.

case 2: With cart or item validations

Refer to complete payload

📘

API Behaviour:

  • If you want to validate coupon code applicable for a logged in customer with additional validation on cart or item, you need to provide the source_id, coupon details and order or item object with mandatory fields in the API request body.
  • With reference to above payload, Rehook will validate the source_id = 101 with coupon code or coupon_id and perform validation check on cart or item object and returns the validity status with coupon details for it's redemption.

For not signed in customers

Case 1: without any validations

{
	"coupon_details": [{
		"coupon_id": "XYZ",
		"coupon_code": "RVKAC"
	}]
}

📘

API Behaviour:

  • If you want to validate the coupon code for a not signed customers, you have to pass only coupon_details in the request body
  • In this case, Rehook API will validate only given coupon code available for your applications without checking any validations on customer/order/Item and returns validity status with coupon details.

Case 2: with order/item validations

Refer to complete payaload without source_id 	

📘

API Behaviour:

  • If you want to validate the coupon code for a not signed customers with cart or item validation while customer is active on your cart page, you have to pass the coupon details and cart or item object without source_id
  • With reference to above payload, Rehook will validate only coupon code and perform additional validation on cart or item object and returns coupon validity status with coupon details for it's redemption.

Discount types:

Whole cart

In whole cart discount type, discount will be applied on whole cart. you can apply discount on following properties with cart or product validations.

  1. Selling_price_subtotal
  2. original_price_subtotal
  3. shipping

Example: Buy min worth of Rs 5000 and Get Flat 30% off on MRP.

Expected payload

{
    "coupon_details": [
        {
            "coupon_id":"coupm_tfKRcTxedjr17FH3m267V",
            "coupon_code":"FLAT50"
        }
    ],
    "source_id":"krish123",
    "order": {
        "order_id": "1223456",
        "status": "pending",
        "original_price_subtotal": 6400,
        "selling_price_subtotal": 6400,
        "shipping": 100,
        "tax":20,
        "payment_mode": "UPI",
        "metadata": {
            "cart_qty": "4"
        },
        "items": [
            {
                "product_id": "123",
                "sku": "",
                "name":"",
                "original_price": 3200,
                "selling_price":3200,
                "quantity": 1,
                "shipping": 0,
                "metadata": {
                    "brand": "brand A",
                    "category": "grocery"
                }
            },
             {
                "product_id": "654",
                "sku": "",
                "name":"",
                "brand": "wrangler",
                "original_price": 3200,
                "selling_price": 3200,
                "quantity": 1,
                "shipping": 0,
                "metadata": {
                    "brand": "brand B",
                    "category": "vegetables"
                }
            }
        ]
    }
}

📘

API Behaviour for above payload

  1. In the payload, you have to pass the item details and order details for discount validations associated with a coupon code
  2. In above example, discount to be applied on whole cart MRP (original_price_subtotal) when customer buys min order worth of Rs 5000 (this validation can be done on MRP or selling price based on configuration)
  3. with above payload, Rehook will first check for discount validation on min order worth of 5000. since MRP or selling_price_subtotal is Rs 6400 which is greater than 5000, coupon validation is true
  4. 30% discount will be applied on original_price_subtotal as per the configuration.
  5. In response, system will return the following keys in the order object
    a. total_discount : discount amount calculated (in this case, it will be 30 % of original_price_subtotal )
    b. total_amount: selling_price_subtotal - total_discount
    c. discount_calculated_on_property : indicates on which property discount to be applied on
  6. When whole cart discount is applied, total discount is returned in the order object. item level discount will not be returned.
  7. In above payload, if order worth is less than 5000, then Rehook will return discount applicability as false

Whole cart excluding

In this type, discount will be applied on whole cart by excluding specified product properties with cart or product validations.

example: Buy products worth Rs 5000 and Get 50% off on whole cart, discount is not applicable for items from tobaco category

expected payload:

{
    "coupon_details": [
        {
            "coupon_id":"coupm_tfKRcTxedjr17FH3m267V",
            "coupon_code":"FLAT50"
        }
    ],
    "source_id":"krish123",
    "order": {
        "order_id": "1223456",
        "status": "pending",
        "original_price_subtotal":9600,
        "selling_price_subtotal":9600,
        "shipping": 100,
        "tax":20,
        "payment_mode": "UPI",
        "metadata": {
            "cart_qty": "4"
        },
        "items": [
            {
                "product_id": "123",
                "sku": "",
                "name":"",
                "original_price": 3200,
                "selling_price":3200,
                "quantity": 2,
                "shipping": 0,
                "metadata": {
                    "brand": "brand A",
                    "category": "grocery"
                }
            },
             {
                "product_id": "654",
                "sku": "",
                "name":"",
                "brand": "wrangler",
                "original_price": 3200,
                "selling_price": 3200,
                "quantity": 1,
                "shipping": 0,
                "metadata": {
                    "brand": "brand B",
                    "category": "tobaco"
                }
            }
        ]
    }
}

📘

API behaviour

  1. In the payload, you have to pass the item details and order details for discount validations associated with a coupon code

  2. In this example, discount will be applied on valid cart subtotal (MPR or selling price based on the configuration). system will not apply discount on products from tobaco category

  3. with above payload, Rehook will first check for discount validation on min order worth of 5000. since MRP or selling_price_subtotal is Rs 6400 which is greater than 5000, discount validation is true

  4. To apply discount, rehook will first calculate the valid cart subtotal (Eligible items selling price or original price * quantity). In above example, only SKU: 123 is considered in the valid cart as SKU: 654 is from tobaco category which is to be excluded.

  5. Hence, valid cart subtotal will be = selling price or orginal price of sku 123 quantity (3200 2) = 6400

  6. Now, 50% discount will be applied on valid cart subtotal

  7. In response, system will return the following keys in the order object.

    a. total_discount : discount amount calculated (in this case, it will be 30 % of original_price_subtotal )
    b. total_amount: selling_price_subtotal - total_discount
    c. discount_calculated_on_property : In this case, value will be valid_cart_selling_price_subtotal or
    valid_cart_original_price_subtotal

  8. In response, system will return the following keys in the item object
    a. discount_value: item level discount amount. this value will exist only for applicable items. excluded
    items will have discount_value as zero. system will first calculate the total discount
    on valid cart, then distribute discount amount at item level based on it's GMV
    b. final_amount: (Selling_price quantity) - discount_value : in above example, final_amount will be
    (3200 * 2 ) - discount_value

Sample response body for above example:

{
    "coupon_code": "EXCLUDE",
    "coupon_code_id": "coupm_0EgJoMmnd2vzbhXAQGsZH",
    "coupon_name": "Exclude items",
    "coupon_terms_and_conditions": [
        ""
    ],
    "is_applicable": true,
    "coupon_savings": {
        "order": {
            "order_id": "1223456",
            "source_id": "KMN@123",
            "status": "pending",
            "original_price_subtotal": 9600,
            "selling_price_subtotal": 9600,
            "total_discount": 3200,
            "discount_calculated_on_property": "valid_cart_selling_price_subtotal",
            "total_amount": 6400,
            "total_cashback": 0,
            "shipping": 100,
            "payment_mode": "UPI",
            "coupon_details": {},
            "metadata": {
                "cart_qty": "4"
            },
            "items": [
                {
                    "discount_value": 3200,
                    "final_amount": 3200,
                    "metadata": {
                        "brand": "brand A",
                        "category": "grocery"
                    },
                    "name": "",
                    "original_price": 3200,
                    "product_id": "123S",
                    "quantity":2,
                    "selling_price": 3200,
                    "shipping": 0,
                    "sku": ""
                },
                {
                    "brand": "brand b",
                    "discount_value": 0,
                    "final_amount": 400,
                    "metadata": {
                        "brand": "brand B",
                        "category": "tobacco"
                    },
                    "name": "",
                    "original_price": 200,
                    "product_id": "654S",
                    "quantity": 2,
                    "selling_price": 200,
                    "shipping": 0,
                    "sku": ""
                }
            ]
        }
    },
    "request_id": "82eb1f97-f5a8-9d9d-b032-0e16a120bd62"
}

Selected items

In this type, discount will be applied on selected items having specified product properties. selected items discount can be configured in following ways:

Conditiondefinitionexamplepayload validation
ANDIn this case, discount will be applied when all the product properties specified are validated as true in the item object.Buy items from jeans category AND brand Levi's and Get 30% offdiscount applicability will be true if item object have all the given product properties
ORIn this case, discount will be applied when either of product properties specified are validated as true in the item object.example: Buy any items from grocery category OR vegetables category and Get 50% off on MRPdiscount applicability will be true if item object have any of the given product properties

Selected items validations:

Rehook supports validations on selected items property

selected items propertyvalidationexample
selected_items_total_qtysystem will check if total quantities of given selected items in the payload are matching as per the conditionGet 50% off on groceries, Buy min 5 qty
selected_items_selling_price_subtotalsystem will check if selling price subtotal of given selected items in the payload are matching as per the conditionBuy worth Rs 2000 of groceries and Get 50%
selected_items_original_price_subtotalsystem will check if original price subtotal of given selected items in the payload are matching as per the conditionBuy worth Rs 3000 of vegetables and Get 40% off
AND condition with multiple propertiessystem will check if all the given conditions are true or notBuy worth Rs 5000, Get 40% off jeans on min purchase of 3 qty

Success Response:

If API call is successful, then Rehook will return the following HTTP success code with response body as given below:

HTTP CodeMessage
200Ok

Error Responses

If API call is failed, then Rehook will return the following HTTP success code with response body as given below:

HTTP CodeMessage
400bad request

error response body

field namedescriptionexample
CodeError code400
detailsError detailsGiven coupon code is wrong
messageerror messagecoupon_code not found
request_idAPI request Id assigned by Rehookabc_123

Below table shows possible list of cases with error messages

CaseError messageActions to take
Wrong source id is passedmessage: invalid_payload
error details: invalid source_id
Mandatory fields are not passed in the order or item object when validation check is applied on such fields or wrong field is passed. Rehook will return coupon code applicability as 'false' with order object message 'invalid payload, original_price_subtotal and selling_price_subtotal is required and should not be 0' in the response body

item object message: product_id is required
coupon is expiredRehook will return coupon applicability as 'false' with message 'coupon is not available at this moment or expired' in response body.
coupon is not available for specific day or timeRehook will return coupon applicability as 'false' with message 'coupon is not available at this moment or expired' in response body.
redemption limit exceededRehook will return coupon applicability as 'false' with message 'coupon code redemption total_limit exceeded' in the response body.
coupon_code or coupon_id is wrongmessage: coupon validation failed

error details: coupon not found, invalid coupon code or coupon id
coupon_id or coupon_code missing in the request bodymessage: coupon validation failed

error details: coupon not found, invalid coupon code or coupon id
User is not logged in and validating assigned user couponmessage: Invalid source_id

error details: please login/signup to redeem the coupon code
API Key or secret key is wrongmessage: Unathourized

error details: appId or app secret invalid
for selected items validation, when validation is not satisfiedmessage: Discount validation is failed, please check terms and condition in the coupon tray'
when selected items none of the product property is not foundmessage: Discount validation is failed, please check terms and condition in the coupon tray'
when Discount validation is failed (in case of product validation )sample message 1: selling_price should be greater than 200
sample message 2: cart_qty should be greater than 10
Language
Credentials
Basic
base64
:
Click Try It! to start a request and see the response here!