Skip to content

Add discount code

POST/store/v1/carts/{cart_id}/discount-codes
  • Idempotency-Key supported

Apply a discount code. Unknown codes are refused; codes that don't apply yet stay on the cart with the reason in discount_codes.

Path parameters

  • cart_idstringrequired

    The cart's ID, like cart_01k8qs5s….

Headers

  • X-Cart-Tokenstringrequired

    The cart's token

  • Idempotency-Keystring

    Send the same key to retry safely: the first answer is replayed for 24 hours.

  • shop-api-versionYYYY-MM

    The version to answer in. Without it, your app’s pinned version, else the newest.

Body

  • codestringrequired

Returns

200 The updated cart.

Errors

  • 404not_foundNo such cart.
  • 409A payment is in progress, or the cart is completed.
  • 422validation_failedInvalid code, or too many codes.
  • 429rate_limitedToo many wrong codes from this cart or address: try again later.