Skip to content
Kaizena FlowDocs
Search

Search the docs

Checkout

Checkout rules and the questions the checkout asks (D399).

OperationMethod and pathScope
List checkout rulesGET /checkout/rulescheckout:read
Create a checkout rulePOST /checkout/rulescheckout:write
Change or switch a checkout rulePATCH /checkout/rules/{id}checkout:write
Delete a checkout ruleDELETE /checkout/rules/{id}checkout:write
List checkout questionsGET /checkout/fieldscheckout:read
Create a checkout questionPOST /checkout/fieldscheckout:write
Change, switch or move a checkout questionPATCH /checkout/fields/{id}checkout:write
Delete a checkout questionDELETE /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.

Query parameters

NameTypeRequiredDescription
updated_afterstring (date-time)noOnly what was made or changed after this time (ISO 8601 with its offset), for incremental sync.

Answer

FieldTypeDescription
datalist of objects
data[].idstring (uuid)
data[].namestring
data[].positioninteger
data[].enabledboolean
data[].conditionslist of shapes
data[].effectone of 6 shapes, by kind
data[].skippedlist of objectsWhy the rule was skipped at checkout (it names something gone or could not be read), how often and when last.
data[].skipped[].reasonstring
data[].skipped[].countinteger
data[].skipped[].lastAtstring (date-time)

data[].conditions[] when kind is country

FieldTypeDescription
data[].conditions[].kind"country"
data[].conditions[].opone of is, is_not
data[].conditions[].countrieslist of string, matching ^[A-Z]{2}$, 1 to 60 items

data[].conditions[] when kind is total

FieldTypeDescription
data[].conditions[].kind"total"
data[].conditions[].opone of at_least, below
data[].conditions[].amountMinorinteger, 0 to 1,000,000,000,000
data[].conditions[].currencystring, matching ^[A-Z]{3}$

data[].conditions[] when kind is weight

FieldTypeDescription
data[].conditions[].kind"weight"
data[].conditions[].opone of at_least, below
data[].conditions[].gramsinteger, 0 to 10,000,000

data[].conditions[] when kind is product

FieldTypeDescription
data[].conditions[].kind"product"
data[].conditions[].opone of has, has_not
data[].conditions[].idslist of string (uuid), 1 to 50 items

data[].conditions[] when kind is category

FieldTypeDescription
data[].conditions[].kind"category"
data[].conditions[].opone of has, has_not
data[].conditions[].idslist of string (uuid), 1 to 50 items

data[].conditions[] when kind is tag

FieldTypeDescription
data[].conditions[].kind"tag"
data[].conditions[].opone of has, has_not
data[].conditions[].idslist of string (uuid), 1 to 50 items

data[].conditions[] when kind is group

FieldTypeDescription
data[].conditions[].kind"group"
data[].conditions[].opone of is, is_not
data[].conditions[].idslist of string (uuid), 1 to 50 items

data[].effect when kind is hide_shipping

FieldTypeDescription
data[].effect.kind"hide_shipping"
data[].effect.optionslist of string, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$, 1 to 30 items

data[].effect when kind is rename_shipping

FieldTypeDescription
data[].effect.kind"rename_shipping"
data[].effect.optionstring, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$
data[].effect.labelobject
data[].effect.label.textstring, 1 to 80 characters
data[].effect.label.byLocalemap of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 80 characters

data[].effect when kind is hide_payment_method

FieldTypeDescription
data[].effect.kind"hide_payment_method"
data[].effect.methodslist of string, matching ^[a-z_0-9]{2,40}$, 1 to 20 items

data[].effect when kind is refuse

FieldTypeDescription
data[].effect.kind"refuse"
data[].effect.messageobject
data[].effect.message.textstring, 1 to 300 characters
data[].effect.message.byLocalemap of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 300 characters

data[].effect when kind is order_delivery

FieldTypeDescription
data[].effect.kind"order_delivery"
data[].effect.optionslist of string, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$, 1 to 30 items

