Apply Coupon
Apply a discount coupon code to the shopping cart.
Endpoint
POST /api/shop/cart/couponRequest Headers
| Header | Required | Description |
|---|---|---|
Content-Type | Yes | application/json |
X-STOREFRONT-KEY | Yes | Your storefront API key |
Request Body
json
{
"couponCode": "SAVE20"
}| Field | Type | Required | Description |
|---|---|---|---|
couponCode | string | Yes | Discount coupon code |
Response Fields (200 OK)
| Field | Type | Description |
|---|---|---|
couponCode | string | Applied coupon code |
discountAmount | decimal | Discount amount in currency |
discountPercentage | decimal | Discount percentage |
subtotal | decimal | Items subtotal |
discount | decimal | Total discount amount |
tax | decimal | Calculated tax |
total | decimal | New cart total after discount |
message | string | Success message |
Validation
- Coupon code must exist and be active
- Coupon must not be expired
- Cart must meet minimum purchase requirement (if any)
- Coupon may have usage limits or customer restrictions
- Only one coupon per cart (typically)
Use Cases
- Apply promotional discount codes
- Enable customer discount redemption
- Support seasonal promotions
- Apply gift cards or vouchers
- Implement loyalty program discounts
Notes
- Discount is calculated in real-time
- Tax may be recalculated based on new total
- Invalid coupons return error without modifying cart
- Coupon can be removed separately

