Dynamically validate coupon codes and compute discounts in real-time during customer checkout.
Use this endpoint to validate a promotional discount code against a pending cart or checkout payload. It verifies validity, calculates the discount amount, and returns the updated order values.
https://payapi.zezo.in/api/v1/payments/apply-coupon/{coupon_code}| Parameter | Type | Required | Description |
|---|---|---|---|
coupon_code | string | Required | The promotional code entered by the user (e.g. `WELCOME20`, `SAVE100`). |
| Parameter | Type | Required | Description |
|---|---|---|---|
x-public-key | string | Required | Your Public Key. |
x-secret-key | string | Optional | Your Secret Key. |
Content-Type | string | Required | Payload encoding format. Default: application/json |
| Parameter | Type | Required | Description |
|---|---|---|---|
userId | string | Required | Customer user ID to verify per-user coupon redemption history. |
price | number | Required | Original purchase price before discount. |
currency | string | Optional | ISO 3-letter currency code. Default: INR |
userInfo | object | Optional | Customer information object (`name`, `email`, `phone`). |
curl -X POST "https://payapi.zezo.in/api/v1/payments/apply-coupon/WELCOME20" \
-H "x-public-key: zp_pub_xxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"userId": "usr_9912059abc",
"price": 1000,
"currency": "INR",
"userInfo": {
"name": "Sarah Connor",
"email": "sarah.connor@example.com"
}
}'{
"message": "Coupon applied successfully",
"data": {
"_id": "66d3c812a01b",
"name": "Welcome Discount",
"discount": 20,
"type": "percentage",
"validity": "2026-12-31T23:59:59.000Z",
"originalAmount": 1000,
"discountAmount": 200,
"currency": "INR"
}
}Returned if the coupon code is invalid, expired, or has reached maximum usage limits.
{
"type": "BadRequestError",
"status": 400,
"message": "Invalid coupon code"
}