Skip to content

Check coupon code validity

GET
/cms/customer/coupon/check_code
curl --request GET \
--url 'https://api.example.com/cms/customer/coupon/check_code?code=example' \
--header 'API-Key: <API-Key>'

Whether the coupon can be used now: in stock, not expired, and for the customer the request is authenticated as (optional: send their token). A coupon for subscribers only (restricted 2) needs a customer with an active subscription, in one of its subscription groups if it has any; one for non-subscribers (restricted 1) refuses a customer with one. A subscription is active until its next renewal date, whatever its status. A coupon restricted to a customer or once per customer needs the customer too.

code
required
string

Check result

Media typeapplication/json
object
coupon_id
integer
coupon
Coupon

API representation of a coupon

object
id

Coupon ID

code

Coupon code

string
value

Value

type

Type

string
Allowed values: percent flat
expiry

Expiry date

string format: date-time
expired

Whether the coupon has expired

boolean
stock

Stock remaining

integer
used

Whether the coupon has been used

integer
usedOn

Date the coupon was used

string format: date-time
restricted

Availability: 0 = all customers, 1 = customers without an active subscription, 2 = customers with an active subscription. A subscription is active until its next renewal date, whatever its status (one cancelled but still within its paid period counts, an overdue one doesn’t), as for the paywall. 1 and 2 are checked against the customer the request is authenticated as; 2 is refused when there is none

integer
Allowed values: 0 1 2
subscription_groups

When restricted is 2: the customer needs an active subscription in one of these groups (empty = any group)

Array<string>
oncePerUser

Whether each customer can use this coupon only once

integer
Allowed values: 0 1
campaign

Campaign

string
nullable
userId

User ID this coupon is restricted to

nullable
clientId

Client ID this coupon is restricted to

nullable
status

Status

string
product_item

Pricing tier (product item) this coupon applies to

nullable
One of:
Pricing Tier

API representation of an ecommerce pricing tier (product item)

object
id

Item ID

description

Description

string
productId

Product ID

product

Product name

string
price

Price

sale_price

The price it sells at today: its timed offer’s price while one runs, otherwise price

currency

Currency

string
available

Available

item_order

Item order

shippable

Shippable

weight

Weight

installments

Installments

oncePerUser

Once per user

isUpgrade

Is upgrade

upgradeType

Upgrade type

string
nullable
upgradeFrom

Upgrade from

string
upgradeExcludeItems

Upgrade exclude items

string
nullable
upgradePriceWeb

Upgrade price web

upgradePriceMobile

Upgrade price mobile

settings

Field values, keyed by field key (each {name, value, type}), e.g. {“size”: {“name”: “Size”, “value”: “large”, “type”: “list”}}: the same keys the product search takes in settings; an empty array when there are none

One of:
object
key
additional properties
object
name
string
value
string
type
string
hasImage

Has image

additional_label_1

Additional label 1

string
nullable
additional_label_2

Additional label 2

string
nullable
additional_label_3

Additional label 3

string
nullable
diameter

Diameter

length

Length

depth

Depth

width

Width

recurrent

Recurrent

recurrentPrice

Recurrent price

recurrentStart

Recurrent start

string
recurrentSchedule

Recurrent schedule

string
sku

SKU

string
prices

Prices per currency code, or an empty array when none

One of:
object
key
additional properties
object
price
One of:
string
recurrentPrice
One of:
string
stock_enabled

Stock enabled

stock_available

Stock available

allow_backorder

Whether orders are accepted when out of stock

packageQuantity

Package quantity

relatedItems

Related items

Array<object>
object
images

Images (attachments)

Array<object>
object
id
string
name
string
description
string
url

High resolution URL

string
url_original
string
url_thumbnail
string
focal
string
image_width
integer
nullable
image_height
integer
nullable
video

Video (only for video attachments)

object
type
string
duration

Duration (only when present in metadata)

integer
files

Files (attachments)

Array<object>
object
id
string
name
string
description
string
url
string
type
string
duration

Duration (only when present in metadata)

integer
product_details

Product details. Deprecated to avoid circular references. Use productId instead.

object
translations

Translations

action_data

Action data to be executed when a pricing tier is bought

Array<object>
nullable
object
function
string
param
string
group
string
action_data_renew

Action data to be executed when a pricing tier is bought as a renewal

Array<object>
nullable
object
function
string
param
string
group
string
applies_to

Pricing tier, product or category this coupon is restricted to

object
type
string
Allowed values: tier product category
id
integer format: int64
name
string

Example

{
"coupon": {
"type": "percent",
"restricted": 0,
"oncePerUser": 0,
"product_item": {
"prices": {
"ZAR": {
"price": "1",
"recurrentPrice": "1"
}
},
"images": [
{
"id": "4",
"name": "watermarked",
"focal": "50% 50%",
"image_width": 654,
"image_height": 529,
"type": "image"
}
],
"files": [
{
"id": "5",
"type": "file"
}
],
"translations": {
"en": {
"description": "Description text",
"label1": "Label 1",
"label2": "Label 2",
"label3": "Label 3"
}
},
"action_data": [
{
"function": "registerSubscription",
"param": "365",
"group": "subscription"
}
],
"action_data_renew": [
{
"function": "registerSubscription",
"param": "365",
"group": "subscription"
}
]
},
"applies_to": {
"type": "tier"
}
}
}

Invalid code