data[].effect when kind is delivery_price

FieldTypeDescription
data[].effect.kind"delivery_price"
data[].effect.optionslist of string, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$, 1 to 30 items
data[].effect.priceone of 3 shapes, by kind

data[].effect.price when kind is free

FieldTypeDescription
data[].effect.price.kind"free"

data[].effect.price when kind is percent

FieldTypeDescription
data[].effect.price.kind"percent"
data[].effect.price.percentinteger, -100 to 300

data[].effect.price when kind is amount

FieldTypeDescription
data[].effect.price.kind"amount"
data[].effect.price.amountsmap of string, matching ^[A-Z]{3}$ to integer, -10,000,000 to 10,000,000

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403forbiddenThe 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.
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething 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.

Body

JSON, with Content-Type: application/json.

FieldTypeRequiredDescription
namestring, 1 to 80 charactersyes
conditionslist of shapes, at most 10 itemsno, default []
effectone of 6 shapes, by kindyes

conditions[] when kind is country

FieldTypeRequiredDescription
conditions[].kind"country"yes
conditions[].opone of is, is_notyes
conditions[].countrieslist of string, matching ^[A-Z]{2}$, 1 to 60 itemsyes

conditions[] when kind is total

FieldTypeRequiredDescription
conditions[].kind"total"yes
conditions[].opone of at_least, belowyes
conditions[].amountMinorinteger, 0 to 1,000,000,000,000yes
conditions[].currencystring, matching ^[A-Z]{3}$yes

conditions[] when kind is weight

FieldTypeRequiredDescription
conditions[].kind"weight"yes
conditions[].opone of at_least, belowyes
conditions[].gramsinteger, 0 to 10,000,000yes

conditions[] when kind is product

FieldTypeRequiredDescription
conditions[].kind"product"yes
conditions[].opone of has, has_notyes
conditions[].idslist of string (uuid), 1 to 50 itemsyes

conditions[] when kind is category

FieldTypeRequiredDescription
conditions[].kind"category"yes
conditions[].opone of has, has_notyes
conditions[].idslist of string (uuid), 1 to 50 itemsyes

conditions[] when kind is tag

FieldTypeRequiredDescription
conditions[].kind"tag"yes
conditions[].opone of has, has_notyes
conditions[].idslist of string (uuid), 1 to 50 itemsyes

conditions[] when kind is group

FieldTypeRequiredDescription
conditions[].kind"group"yes
conditions[].opone of is, is_notyes
conditions[].idslist of string (uuid), 1 to 50 itemsyes

effect when kind is hide_shipping

FieldTypeRequiredDescription
effect.kind"hide_shipping"yes
effect.optionslist of string, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$, 1 to 30 itemsyes

effect when kind is rename_shipping

FieldTypeRequiredDescription
effect.kind"rename_shipping"yes
effect.optionstring, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$yes
effect.labelobjectyes
effect.label.textstring, 1 to 80 charactersyes
effect.label.byLocalemap of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 80 charactersno, default {}

effect when kind is hide_payment_method

FieldTypeRequiredDescription
effect.kind"hide_payment_method"yes
effect.methodslist of string, matching ^[a-z_0-9]{2,40}$, 1 to 20 itemsyes

effect when kind is refuse

FieldTypeRequiredDescription
effect.kind"refuse"yes
effect.messageobjectyes
effect.message.textstring, 1 to 300 charactersyes
effect.message.byLocalemap of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 300 charactersno, default {}

effect when kind is order_delivery

FieldTypeRequiredDescription
effect.kind"order_delivery"yes
effect.optionslist of string, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$, 1 to 30 itemsyes

effect when kind is delivery_price

FieldTypeRequiredDescription
effect.kind"delivery_price"yes
effect.optionslist of string, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$, 1 to 30 itemsyes
effect.priceone of 3 shapes, by kindyes

effect.price when kind is free

FieldTypeRequiredDescription
effect.price.kind"free"yes

effect.price when kind is percent

