Skip to content

Apply Coupon

Apply a discount coupon code to the shopping cart.

Endpoint

POST /api/shop/cart/coupon

Request Headers

HeaderRequiredDescription
Content-TypeYesapplication/json
X-STOREFRONT-KEYYesYour storefront API key

Request Body

json
{
  "couponCode": "SAVE20"
}
FieldTypeRequiredDescription
couponCodestringYesDiscount coupon code

Response Fields (200 OK)

FieldTypeDescription
couponCodestringApplied coupon code
discountAmountdecimalDiscount amount in currency
discountPercentagedecimalDiscount percentage
subtotaldecimalItems subtotal
discountdecimalTotal discount amount
taxdecimalCalculated tax
totaldecimalNew cart total after discount
messagestringSuccess 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

Released under the MIT License.