Checkout
Checkout rules and the questions the checkout asks (D399).
| Operation | Method and path | Scope |
|---|---|---|
| List checkout rules | GET /checkout/rules | checkout:read |
| Create a checkout rule | POST /checkout/rules | checkout:write |
| Change or switch a checkout rule | PATCH /checkout/rules/{id} | checkout:write |
| Delete a checkout rule | DELETE /checkout/rules/{id} | checkout:write |
| List checkout questions | GET /checkout/fields | checkout:read |
| Create a checkout question | POST /checkout/fields | checkout:write |
| Change, switch or move a checkout question | PATCH /checkout/fields/{id} | checkout:write |
| Delete a checkout question | DELETE /checkout/fields/{id} | checkout:write |
List checkout rules
GET https://kaizenaflow.com/api/admin/v1/checkout/rules
The store's checkout rules in the order they run, each with its conditions, its effect and why it was skipped, if it was.
Operation:
checkout.rulesScope:
checkout:read, orcheckout:write, which reads tooAnswers:
200, the answer underdata.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
updated_after | string (date-time) | no | Only what was made or changed after this time (ISO 8601 with its offset), for incremental sync. |
Answer
| Field | Type | Description |
|---|---|---|
data | list of objects | |
data[].id | string (uuid) | |
data[].name | string | |
data[].position | integer | |
data[].enabled | boolean | |
data[].conditions | list of shapes | |
data[].effect | one of 6 shapes, by kind | |
data[].skipped | list of objects | Why the rule was skipped at checkout (it names something gone or could not be read), how often and when last. |
data[].skipped[].reason | string | |
data[].skipped[].count | integer | |
data[].skipped[].lastAt | string (date-time) |
data[].conditions[] when kind is country
| Field | Type | Description |
|---|---|---|
data[].conditions[].kind | "country" | |
data[].conditions[].op | one of is, is_not | |
data[].conditions[].countries | list of string, matching ^[A-Z]{2}$, 1 to 60 items |
data[].conditions[] when kind is total
| Field | Type | Description |
|---|---|---|
data[].conditions[].kind | "total" | |
data[].conditions[].op | one of at_least, below | |
data[].conditions[].amountMinor | integer, 0 to 1,000,000,000,000 | |
data[].conditions[].currency | string, matching ^[A-Z]{3}$ |
data[].conditions[] when kind is weight
| Field | Type | Description |
|---|---|---|
data[].conditions[].kind | "weight" | |
data[].conditions[].op | one of at_least, below | |
data[].conditions[].grams | integer, 0 to 10,000,000 |
data[].conditions[] when kind is product
| Field | Type | Description |
|---|---|---|
data[].conditions[].kind | "product" | |
data[].conditions[].op | one of has, has_not | |
data[].conditions[].ids | list of string (uuid), 1 to 50 items |
data[].conditions[] when kind is category
| Field | Type | Description |
|---|---|---|
data[].conditions[].kind | "category" | |
data[].conditions[].op | one of has, has_not | |
data[].conditions[].ids | list of string (uuid), 1 to 50 items |
data[].conditions[] when kind is tag
| Field | Type | Description |
|---|---|---|
data[].conditions[].kind | "tag" | |
data[].conditions[].op | one of has, has_not | |
data[].conditions[].ids | list of string (uuid), 1 to 50 items |
data[].conditions[] when kind is group
| Field | Type | Description |
|---|---|---|
data[].conditions[].kind | "group" | |
data[].conditions[].op | one of is, is_not | |
data[].conditions[].ids | list of string (uuid), 1 to 50 items |
data[].effect when kind is hide_shipping
| Field | Type | Description |
|---|---|---|
data[].effect.kind | "hide_shipping" | |
data[].effect.options | list of string, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$, 1 to 30 items |
data[].effect when kind is rename_shipping
| Field | Type | Description |
|---|---|---|
data[].effect.kind | "rename_shipping" | |
data[].effect.option | string, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$ | |
data[].effect.label | object | |
data[].effect.label.text | string, 1 to 80 characters | |
data[].effect.label.byLocale | map of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 80 characters |
data[].effect when kind is hide_payment_method
| Field | Type | Description |
|---|---|---|
data[].effect.kind | "hide_payment_method" | |
data[].effect.methods | list of string, matching ^[a-z_0-9]{2,40}$, 1 to 20 items |
data[].effect when kind is refuse
| Field | Type | Description |
|---|---|---|
data[].effect.kind | "refuse" | |
data[].effect.message | object | |
data[].effect.message.text | string, 1 to 300 characters | |
data[].effect.message.byLocale | map of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 300 characters |
data[].effect when kind is order_delivery
| Field | Type | Description |
|---|---|---|
data[].effect.kind | "order_delivery" | |
data[].effect.options | list of string, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$, 1 to 30 items |
data[].effect when kind is delivery_price
| Field | Type | Description |
|---|---|---|
data[].effect.kind | "delivery_price" | |
data[].effect.options | list of string, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$, 1 to 30 items | |
data[].effect.price | one of 3 shapes, by kind |
data[].effect.price when kind is free
| Field | Type | Description |
|---|---|---|
data[].effect.price.kind | "free" |
data[].effect.price when kind is percent
| Field | Type | Description |
|---|---|---|
data[].effect.price.kind | "percent" | |
data[].effect.price.percent | integer, -100 to 300 |
data[].effect.price when kind is amount
| Field | Type | Description |
|---|---|---|
data[].effect.price.kind | "amount" | |
data[].effect.price.amounts | map of string, matching ^[A-Z]{3}$ to integer, -10,000,000 to 10,000,000 |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl 'https://kaizenaflow.com/api/admin/v1/checkout/rules' \
-H "Authorization: Bearer $KAIZENA_TOKEN"JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/checkout/rules", {
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
},
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/checkout/rules",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
},
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Create a checkout rule
POST https://kaizenaflow.com/api/admin/v1/checkout/rules
Makes a rule through the Shipping page's own writer, switched off; enabled on an update switches it on. An option or method the store does not have is refused.
Operation:
checkout.rule_createScope:
checkout:writeAnswers:
201, made: the answer underdata.Once only: with an
Idempotency-Keyheader.
Body
JSON, with Content-Type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
name | string, 1 to 80 characters | yes | |
conditions | list of shapes, at most 10 items | no, default [] | |
effect | one of 6 shapes, by kind | yes |
conditions[] when kind is country
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "country" | yes | |
conditions[].op | one of is, is_not | yes | |
conditions[].countries | list of string, matching ^[A-Z]{2}$, 1 to 60 items | yes |
conditions[] when kind is total
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "total" | yes | |
conditions[].op | one of at_least, below | yes | |
conditions[].amountMinor | integer, 0 to 1,000,000,000,000 | yes | |
conditions[].currency | string, matching ^[A-Z]{3}$ | yes |
conditions[] when kind is weight
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "weight" | yes | |
conditions[].op | one of at_least, below | yes | |
conditions[].grams | integer, 0 to 10,000,000 | yes |
conditions[] when kind is product
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "product" | yes | |
conditions[].op | one of has, has_not | yes | |
conditions[].ids | list of string (uuid), 1 to 50 items | yes |
conditions[] when kind is category
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "category" | yes | |
conditions[].op | one of has, has_not | yes | |
conditions[].ids | list of string (uuid), 1 to 50 items | yes |
conditions[] when kind is tag
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "tag" | yes | |
conditions[].op | one of has, has_not | yes | |
conditions[].ids | list of string (uuid), 1 to 50 items | yes |
conditions[] when kind is group
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "group" | yes | |
conditions[].op | one of is, is_not | yes | |
conditions[].ids | list of string (uuid), 1 to 50 items | yes |
effect when kind is hide_shipping
| Field | Type | Required | Description |
|---|---|---|---|
effect.kind | "hide_shipping" | yes | |
effect.options | list of string, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$, 1 to 30 items | yes |
effect when kind is rename_shipping
| Field | Type | Required | Description |
|---|---|---|---|
effect.kind | "rename_shipping" | yes | |
effect.option | string, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$ | yes | |
effect.label | object | yes | |
effect.label.text | string, 1 to 80 characters | yes | |
effect.label.byLocale | map of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 80 characters | no, default {} |
effect when kind is hide_payment_method
| Field | Type | Required | Description |
|---|---|---|---|
effect.kind | "hide_payment_method" | yes | |
effect.methods | list of string, matching ^[a-z_0-9]{2,40}$, 1 to 20 items | yes |
effect when kind is refuse
| Field | Type | Required | Description |
|---|---|---|---|
effect.kind | "refuse" | yes | |
effect.message | object | yes | |
effect.message.text | string, 1 to 300 characters | yes | |
effect.message.byLocale | map of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 300 characters | no, default {} |
effect when kind is order_delivery
| Field | Type | Required | Description |
|---|---|---|---|
effect.kind | "order_delivery" | yes | |
effect.options | list of string, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$, 1 to 30 items | yes |
effect when kind is delivery_price
| Field | Type | Required | Description |
|---|---|---|---|
effect.kind | "delivery_price" | yes | |
effect.options | list of string, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$, 1 to 30 items | yes | |
effect.price | one of 3 shapes, by kind | yes |
effect.price when kind is free
| Field | Type | Required | Description |
|---|---|---|---|
effect.price.kind | "free" | yes |
effect.price when kind is percent
| Field | Type | Required | Description |
|---|---|---|---|
effect.price.kind | "percent" | yes | |
effect.price.percent | integer, -100 to 300 | yes |
effect.price when kind is amount
| Field | Type | Required | Description |
|---|---|---|---|
effect.price.kind | "amount" | yes | |
effect.price.amounts | map of string, matching ^[A-Z]{3}$ to integer, -10,000,000 to 10,000,000 | yes |
Answer
| Field | Type | Description |
|---|---|---|
data | object | |
data.id | string (uuid) |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 409 | conflict | Nothing was done: it clashes with how things are now (nothing left to send), or an Idempotency-Key is in use or was used for another request. |
| 422 | invalid | Nothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what. |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl -X POST 'https://kaizenaflow.com/api/admin/v1/checkout/rules' \
-H "Authorization: Bearer $KAIZENA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"Example","effect":{"kind":"hide_shipping","options":["flat"]}}'JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/checkout/rules", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "Example",
"effect": {
"kind": "hide_shipping",
"options": [
"flat"
]
}
}),
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/checkout/rules",
method="POST",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
"Content-Type": "application/json",
},
data=json.dumps({
"name": "Example",
"effect": {
"kind": "hide_shipping",
"options": [
"flat",
],
},
}).encode(),
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Change or switch a checkout rule
PATCH https://kaizenaflow.com/api/admin/v1/checkout/rules/{id}
{ enabled } alone switches the rule; anything else is the whole rule as it should be, its switch kept unless enabled is given too.
Operation:
checkout.rule_updateScope:
checkout:writeAnswers:
200, the answer underdata.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | The thing's id in this store. |
Body
JSON, with Content-Type: application/json.
The body, shape 1 of 2
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | yes | Switches it on or off; nothing else changes. |
The body, shape 2 of 2
| Field | Type | Required | Description |
|---|---|---|---|
name | string, 1 to 80 characters | yes | |
conditions | list of shapes, at most 10 items | no, default [] | |
effect | one of 6 shapes, by kind | yes | |
enabled | boolean | no |
conditions[] when kind is country
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "country" | yes | |
conditions[].op | one of is, is_not | yes | |
conditions[].countries | list of string, matching ^[A-Z]{2}$, 1 to 60 items | yes |
conditions[] when kind is total
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "total" | yes | |
conditions[].op | one of at_least, below | yes | |
conditions[].amountMinor | integer, 0 to 1,000,000,000,000 | yes | |
conditions[].currency | string, matching ^[A-Z]{3}$ | yes |
conditions[] when kind is weight
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "weight" | yes | |
conditions[].op | one of at_least, below | yes | |
conditions[].grams | integer, 0 to 10,000,000 | yes |
conditions[] when kind is product
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "product" | yes | |
conditions[].op | one of has, has_not | yes | |
conditions[].ids | list of string (uuid), 1 to 50 items | yes |
conditions[] when kind is category
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "category" | yes | |
conditions[].op | one of has, has_not | yes | |
conditions[].ids | list of string (uuid), 1 to 50 items | yes |
conditions[] when kind is tag
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "tag" | yes | |
conditions[].op | one of has, has_not | yes | |
conditions[].ids | list of string (uuid), 1 to 50 items | yes |
conditions[] when kind is group
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "group" | yes | |
conditions[].op | one of is, is_not | yes | |
conditions[].ids | list of string (uuid), 1 to 50 items | yes |
effect when kind is hide_shipping
| Field | Type | Required | Description |
|---|---|---|---|
effect.kind | "hide_shipping" | yes | |
effect.options | list of string, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$, 1 to 30 items | yes |
effect when kind is rename_shipping
| Field | Type | Required | Description |
|---|---|---|---|
effect.kind | "rename_shipping" | yes | |
effect.option | string, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$ | yes | |
effect.label | object | yes | |
effect.label.text | string, 1 to 80 characters | yes | |
effect.label.byLocale | map of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 80 characters | no, default {} |
effect when kind is hide_payment_method
| Field | Type | Required | Description |
|---|---|---|---|
effect.kind | "hide_payment_method" | yes | |
effect.methods | list of string, matching ^[a-z_0-9]{2,40}$, 1 to 20 items | yes |
effect when kind is refuse
| Field | Type | Required | Description |
|---|---|---|---|
effect.kind | "refuse" | yes | |
effect.message | object | yes | |
effect.message.text | string, 1 to 300 characters | yes | |
effect.message.byLocale | map of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 300 characters | no, default {} |
effect when kind is order_delivery
| Field | Type | Required | Description |
|---|---|---|---|
effect.kind | "order_delivery" | yes | |
effect.options | list of string, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$, 1 to 30 items | yes |
effect when kind is delivery_price
| Field | Type | Required | Description |
|---|---|---|---|
effect.kind | "delivery_price" | yes | |
effect.options | list of string, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$, 1 to 30 items | yes | |
effect.price | one of 3 shapes, by kind | yes |
effect.price when kind is free
| Field | Type | Required | Description |
|---|---|---|---|
effect.price.kind | "free" | yes |
effect.price when kind is percent
| Field | Type | Required | Description |
|---|---|---|---|
effect.price.kind | "percent" | yes | |
effect.price.percent | integer, -100 to 300 | yes |
effect.price when kind is amount
| Field | Type | Required | Description |
|---|---|---|---|
effect.price.kind | "amount" | yes | |
effect.price.amounts | map of string, matching ^[A-Z]{3}$ to integer, -10,000,000 to 10,000,000 | yes |
Answer
| Field | Type | Description |
|---|---|---|
data | object | |
data.id | string (uuid) |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 404 | not_found | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 422 | invalid | Nothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what. |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl -X PATCH 'https://kaizenaflow.com/api/admin/v1/checkout/rules/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f' \
-H "Authorization: Bearer $KAIZENA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"enabled":true}'JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/checkout/rules/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f", {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"enabled": true
}),
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/checkout/rules/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f",
method="PATCH",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
"Content-Type": "application/json",
},
data=json.dumps({
"enabled": True,
}).encode(),
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Delete a checkout rule
DELETE https://kaizenaflow.com/api/admin/v1/checkout/rules/{id}
Deletes the rule.
Operation:
checkout.rule_deleteScope:
checkout:writeAnswers:
200, the answer underdata.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | The thing's id in this store. |
Answer
| Field | Type | Description |
|---|---|---|
data | object | |
data.id | string (uuid) | |
data.deleted | true |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 404 | not_found | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl -X DELETE 'https://kaizenaflow.com/api/admin/v1/checkout/rules/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f' \
-H "Authorization: Bearer $KAIZENA_TOKEN"JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/checkout/rules/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f", {
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
},
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/checkout/rules/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f",
method="DELETE",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
},
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)List checkout questions
GET https://kaizenaflow.com/api/admin/v1/checkout/fields
The questions the checkout asks, in order, with their words per language.
Operation:
checkout.fieldsScope:
checkout:read, orcheckout:write, which reads tooAnswers:
200, the answer underdata.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
updated_after | string (date-time) | no | Only what was made or changed after this time (ISO 8601 with its offset), for incremental sync. |
Answer
| Field | Type | Description |
|---|---|---|
data | list of objects | |
data[].id | string (uuid) | |
data[].kind | one of text, textarea, checkbox, checklist, select, radio, number, date, email, phone | |
data[].required | boolean | |
data[].label | object | |
data[].label.text | string | |
data[].label.byLocale | map of string to string | |
data[].help | object or null | |
data[].help.text | string | |
data[].help.byLocale | map of string to string | |
data[].position | integer | |
data[].enabled | boolean | |
data[].width | one of full, half | How wide the cart draws it: two halves next to each other share a line. |
data[].options | list of objects | The options of a checklist, a select or radio buttons, in order; none marks a checklist's option that clears the others. |
data[].options[].id | string | |
data[].options[].label | object | |
data[].options[].label.text | string | |
data[].options[].label.byLocale | map of string to string | |
data[].options[].none | boolean | |
data[].sensitive | boolean | The answer may be sensitive personal data: the cart asks the shopper's explicit consent with it. |
data[].bounds | object | A number's lowest and highest value, or a date's earliest and latest day counted from the store's today. |
data[].bounds.min | integer | |
data[].bounds.max | integer | |
data[].conditions | list of shapes | Asked only when every condition holds for the basket, the checkout rules' own conditions; none: always asked. |
data[].conditions[] when kind is country
| Field | Type | Description |
|---|---|---|
data[].conditions[].kind | "country" | |
data[].conditions[].op | one of is, is_not | |
data[].conditions[].countries | list of string, matching ^[A-Z]{2}$, 1 to 60 items |
data[].conditions[] when kind is total
| Field | Type | Description |
|---|---|---|
data[].conditions[].kind | "total" | |
data[].conditions[].op | one of at_least, below | |
data[].conditions[].amountMinor | integer, 0 to 1,000,000,000,000 | |
data[].conditions[].currency | string, matching ^[A-Z]{3}$ |
data[].conditions[] when kind is weight
| Field | Type | Description |
|---|---|---|
data[].conditions[].kind | "weight" | |
data[].conditions[].op | one of at_least, below | |
data[].conditions[].grams | integer, 0 to 10,000,000 |
data[].conditions[] when kind is product
| Field | Type | Description |
|---|---|---|
data[].conditions[].kind | "product" | |
data[].conditions[].op | one of has, has_not | |
data[].conditions[].ids | list of string (uuid), 1 to 50 items |
data[].conditions[] when kind is category
| Field | Type | Description |
|---|---|---|
data[].conditions[].kind | "category" | |
data[].conditions[].op | one of has, has_not | |
data[].conditions[].ids | list of string (uuid), 1 to 50 items |
data[].conditions[] when kind is tag
| Field | Type | Description |
|---|---|---|
data[].conditions[].kind | "tag" | |
data[].conditions[].op | one of has, has_not | |
data[].conditions[].ids | list of string (uuid), 1 to 50 items |
data[].conditions[] when kind is group
| Field | Type | Description |
|---|---|---|
data[].conditions[].kind | "group" | |
data[].conditions[].op | one of is, is_not | |
data[].conditions[].ids | list of string (uuid), 1 to 50 items |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl 'https://kaizenaflow.com/api/admin/v1/checkout/fields' \
-H "Authorization: Bearer $KAIZENA_TOKEN"JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/checkout/fields", {
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
},
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/checkout/fields",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
},
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Create a checkout question
POST https://kaizenaflow.com/api/admin/v1/checkout/fields
Adds a question the checkout asks: a line or several lines of text, a checkbox, a checklist, a select, radio buttons, a number, a date, an email or a phone, with its words.
Operation:
checkout.field_createScope:
checkout:writeAnswers:
201, made: the answer underdata.Once only: with an
Idempotency-Keyheader.
Body
JSON, with Content-Type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
kind | one of text, textarea, checkbox, checklist, select, radio, number, date, email, phone | yes | text: one line; textarea: several lines; checkbox: one box; checklist: options to tick; select: one option from a list; radio: one option, all shown. |
required | boolean | no, default false | |
label | object | yes | |
label.text | string, 1 to 80 characters | yes | |
label.byLocale | map of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 80 characters | no, default {} | |
help | object or null | no, default null | |
help.text | string, 1 to 200 characters | yes | |
help.byLocale | map of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 200 characters | no, default {} | |
width | one of full, half | no | How wide the cart draws it: full, or half (two halves next to each other share a line). |
options | list of objects, at most 30 items | no | The options of a checklist (1 to 30), a select or radio buttons (2 to 30), in order. Only a checklist has a none option. |
options[].id | string, matching ^[A-Za-z0-9_-]{1,40}$ | no | The option's id, kept with answers; left out on a new option, which gets one. |
options[].label | object | yes | |
options[].label.text | string, 1 to 80 characters | yes | |
options[].label.byLocale | map of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 80 characters | no, default {} | |
options[].none | boolean | no | The option that says none of the others apply; ticking it clears the others. At most one. |
sensitive | boolean | no | The answer may be sensitive personal data (GDPR article 9, such as allergies): the shopper ticks an explicit consent with it. |
bounds | object | no | A number's lowest and highest value, or a date's earliest and latest day counted from today (0 to 730); each optional. |
bounds.min | integer, -1,000,000,000 to 1,000,000,000 | no | |
bounds.max | integer, -1,000,000,000 to 1,000,000,000 | no | |
conditions | list of shapes, at most 10 items | no | Asked only when every condition holds for the basket (country, basket value, weight, products, categories, tags, customer groups); [] or none: always asked. |
conditions[] when kind is country
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "country" | yes | |
conditions[].op | one of is, is_not | yes | |
conditions[].countries | list of string, matching ^[A-Z]{2}$, 1 to 60 items | yes |
conditions[] when kind is total
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "total" | yes | |
conditions[].op | one of at_least, below | yes | |
conditions[].amountMinor | integer, 0 to 1,000,000,000,000 | yes | |
conditions[].currency | string, matching ^[A-Z]{3}$ | yes |
conditions[] when kind is weight
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "weight" | yes | |
conditions[].op | one of at_least, below | yes | |
conditions[].grams | integer, 0 to 10,000,000 | yes |
conditions[] when kind is product
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "product" | yes | |
conditions[].op | one of has, has_not | yes | |
conditions[].ids | list of string (uuid), 1 to 50 items | yes |
conditions[] when kind is category
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "category" | yes | |
conditions[].op | one of has, has_not | yes | |
conditions[].ids | list of string (uuid), 1 to 50 items | yes |
conditions[] when kind is tag
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "tag" | yes | |
conditions[].op | one of has, has_not | yes | |
conditions[].ids | list of string (uuid), 1 to 50 items | yes |
conditions[] when kind is group
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "group" | yes | |
conditions[].op | one of is, is_not | yes | |
conditions[].ids | list of string (uuid), 1 to 50 items | yes |
Answer
| Field | Type | Description |
|---|---|---|
data | object | |
data.id | string (uuid) |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 409 | conflict | Nothing was done: it clashes with how things are now (nothing left to send), or an Idempotency-Key is in use or was used for another request. |
| 422 | invalid | Nothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what. |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl -X POST 'https://kaizenaflow.com/api/admin/v1/checkout/fields' \
-H "Authorization: Bearer $KAIZENA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"kind":"text","label":{"text":"Gift message"}}'JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/checkout/fields", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"kind": "text",
"label": {
"text": "Gift message"
}
}),
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/checkout/fields",
method="POST",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
"Content-Type": "application/json",
},
data=json.dumps({
"kind": "text",
"label": {
"text": "Gift message",
},
}).encode(),
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Change, switch or move a checkout question
PATCH https://kaizenaflow.com/api/admin/v1/checkout/fields/{id}
{ enabled } alone switches the question and { position } alone moves it (the checkout asks them in that order); anything else is the whole question as it should be, and may carry either.
Operation:
checkout.field_updateScope:
checkout:writeAnswers:
200, the answer underdata.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | The thing's id in this store. |
Body
JSON, with Content-Type: application/json.
The body, shape 1 of 2
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | no | Switches it on or off; nothing else changes. |
position | integer, at least 0 | no | Moves the question to this place, 0 being first, the others keeping their order; a place past the end is the end. |
The body, shape 2 of 2
| Field | Type | Required | Description |
|---|---|---|---|
kind | one of text, textarea, checkbox, checklist, select, radio, number, date, email, phone | yes | text: one line; textarea: several lines; checkbox: one box; checklist: options to tick; select: one option from a list; radio: one option, all shown. |
required | boolean | no, default false | |
label | object | yes | |
label.text | string, 1 to 80 characters | yes | |
label.byLocale | map of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 80 characters | no, default {} | |
help | object or null | no, default null | |
help.text | string, 1 to 200 characters | yes | |
help.byLocale | map of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 200 characters | no, default {} | |
width | one of full, half | no | How wide the cart draws it: full, or half (two halves next to each other share a line). |
options | list of objects, at most 30 items | no | The options of a checklist (1 to 30), a select or radio buttons (2 to 30), in order. Only a checklist has a none option. |
options[].id | string, matching ^[A-Za-z0-9_-]{1,40}$ | no | The option's id, kept with answers; left out on a new option, which gets one. |
options[].label | object | yes | |
options[].label.text | string, 1 to 80 characters | yes | |
options[].label.byLocale | map of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 80 characters | no, default {} | |
options[].none | boolean | no | The option that says none of the others apply; ticking it clears the others. At most one. |
sensitive | boolean | no | The answer may be sensitive personal data (GDPR article 9, such as allergies): the shopper ticks an explicit consent with it. |
bounds | object | no | A number's lowest and highest value, or a date's earliest and latest day counted from today (0 to 730); each optional. |
bounds.min | integer, -1,000,000,000 to 1,000,000,000 | no | |
bounds.max | integer, -1,000,000,000 to 1,000,000,000 | no | |
conditions | list of shapes, at most 10 items | no | Asked only when every condition holds for the basket (country, basket value, weight, products, categories, tags, customer groups); [] or none: always asked. |
enabled | boolean | no | |
position | integer, at least 0 | no | Moves the question to this place, 0 being first, the others keeping their order; a place past the end is the end. |
conditions[] when kind is country
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "country" | yes | |
conditions[].op | one of is, is_not | yes | |
conditions[].countries | list of string, matching ^[A-Z]{2}$, 1 to 60 items | yes |
conditions[] when kind is total
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "total" | yes | |
conditions[].op | one of at_least, below | yes | |
conditions[].amountMinor | integer, 0 to 1,000,000,000,000 | yes | |
conditions[].currency | string, matching ^[A-Z]{3}$ | yes |
conditions[] when kind is weight
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "weight" | yes | |
conditions[].op | one of at_least, below | yes | |
conditions[].grams | integer, 0 to 10,000,000 | yes |
conditions[] when kind is product
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "product" | yes | |
conditions[].op | one of has, has_not | yes | |
conditions[].ids | list of string (uuid), 1 to 50 items | yes |
conditions[] when kind is category
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "category" | yes | |
conditions[].op | one of has, has_not | yes | |
conditions[].ids | list of string (uuid), 1 to 50 items | yes |
conditions[] when kind is tag
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "tag" | yes | |
conditions[].op | one of has, has_not | yes | |
conditions[].ids | list of string (uuid), 1 to 50 items | yes |
conditions[] when kind is group
| Field | Type | Required | Description |
|---|---|---|---|
conditions[].kind | "group" | yes | |
conditions[].op | one of is, is_not | yes | |
conditions[].ids | list of string (uuid), 1 to 50 items | yes |
Answer
| Field | Type | Description |
|---|---|---|
data | object | |
data.id | string (uuid) |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 404 | not_found | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 422 | invalid | Nothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what. |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl -X PATCH 'https://kaizenaflow.com/api/admin/v1/checkout/fields/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f' \
-H "Authorization: Bearer $KAIZENA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"enabled":true}'JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/checkout/fields/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f", {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"enabled": true
}),
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/checkout/fields/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f",
method="PATCH",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
"Content-Type": "application/json",
},
data=json.dumps({
"enabled": True,
}).encode(),
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Delete a checkout question
DELETE https://kaizenaflow.com/api/admin/v1/checkout/fields/{id}
Deletes the question; answers already given stay on their orders.
Operation:
checkout.field_deleteScope:
checkout:writeAnswers:
200, the answer underdata.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | The thing's id in this store. |
Answer
| Field | Type | Description |
|---|---|---|
data | object | |
data.id | string (uuid) | |
data.deleted | true |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 404 | not_found | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl -X DELETE 'https://kaizenaflow.com/api/admin/v1/checkout/fields/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f' \
-H "Authorization: Bearer $KAIZENA_TOKEN"JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/checkout/fields/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f", {
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
},
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/checkout/fields/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f",
method="DELETE",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
},
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)