Check coupon code validity
const url = 'https://api.example.com/cms/customer/coupon/check_code?code=example';const options = {method: 'GET', headers: {'API-Key': '<API-Key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”Responses
Section titled “Responses”Check result
object
API representation of a coupon
object
Coupon ID
Coupon code
Value
Type
Expiry date
Whether the coupon has expired
Stock remaining
Whether the coupon has been used
Date the coupon was used
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
When restricted is 2: the customer needs an active subscription in one of these groups (empty = any group)
Whether each customer can use this coupon only once
Campaign
User ID this coupon is restricted to
Client ID this coupon is restricted to
Status
Pricing tier (product item) this coupon applies to
API representation of an ecommerce pricing tier (product item)
object
Item ID
Description
Product ID
Product name
Price
The price it sells at today: its timed offer’s price while one runs, otherwise price
Currency
Available
Item order
Shippable
Weight
Installments
Once per user
Is upgrade
Upgrade type
Upgrade from
Upgrade exclude items
Upgrade price web
Upgrade price mobile
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
object
object
Has image
Additional label 1
Additional label 2
Additional label 3
Diameter
Length
Depth
Width
Recurrent
Recurrent price
Recurrent start
Recurrent schedule
SKU
Stock enabled
Stock available
Whether orders are accepted when out of stock
Package quantity
Related items
object
Images (attachments)
object
High resolution URL
Video (only for video attachments)
object
Duration (only when present in metadata)
Files (attachments)
object
Duration (only when present in metadata)
Product details. Deprecated to avoid circular references. Use productId instead.
object
Translations
Action data to be executed when a pricing tier is bought
object
Action data to be executed when a pricing tier is bought as a renewal
object
Pricing tier, product or category this coupon is restricted to
object
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