Skip to main content

Coupons

Validate coupon

POST /access/api/v1/coupons

Validates one or more coupon codes against the current cart and returns the discount amount.

Request body:

{
"coupons": ["SAVE10"],
"cart": [
{
"productId": "69ac75f878a9512e92b56fb5",
"quantity": 1,
"type": "product",
"variationKey": ""
}
]
}

Response:

{
"status": "success",
"data": {
"_id": "69e89e523ffcea9688dcf375",
"code": "SAVE10",
"amount": 10
}
}

Use amount as the discount value to subtract from the order total.

Possible errors:

CodeHTTPWhat to show
COUPON_CODE_REQUIRED400Prompt the user to enter a code
COUPONS_DISABLED403Hide the coupon input entirely
INVALID_COUPON400"This coupon code is not valid or conditions not met"
COUPON_ZERO_TOTAL400"Coupons cannot be applied to a zero-total order"