POST /cart/coupon
Apply a coupon code to the cart.
Authentication
Optional. Use X-Cart-Token for guest carts.
| Header | Value | Required |
|---|
| X-Cart-Token | Yes (guest) | |
| Content-Type | application/json | Yes |
Body Parameters
| Parameter | Type | Required | Description |
|---|
| coupon | string | Yes | Coupon code to apply |
Example Request
curl -X POST "https://front.rmz.gg/api/cart/coupon" \
-H "Content-Type: application/json" \
-H "X-Cart-Token: cart_abc123" \
-d '{"coupon": "SAVE10"}'
Response
Success (200)
Returns the full cart contents with the discount applied.
{
"success": true,
"data": {
"cart_token": "cart_abc123",
"items": [...],
"count": 2,
"subtotal": 399.98,
"discount_amount": 40.00,
"total": 359.98,
"total_before_tax": 359.98,
"coupon": { ... },
"currency": "SAR",
"tax": {
"enabled": false,
"rate": 0,
"rate_formatted": "0%",
"amount": 0,
"amount_formatted": "0.00 ر.س",
"country_code": null,
"country_name": null
}
},
"message": "Coupon applied successfully"
}
Error Responses
| Status | Description |
|---|
| 400 | Invalid coupon, expired, usage limit reached, minimum order not met, or coupon not applicable to cart items |
| 422 | Validation error (missing coupon code) |
DELETE /cart/coupon
Remove the applied coupon from the cart.
Authentication
Optional. Use X-Cart-Token for guest carts.
| Header | Value | Required |
|---|
| X-Cart-Token | Yes (guest) | |
Example Request
curl -X DELETE "https://front.rmz.gg/api/cart/coupon" \
-H "X-Cart-Token: cart_abc123"
Response
Success (200)
Returns the full cart contents with the discount removed.
{
"success": true,
"data": {
"cart_token": "cart_abc123",
"items": [...],
"count": 2,
"subtotal": 399.98,
"discount_amount": 0,
"total": 399.98,
"total_before_tax": 399.98,
"coupon": null,
"currency": "SAR",
"tax": {
"enabled": false,
"rate": 0,
"rate_formatted": "0%",
"amount": 0,
"amount_formatted": "0.00 ر.س",
"country_code": null,
"country_name": null
}
},
"message": "Coupon removed successfully"
}
Coupons are re-validated at checkout time. If a coupon becomes invalid between cart and checkout (e.g., it expires or reaches its usage limit), the checkout will fail with a message indicating the coupon was removed.