Checkout Coupons

Add Coupon to Checkout

POST /checkouts/{checkoutId}/coupons

Request

Adds a coupon code to a checkout.

You can use multiple coupons by using this endpoint to apply one coupon at a time on your storefront. Ensure you enable the Promotion Settings in your control panel to allow for multiple coupons per order.

Required Fields

  • coupon_code

Limits

  • Coupon codes have a 50-character limit.

To prevent lost updates due to concurrent requests overriding changes made by others, it is recommended to enable optimistic concurrency control by including the version field in the request payload. If the provided version does not match the version on the server, a conflict error will be returned, which the client can handle accordingly.

Authentication

  • X-Auth-Token in header

Parameters

  • store_hash in path - string
  • checkoutId in path - string
    required
    ID of the checkout; the same as the cart ID.
  • Accept in header with default of application/json - string
    required
    The MIME type of the response body.
  • Content-Type in header with default of application/json - string
    required
    The MIME type of the request body.

Body

object | application/json
  • coupon_code
    string

    Coupon codes have a 50-character limit.
  • version
    integer

    The cart version that you expect to apply the updates. If the provided version doesn't match the current cart version, you will receive a conflict error. This field is optional; if not provided, optimistic concurrency control will not apply.
    Example: 1

example

Response

Body

object | application/json
  • data
    object

  • meta
    object

    Response metadata.

example

Delete Checkout Coupon

DELETE /checkouts/{checkoutId}/coupons/{couponCode}

Request

Deletes a coupon code from a checkout.

To prevent lost updates due to concurrent requests overriding changes made by others, it is recommended to enable optimistic concurrency control by including the version field in the request payload. If the provided version does not match the version on the server, a conflict error will be returned, which the client can handle accordingly.

Authentication

  • X-Auth-Token in header

Parameters

  • store_hash in path - string
  • checkoutId in path - string
    required
    ID of the checkout; the same as the cart ID.
  • Accept in header with default of application/json - string
    required
    The MIME type of the response body.
  • couponCode in path - string
    required
    The actual coupon code value, not the coupon ID.

Body

object | application/json
  • version
    integer

    The cart version that you expect to apply the updates. If the provided version doesn't match the current cart version, you will receive a conflict error. This field is optional; if not provided, optimistic concurrency control will not apply.
    Example: 1

example

Response

Body

object | application/json
  • data
    object

  • meta
    object

    Response metadata.

example

Did you find what you were looking for?