FieldTypeRequiredDescription
effect.price.kind"percent"yes
effect.price.percentinteger, -100 to 300yes

effect.price when kind is amount

FieldTypeRequiredDescription
effect.price.kind"amount"yes
effect.price.amountsmap of string, matching ^[A-Z]{3}$ to integer, -10,000,000 to 10,000,000yes

Answer

FieldTypeDescription
dataobject
data.idstring (uuid)

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403forbiddenThe 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.
409conflictNothing 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.
422invalidNothing 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.
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething 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_update

  • Scope: checkout:write

  • Answers: 200, the answer under data.

Path parameters

NameTypeRequiredDescription
idstring (uuid)yesThe thing's id in this store.

Body

JSON, with Content-Type: application/json.

The body, shape 1 of 2

FieldTypeRequiredDescription
enabledbooleanyesSwitches it on or off; nothing else changes.

The body, shape 2 of 2

FieldTypeRequiredDescription
namestring, 1 to 80 charactersyes
conditionslist of shapes, at most 10 itemsno, default []
effectone of 6 shapes, by kindyes
enabledbooleanno

conditions[] when kind is country

FieldTypeRequiredDescription
conditions[].kind"country"yes
conditions[].opone of is, is_notyes
conditions[].countrieslist of string, matching ^[A-Z]{2}$, 1 to 60 itemsyes

conditions[] when kind is total

FieldTypeRequiredDescription
conditions[].kind"total"yes
conditions[].opone of at_least, belowyes
conditions[].amountMinorinteger, 0 to 1,000,000,000,000yes
conditions[].currencystring, matching ^[A-Z]{3}$yes

conditions[] when kind is weight

FieldTypeRequiredDescription
conditions[].kind"weight"yes
conditions[].opone of at_least, belowyes
conditions[].gramsinteger, 0 to 10,000,000yes

conditions[] when kind is product

FieldTypeRequiredDescription
conditions[].kind"product"yes
conditions[].opone of has, has_notyes
conditions[].idslist of string (uuid), 1 to 50 itemsyes

conditions[] when kind is category

FieldTypeRequiredDescription
conditions[].kind"category"yes
conditions[].opone of has, has_notyes
conditions[].idslist of string (uuid), 1 to 50 itemsyes

conditions[] when kind is tag

FieldTypeRequiredDescription
conditions[].kind"tag"yes
conditions[].opone of has, has_notyes
conditions[].idslist of string (uuid), 1 to 50 itemsyes

conditions[] when kind is group

FieldTypeRequiredDescription
conditions[].kind"group"yes
conditions[].opone of is, is_notyes
conditions[].idslist of string (uuid), 1 to 50 itemsyes

effect when kind is hide_shipping

FieldTypeRequiredDescription
effect.kind"hide_shipping"yes
effect.optionslist of string, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$, 1 to 30 itemsyes

effect when kind is rename_shipping

FieldTypeRequiredDescription
effect.kind"rename_shipping"yes
effect.optionstring, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$yes
effect.labelobjectyes
effect.label.textstring, 1 to 80 charactersyes
effect.label.byLocalemap of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 80 charactersno, default {}

effect when kind is hide_payment_method

FieldTypeRequiredDescription
effect.kind"hide_payment_method"yes
effect.methodslist of string, matching ^[a-z_0-9]{2,40}$, 1 to 20 itemsyes

effect when kind is refuse

FieldTypeRequiredDescription
effect.kind"refuse"yes
effect.messageobjectyes
effect.message.textstring, 1 to 300 charactersyes
effect.message.byLocalemap of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 300 charactersno, default {}

effect when kind is order_delivery

FieldTypeRequiredDescription
effect.kind"order_delivery"yes
effect.optionslist of string, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$, 1 to 30 itemsyes

effect when kind is delivery_price

FieldTypeRequiredDescription
effect.kind"delivery_price"yes
effect.optionslist of string, matching ^(flat|(method|pickup|local):[0-9a-f-]{36})$, 1 to 30 itemsyes
effect.priceone of 3 shapes, by kindyes

