Skip to main content

POST /cart/coupon

Apply a coupon code to the cart.

Authentication

Optional. Use X-Cart-Token for guest carts.

Headers

HeaderValueRequired
X-Cart-TokenYes (guest)
Content-Typeapplication/jsonYes

Body Parameters

ParameterTypeRequiredDescription
couponstringYesCoupon 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

StatusDescription
400Invalid coupon, expired, usage limit reached, minimum order not met, or coupon not applicable to cart items
422Validation error (missing coupon code)

DELETE /cart/coupon

Remove the applied coupon from the cart.

Authentication

Optional. Use X-Cart-Token for guest carts.

Headers

HeaderValueRequired
X-Cart-TokenYes (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.