Preview what a coupon is worth on a basket
curl --request POST \
--url https://my.server.express/api/v1/client/coupons/validate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"planId": "<string>",
"quantity": 5,
"addonIds": [
"<string>"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({code: '<string>', planId: '<string>', quantity: 5, addonIds: ['<string>']})
};
fetch('https://my.server.express/api/v1/client/coupons/validate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://my.server.express/api/v1/client/coupons/validate"
payload = {
"code": "<string>",
"planId": "<string>",
"quantity": 5,
"addonIds": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"valid": true,
"code": "<string>",
"amountOff": 123,
"subtotalBefore": 123,
"subtotalAfter": 123,
"currency": "<string>",
"recurring": true,
"description": "<string>"
}
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}Coupons
Preview what a coupon is worth on a basket
Prices the basket from ids alone (exactly as checkout will) and quotes the code against it. A rejected code is NOT an
error: it comes back as 200 with { valid: false, reason }. planId is a dedicated plan slug, a TenantOS server id for a
one-off stock machine, a cloud plan slug or a hosting plan id. billingCycle, quantity and addonIds only apply to
CLOUD. Rate limited to 20 requests per minute per IP.
POST
/
v1
/
client
/
coupons
/
validate
Preview what a coupon is worth on a basket
curl --request POST \
--url https://my.server.express/api/v1/client/coupons/validate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"planId": "<string>",
"quantity": 5,
"addonIds": [
"<string>"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({code: '<string>', planId: '<string>', quantity: 5, addonIds: ['<string>']})
};
fetch('https://my.server.express/api/v1/client/coupons/validate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://my.server.express/api/v1/client/coupons/validate"
payload = {
"code": "<string>",
"planId": "<string>",
"quantity": 5,
"addonIds": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"valid": true,
"code": "<string>",
"amountOff": 123,
"subtotalBefore": 123,
"subtotalAfter": 123,
"currency": "<string>",
"recurring": true,
"description": "<string>"
}
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}Authorizations
Session access token (JWT) from POST /v1/auth/login or /v1/auth/refresh. A session satisfies every API scope.
Body
application/json
Minimum string length:
1Available options:
DEDICATED, CLOUD, WEB_HOSTING Available options:
monthly, quarterly, semi-annually, annually, biennially, triennially Required range:
1 <= x <= 10