effect.price when kind is free

FieldTypeRequiredDescription
effect.price.kind"free"yes

effect.price when kind is percent

FieldTypeRequiredDescription
effect.price.kind"percent"yes
effect.price.percentinteger, -100 to 300yes

effect.price when kind is amount

FieldTypeRequiredDescription
effect.price.kind"amount"yes
effect.price.amountsmap of string, matching ^[A-Z]{3}$ to integer, -10,000,000 to 10,000,000yes

Answer

FieldTypeDescription
dataobject
data.idstring (uuid)

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403forbiddenThe 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.
404not_foundNo such route, or nothing with that id in the token's store (another store's ids are simply not found).
422invalidNothing 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.
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething 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_delete

  • Scope: checkout:write

  • Answers: 200, the answer under data.

Path parameters

NameTypeRequiredDescription
idstring (uuid)yesThe thing's id in this store.

Answer

FieldTypeDescription
dataobject
data.idstring (uuid)
data.deletedtrue

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403forbiddenThe 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.
404not_foundNo such route, or nothing with that id in the token's store (another store's ids are simply not found).
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething 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.

Query parameters

NameTypeRequiredDescription
updated_afterstring (date-time)noOnly what was made or changed after this time (ISO 8601 with its offset), for incremental sync.

Answer

FieldTypeDescription
datalist of objects
data[].idstring (uuid)
data[].kindone of text, textarea, checkbox, checklist, select, radio, number, date, email, phone
data[].requiredboolean
data[].labelobject
data[].label.textstring
data[].label.byLocalemap of string to string
data[].helpobject or null
data[].help.textstring
data[].help.byLocalemap of string to string
data[].positioninteger
data[].enabledboolean
data[].widthone of full, halfHow wide the cart draws it: two halves next to each other share a line.
data[].optionslist of objectsThe options of a checklist, a select or radio buttons, in order; none marks a checklist's option that clears the others.
data[].options[].idstring
data[].options[].labelobject
data[].options[].label.textstring
data[].options[].label.byLocalemap of string to string
data[].options[].noneboolean
data[].sensitivebooleanThe answer may be sensitive personal data: the cart asks the shopper's explicit consent with it.
data[].boundsobjectA number's lowest and highest value, or a date's earliest and latest day counted from the store's today.
data[].bounds.mininteger
data[].bounds.maxinteger
data[].conditionslist of shapesAsked only when every condition holds for the basket, the checkout rules' own conditions; none: always asked.

data[].conditions[] when kind is country

FieldTypeDescription
data[].conditions[].kind"country"
data[].conditions[].opone of is, is_not
data[].conditions[].countrieslist of string, matching ^[A-Z]{2}$, 1 to 60 items

data[].conditions[] when kind is total

FieldTypeDescription
data[].conditions[].kind"total"
data[].conditions[].opone of at_least, below
data[].conditions[].amountMinorinteger, 0 to 1,000,000,000,000
data[].conditions[].currencystring, matching ^[A-Z]{3}$

data[].conditions[] when kind is weight

FieldTypeDescription
data[].conditions[].kind"weight"
data[].conditions[].opone of at_least, below
data[].conditions[].gramsinteger, 0 to 10,000,000

data[].conditions[] when kind is product

FieldTypeDescription
data[].conditions[].kind"product"
data[].conditions[].opone of has, has_not
data[].conditions[].idslist of string (uuid), 1 to 50 items

data[].conditions[] when kind is category

FieldTypeDescription
data[].conditions[].kind"category"
data[].conditions[].opone of has, has_not
data[].conditions[].idslist of string (uuid), 1 to 50 items

data[].conditions[] when kind is tag

FieldTypeDescription
data[].conditions[].kind"tag"
data[].conditions[].opone of has, has_not
data[].conditions[].idslist of string (uuid), 1 to 50 items

data[].conditions[] when kind is group

FieldTypeDescription
data[].conditions[].kind"group"
data[].conditions[].opone of is, is_not
data[].conditions[].idslist of string (uuid), 1 to 50 items

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403forbiddenThe 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.
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething 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.

Body

JSON, with Content-Type: application/json.

FieldTypeRequiredDescription
kindone of text, textarea, checkbox, checklist, select, radio, number, date, email, phoneyestext: one line; textarea: several lines; checkbox: one box; checklist: options to tick; select: one option from a list; radio: one option, all shown.
requiredbooleanno, default false
labelobjectyes
label.textstring, 1 to 80 charactersyes
label.byLocalemap of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 80 charactersno, default {}
helpobject or nullno, default null
help.textstring, 1 to 200 charactersyes
help.byLocalemap of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 200 charactersno, default {}
widthone of full, halfnoHow wide the cart draws it: full, or half (two halves next to each other share a line).
optionslist of objects, at most 30 itemsnoThe 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[].idstring, matching ^[A-Za-z0-9_-]{1,40}$noThe option's id, kept with answers; left out on a new option, which gets one.
options[].labelobjectyes
options[].label.textstring, 1 to 80 charactersyes
options[].label.byLocalemap of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 80 charactersno, default {}
options[].nonebooleannoThe option that says none of the others apply; ticking it clears the others. At most one.
sensitivebooleannoThe answer may be sensitive personal data (GDPR article 9, such as allergies): the shopper ticks an explicit consent with it.
boundsobjectnoA number's lowest and highest value, or a date's earliest and latest day counted from today (0 to 730); each optional.
bounds.mininteger, -1,000,000,000 to 1,000,000,000no
bounds.maxinteger, -1,000,000,000 to 1,000,000,000no
conditionslist of shapes, at most 10 itemsnoAsked 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

FieldTypeRequiredDescription
conditions[].kind"country"yes
conditions[].opone of is, is_notyes
conditions[].countrieslist of string, matching ^[A-Z]{2}$, 1 to 60 itemsyes

conditions[] when kind is total

FieldTypeRequiredDescription
conditions[].kind"total"yes
conditions[].opone of at_least, belowyes
conditions[].amountMinorinteger, 0 to 1,000,000,000,000yes
conditions[].currencystring, matching ^[A-Z]{3}$yes

conditions[] when kind is weight

FieldTypeRequiredDescription
conditions[].kind"weight"yes
conditions[].opone of at_least, belowyes
conditions[].gramsinteger, 0 to 10,000,000yes

conditions[] when kind is product

FieldTypeRequiredDescription
conditions[].kind"product"yes
conditions[].opone of has, has_notyes
conditions[].idslist of string (uuid), 1 to 50 itemsyes

conditions[] when kind is category

FieldTypeRequiredDescription
conditions[].kind"category"yes
conditions[].opone of has, has_notyes
conditions[].idslist of string (uuid), 1 to 50 itemsyes

conditions[] when kind is tag

FieldTypeRequiredDescription
conditions[].kind"tag"yes
conditions[].opone of has, has_notyes
conditions[].idslist of string (uuid), 1 to 50 itemsyes

conditions[] when kind is group

FieldTypeRequiredDescription
conditions[].kind"group"yes
conditions[].opone of is, is_notyes
conditions[].idslist of string (uuid), 1 to 50 itemsyes

Answer

FieldTypeDescription
dataobject
data.idstring (uuid)

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403forbiddenThe 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.
409conflictNothing 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.
422invalidNothing 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.
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething 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_update

  • Scope: checkout:write

  • Answers: 200, the answer under data.

Path parameters

NameTypeRequiredDescription
idstring (uuid)yesThe thing's id in this store.

Body

JSON, with Content-Type: application/json.

The body, shape 1 of 2

FieldTypeRequiredDescription
enabledbooleannoSwitches it on or off; nothing else changes.
positioninteger, at least 0noMoves 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

FieldTypeRequiredDescription
kindone of text, textarea, checkbox, checklist, select, radio, number, date, email, phoneyestext: one line; textarea: several lines; checkbox: one box; checklist: options to tick; select: one option from a list; radio: one option, all shown.
requiredbooleanno, default false
labelobjectyes
label.textstring, 1 to 80 charactersyes
label.byLocalemap of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 80 charactersno, default {}
helpobject or nullno, default null
help.textstring, 1 to 200 charactersyes
help.byLocalemap of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 200 charactersno, default {}
widthone of full, halfnoHow wide the cart draws it: full, or half (two halves next to each other share a line).
optionslist of objects, at most 30 itemsnoThe 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[].idstring, matching ^[A-Za-z0-9_-]{1,40}$noThe option's id, kept with answers; left out on a new option, which gets one.
options[].labelobjectyes
options[].label.textstring, 1 to 80 charactersyes
options[].label.byLocalemap of string, matching ^[a-z]{2}(-[A-Z]{2})?$ to string, at most 80 charactersno, default {}
options[].nonebooleannoThe option that says none of the others apply; ticking it clears the others. At most one.
sensitivebooleannoThe answer may be sensitive personal data (GDPR article 9, such as allergies): the shopper ticks an explicit consent with it.
boundsobjectnoA number's lowest and highest value, or a date's earliest and latest day counted from today (0 to 730); each optional.
bounds.mininteger, -1,000,000,000 to 1,000,000,000no
bounds.maxinteger, -1,000,000,000 to 1,000,000,000no
conditionslist of shapes, at most 10 itemsnoAsked only when every condition holds for the basket (country, basket value, weight, products, categories, tags, customer groups); [] or none: always asked.
enabledbooleanno
positioninteger, at least 0noMoves 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

FieldTypeRequiredDescription
conditions[].kind"country"yes
conditions[].opone of is, is_notyes
conditions[].countrieslist of string, matching ^[A-Z]{2}$, 1 to 60 itemsyes

conditions[] when kind is total

FieldTypeRequiredDescription
conditions[].kind"total"yes
conditions[].opone of at_least, belowyes
conditions[].amountMinorinteger, 0 to 1,000,000,000,000yes
conditions[].currencystring, matching ^[A-Z]{3}$yes

conditions[] when kind is weight

FieldTypeRequiredDescription
conditions[].kind"weight"yes
conditions[].opone of at_least, belowyes
conditions[].gramsinteger, 0 to 10,000,000yes

conditions[] when kind is product

FieldTypeRequiredDescription
conditions[].kind"product"yes
conditions[].opone of has, has_notyes
conditions[].idslist of string (uuid), 1 to 50 itemsyes

conditions[] when kind is category

FieldTypeRequiredDescription
conditions[].kind"category"yes
conditions[].opone of has, has_notyes
conditions[].idslist of string (uuid), 1 to 50 itemsyes

conditions[] when kind is tag

FieldTypeRequiredDescription
conditions[].kind"tag"yes
conditions[].opone of has, has_notyes
conditions[].idslist of string (uuid), 1 to 50 itemsyes

conditions[] when kind is group

FieldTypeRequiredDescription
conditions[].kind"group"yes
conditions[].opone of is, is_notyes
conditions[].idslist of string (uuid), 1 to 50 itemsyes

Answer

FieldTypeDescription
dataobject
data.idstring (uuid)

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403forbiddenThe 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.
404not_foundNo such route, or nothing with that id in the token's store (another store's ids are simply not found).
422invalidNothing 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.
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething 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_delete

  • Scope: checkout:write

  • Answers: 200, the answer under data.

Path parameters

NameTypeRequiredDescription
idstring (uuid)yesThe thing's id in this store.

Answer

FieldTypeDescription
dataobject
data.idstring (uuid)
data.deletedtrue

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403forbiddenThe 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.
404not_foundNo such route, or nothing with that id in the token's store (another store's ids are simply not found).
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething 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)

Made from the API contract, version 1.57This page as Markdown

Was this page helpful?