Carts
A cart's price now, a cart the store keeps, and the hand-over to the store's own checkout.
| Operation | What it does |
|---|---|
POST /cart | What lines kept on your site cost now, without keeping a cart: { lines: [{ variantId, quantity }] }. |
POST /checkout | Makes a cart of the lines given and answers the one-time address of the store's checkout. |
POST /carts | Makes a cart the store keeps: { lines? }. Answers its key (cart), which only you hold: keep it secret. |
GET /carts/{cart} | What the cart holds and costs now: each line's price, available, fitted and status, and a subtotal. |
POST /carts/{cart}/lines | Adds units of a variant: { variantId, quantity }, put right by the variant's quantity rule and cut to what is available. |
PATCH /carts/{cart}/lines/{variantId} | Sets a line to exactly { quantity }; 0 removes it. A quantity the rule does not allow is refused. |
DELETE /carts/{cart}/lines/{variantId} | Removes a line. |
POST /carts/{cart}/checkout | Hands the cart to the store's checkout: a one-time address for fifteen minutes. The key opens nothing after this. |
POST /cart
POST https://kaizenaflow.com/api/storefront/v1/{store}/cart
What lines kept on your site cost now, without keeping a cart: { lines: [{ variantId, quantity }] }.
Answers:
200, the answer.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
store | string | yes | The store, by its slug. |
Body
JSON, with Content-Type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
lines | list of objects, 1 to 50 items | yes | |
lines[].variantId | string (uuid) | yes | |
lines[].quantity | integer, 1 to 999 | yes |
Answer
| Field | Type | Description |
|---|---|---|
market | object | |
market.slug | string | |
market.country | string | |
market.name | string | |
market.currency | string | |
market.language | string | |
lines | list of objects | |
lines[].variant_id | string (uuid) | |
lines[].product_id | string (uuid) | |
lines[].handle | string | |
lines[].title | string | |
lines[].options | map of string to string | |
lines[].image | object or null | |
lines[].image.url | string | |
lines[].image.alt | string | |
lines[].url | string | |
lines[].quantity | integer | |
lines[].status | one of ok, insufficient, quantity, unavailable | ok; insufficient (see available); quantity (the rule allows fitted); unavailable (left out of the subtotal). |
lines[].available | number | |
lines[].fitted | integer | The quantity counted in the subtotal: the one asked, fitted to the rule and the stock. |
lines[].quantity_rule | object | How many at a time: the least, the most and the step. |
lines[].quantity_rule.min | integer | |
lines[].quantity_rule.max | integer | |
lines[].quantity_rule.step | integer | |
lines[].quantity_rule.text | string or null | |
lines[].backorder | object or null | |
lines[].backorder.units | integer | |
lines[].backorder.days | integer | |
lines[].unit | object or null | |
lines[].unit.text | string | The price as the store shows it, such as "kr 199,00". |
lines[].unit.vat_label | string | Whether VAT is included, in the market's language. |
lines[].unit.from_label | string or null | "From" when the variants differ in price and this is the lowest. |
lines[].unit.prior_label | string or null | For a genuine reduction only: the words for the lowest price in the last 30 days. |
lines[].unit.prior_text | string or null | |
lines[].unit.unit_text | string or null | The unit price, such as "199,60 kr/kg", when the product has a content to compare by. |
lines[].unit.amount_minor | integer | |
lines[].unit.amount_decimal | string | The amount as a decimal written as text, such as "199.00". |
lines[].unit.currency | string | |
lines[].line_text | string or null | |
subtotal_minor | integer | |
subtotal_text | string | |
vat_label | string | |
count | integer | |
labels | map of string to string | Words for a cart and a product page in the market's language; {n} stands for a number. |
Errors
| Status | Codes | When |
|---|---|---|
| 400 | invalid_cart | The request could not be read: the error's code says which part. |
| 401 | unauthorized | No storefront token of this store in X-Storefront-Token. |
| 404 | not_found, no_such_market | No such store (or it is not open, sells nothing or is private), market, product or cart. |
| 429 | rate_limited | Too many calls; Retry-After says when to try again. |
Example request
curl
curl -X POST 'https://kaizenaflow.com/api/storefront/v1/your-store/cart' \
-H "X-Storefront-Token: $KAIZENA_STOREFRONT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"lines":[{"variantId":"046b011d-cb87-43c6-a7d6-7e9ede678b85","quantity":1}]}'JavaScript
const response = await fetch("https://kaizenaflow.com/api/storefront/v1/your-store/cart", {
method: "POST",
headers: {
"X-Storefront-Token": process.env.KAIZENA_STOREFRONT_TOKEN,
"Content-Type": "application/json",
},
body: JSON.stringify({
"lines": [
{
"variantId": "046b011d-cb87-43c6-a7d6-7e9ede678b85",
"quantity": 1
}
]
}),
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/storefront/v1/your-store/cart",
method="POST",
headers={
"X-Storefront-Token": os.environ["KAIZENA_STOREFRONT_TOKEN"],
"Content-Type": "application/json",
},
data=json.dumps({
"lines": [
{
"variantId": "046b011d-cb87-43c6-a7d6-7e9ede678b85",
"quantity": 1,
},
],
}).encode(),
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)POST /checkout
POST https://kaizenaflow.com/api/storefront/v1/{store}/checkout
Makes a cart of the lines given and answers the one-time address of the store's checkout.
Answers:
200, the answer.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
store | string | yes | The store, by its slug. |
Body
JSON, with Content-Type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
lines | list of objects, 1 to 50 items | yes | |
lines[].variantId | string (uuid) | yes | |
lines[].quantity | integer, 1 to 999 | yes |
Answer
| Field | Type | Description |
|---|---|---|
url | string | The one-time address of the store's checkout, for fifteen minutes. |
lines | list of objects | |
lines[].variant_id | string (uuid) | |
lines[].quantity | integer | |
lines[].outcome | string |
Errors
| Status | Codes | When |
|---|---|---|
| 400 | invalid_cart | The request could not be read: the error's code says which part. |
| 401 | unauthorized | No storefront token of this store in X-Storefront-Token. |
| 404 | not_found, no_such_market | No such store (or it is not open, sells nothing or is private), market, product or cart. |
| 422 | nothing_to_buy | Nothing changed: the error's code says why. |
| 429 | rate_limited | Too many calls; Retry-After says when to try again. |
Example request
curl
curl -X POST 'https://kaizenaflow.com/api/storefront/v1/your-store/checkout' \
-H "X-Storefront-Token: $KAIZENA_STOREFRONT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"lines":[{"variantId":"046b011d-cb87-43c6-a7d6-7e9ede678b85","quantity":1}]}'JavaScript
const response = await fetch("https://kaizenaflow.com/api/storefront/v1/your-store/checkout", {
method: "POST",
headers: {
"X-Storefront-Token": process.env.KAIZENA_STOREFRONT_TOKEN,
"Content-Type": "application/json",
},
body: JSON.stringify({
"lines": [
{
"variantId": "046b011d-cb87-43c6-a7d6-7e9ede678b85",
"quantity": 1
}
]
}),
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/storefront/v1/your-store/checkout",
method="POST",
headers={
"X-Storefront-Token": os.environ["KAIZENA_STOREFRONT_TOKEN"],
"Content-Type": "application/json",
},
data=json.dumps({
"lines": [
{
"variantId": "046b011d-cb87-43c6-a7d6-7e9ede678b85",
"quantity": 1,
},
],
}).encode(),
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)POST /carts
POST https://kaizenaflow.com/api/storefront/v1/{store}/carts
Makes a cart the store keeps: { lines? }. Answers its key (cart), which only you hold: keep it secret.
Answers:
201, made: the new cart, with its key incart.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
store | string | yes | The store, by its slug. |
Body
JSON, with Content-Type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
lines | list of objects, at most 50 items | no, default [] | |
lines[].variantId | string (uuid) | yes | |
lines[].quantity | integer, 1 to 999 | yes |
Answer
| Field | Type | Description |
|---|---|---|
market | object | |
market.slug | string | |
market.country | string | |
market.name | string | |
market.currency | string | |
market.language | string | |
lines | list of objects | |
lines[].variant_id | string (uuid) | |
lines[].product_id | string (uuid) | |
lines[].handle | string | |
lines[].title | string | |
lines[].options | map of string to string | |
lines[].image | object or null | |
lines[].image.url | string | |
lines[].image.alt | string | |
lines[].url | string | |
lines[].quantity | integer | |
lines[].status | one of ok, insufficient, quantity, unavailable | ok; insufficient (see available); quantity (the rule allows fitted); unavailable (left out of the subtotal). |
lines[].available | number | |
lines[].fitted | integer | The quantity counted in the subtotal: the one asked, fitted to the rule and the stock. |
lines[].quantity_rule | object | How many at a time: the least, the most and the step. |
lines[].quantity_rule.min | integer | |
lines[].quantity_rule.max | integer | |
lines[].quantity_rule.step | integer | |
lines[].quantity_rule.text | string or null | |
lines[].backorder | object or null | |
lines[].backorder.units | integer | |
lines[].backorder.days | integer | |
lines[].unit | object or null | |
lines[].unit.text | string | The price as the store shows it, such as "kr 199,00". |
lines[].unit.vat_label | string | Whether VAT is included, in the market's language. |
lines[].unit.from_label | string or null | "From" when the variants differ in price and this is the lowest. |
lines[].unit.prior_label | string or null | For a genuine reduction only: the words for the lowest price in the last 30 days. |
lines[].unit.prior_text | string or null | |
lines[].unit.unit_text | string or null | The unit price, such as "199,60 kr/kg", when the product has a content to compare by. |
lines[].unit.amount_minor | integer | |
lines[].unit.amount_decimal | string | The amount as a decimal written as text, such as "199.00". |
lines[].unit.currency | string | |
lines[].line_text | string or null | |
subtotal_minor | integer | |
subtotal_text | string | |
vat_label | string | |
count | integer | |
labels | map of string to string | Words for a cart and a product page in the market's language; {n} stands for a number. |
cart | string | The cart's key (kfc_…): only you hold it. Keep it secret. |
Errors
| Status | Codes | When |
|---|---|---|
| 400 | invalid_cart | The request could not be read: the error's code says which part. |
| 401 | unauthorized | No storefront token of this store in X-Storefront-Token. |
| 404 | not_found, no_such_market | No such store (or it is not open, sells nothing or is private), market, product or cart. |
| 429 | rate_limited | Too many calls; Retry-After says when to try again. |
Example request
curl
curl -X POST 'https://kaizenaflow.com/api/storefront/v1/your-store/carts' \
-H "X-Storefront-Token: $KAIZENA_STOREFRONT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"lines":[{"variantId":"046b011d-cb87-43c6-a7d6-7e9ede678b85","quantity":1}]}'JavaScript
const response = await fetch("https://kaizenaflow.com/api/storefront/v1/your-store/carts", {
method: "POST",
headers: {
"X-Storefront-Token": process.env.KAIZENA_STOREFRONT_TOKEN,
"Content-Type": "application/json",
},
body: JSON.stringify({
"lines": [
{
"variantId": "046b011d-cb87-43c6-a7d6-7e9ede678b85",
"quantity": 1
}
]
}),
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/storefront/v1/your-store/carts",
method="POST",
headers={
"X-Storefront-Token": os.environ["KAIZENA_STOREFRONT_TOKEN"],
"Content-Type": "application/json",
},
data=json.dumps({
"lines": [
{
"variantId": "046b011d-cb87-43c6-a7d6-7e9ede678b85",
"quantity": 1,
},
],
}).encode(),
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)GET /carts/{cart}
GET https://kaizenaflow.com/api/storefront/v1/{store}/carts/{cart}
What the cart holds and costs now: each line's price, available, fitted and status, and a subtotal.
Answers:
200, the answer.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
store | string | yes | The store, by its slug. |
cart | string | yes | The cart's key (kfc_…). |
Answer
| Field | Type | Description |
|---|---|---|
market | object | |
market.slug | string | |
market.country | string | |
market.name | string | |
market.currency | string | |
market.language | string | |
lines | list of objects | |
lines[].variant_id | string (uuid) | |
lines[].product_id | string (uuid) | |
lines[].handle | string | |
lines[].title | string | |
lines[].options | map of string to string | |
lines[].image | object or null | |
lines[].image.url | string | |
lines[].image.alt | string | |
lines[].url | string | |
lines[].quantity | integer | |
lines[].status | one of ok, insufficient, quantity, unavailable | ok; insufficient (see available); quantity (the rule allows fitted); unavailable (left out of the subtotal). |
lines[].available | number | |
lines[].fitted | integer | The quantity counted in the subtotal: the one asked, fitted to the rule and the stock. |
lines[].quantity_rule | object | How many at a time: the least, the most and the step. |
lines[].quantity_rule.min | integer | |
lines[].quantity_rule.max | integer | |
lines[].quantity_rule.step | integer | |
lines[].quantity_rule.text | string or null | |
lines[].backorder | object or null | |
lines[].backorder.units | integer | |
lines[].backorder.days | integer | |
lines[].unit | object or null | |
lines[].unit.text | string | The price as the store shows it, such as "kr 199,00". |
lines[].unit.vat_label | string | Whether VAT is included, in the market's language. |
lines[].unit.from_label | string or null | "From" when the variants differ in price and this is the lowest. |
lines[].unit.prior_label | string or null | For a genuine reduction only: the words for the lowest price in the last 30 days. |
lines[].unit.prior_text | string or null | |
lines[].unit.unit_text | string or null | The unit price, such as "199,60 kr/kg", when the product has a content to compare by. |
lines[].unit.amount_minor | integer | |
lines[].unit.amount_decimal | string | The amount as a decimal written as text, such as "199.00". |
lines[].unit.currency | string | |
lines[].line_text | string or null | |
subtotal_minor | integer | |
subtotal_text | string | |
vat_label | string | |
count | integer | |
labels | map of string to string | Words for a cart and a product page in the market's language; {n} stands for a number. |
cart | string | The cart's key (kfc_…): only you hold it. Keep it secret. |
Errors
| Status | Codes | When |
|---|---|---|
| 401 | unauthorized | No storefront token of this store in X-Storefront-Token. |
| 404 | not_found, no_such_cart | No such store (or it is not open, sells nothing or is private), market, product or cart. |
| 429 | rate_limited | Too many calls; Retry-After says when to try again. |
Example request
curl
curl 'https://kaizenaflow.com/api/storefront/v1/your-store/carts/kfc_q3Vx9LmT2pZr7KcW4nBf8YdH1sJe6GaUo0iXtNvQwEk' \
-H "X-Storefront-Token: $KAIZENA_STOREFRONT_TOKEN"JavaScript
const response = await fetch("https://kaizenaflow.com/api/storefront/v1/your-store/carts/kfc_q3Vx9LmT2pZr7KcW4nBf8YdH1sJe6GaUo0iXtNvQwEk", {
headers: {
"X-Storefront-Token": process.env.KAIZENA_STOREFRONT_TOKEN,
},
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/storefront/v1/your-store/carts/kfc_q3Vx9LmT2pZr7KcW4nBf8YdH1sJe6GaUo0iXtNvQwEk",
headers={
"X-Storefront-Token": os.environ["KAIZENA_STOREFRONT_TOKEN"],
},
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)POST /carts/{cart}/lines
POST https://kaizenaflow.com/api/storefront/v1/{store}/carts/{cart}/lines
Adds units of a variant: { variantId, quantity }, put right by the variant's quantity rule and cut to what is available.
Answers:
200, the answer.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
store | string | yes | The store, by its slug. |
cart | string | yes | The cart's key (kfc_…). |
Body
JSON, with Content-Type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
variantId | string (uuid) | yes | |
quantity | integer, 1 to 999 | yes |
Answer
| Field | Type | Description |
|---|---|---|
market | object | |
market.slug | string | |
market.country | string | |
market.name | string | |
market.currency | string | |
market.language | string | |
lines | list of objects | |
lines[].variant_id | string (uuid) | |
lines[].product_id | string (uuid) | |
lines[].handle | string | |
lines[].title | string | |
lines[].options | map of string to string | |
lines[].image | object or null | |
lines[].image.url | string | |
lines[].image.alt | string | |
lines[].url | string | |
lines[].quantity | integer | |
lines[].status | one of ok, insufficient, quantity, unavailable | ok; insufficient (see available); quantity (the rule allows fitted); unavailable (left out of the subtotal). |
lines[].available | number | |
lines[].fitted | integer | The quantity counted in the subtotal: the one asked, fitted to the rule and the stock. |
lines[].quantity_rule | object | How many at a time: the least, the most and the step. |
lines[].quantity_rule.min | integer | |
lines[].quantity_rule.max | integer | |
lines[].quantity_rule.step | integer | |
lines[].quantity_rule.text | string or null | |
lines[].backorder | object or null | |
lines[].backorder.units | integer | |
lines[].backorder.days | integer | |
lines[].unit | object or null | |
lines[].unit.text | string | The price as the store shows it, such as "kr 199,00". |
lines[].unit.vat_label | string | Whether VAT is included, in the market's language. |
lines[].unit.from_label | string or null | "From" when the variants differ in price and this is the lowest. |
lines[].unit.prior_label | string or null | For a genuine reduction only: the words for the lowest price in the last 30 days. |
lines[].unit.prior_text | string or null | |
lines[].unit.unit_text | string or null | The unit price, such as "199,60 kr/kg", when the product has a content to compare by. |
lines[].unit.amount_minor | integer | |
lines[].unit.amount_decimal | string | The amount as a decimal written as text, such as "199.00". |
lines[].unit.currency | string | |
lines[].line_text | string or null | |
subtotal_minor | integer | |
subtotal_text | string | |
vat_label | string | |
count | integer | |
labels | map of string to string | Words for a cart and a product page in the market's language; {n} stands for a number. |
cart | string | The cart's key (kfc_…): only you hold it. Keep it secret. |
Errors
| Status | Codes | When |
|---|---|---|
| 400 | invalid_line | The request could not be read: the error's code says which part. |
| 401 | unauthorized | No storefront token of this store in X-Storefront-Token. |
| 404 | not_found | No such store (or it is not open, sells nothing or is private), market, product or cart. |
| 422 | unavailable, quantity, too_many_lines | Nothing changed: the error's code says why. |
| 429 | rate_limited | Too many calls; Retry-After says when to try again. |
Example request
curl
curl -X POST 'https://kaizenaflow.com/api/storefront/v1/your-store/carts/kfc_q3Vx9LmT2pZr7KcW4nBf8YdH1sJe6GaUo0iXtNvQwEk/lines' \
-H "X-Storefront-Token: $KAIZENA_STOREFRONT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"variantId":"046b011d-cb87-43c6-a7d6-7e9ede678b85","quantity":1}'JavaScript
const response = await fetch("https://kaizenaflow.com/api/storefront/v1/your-store/carts/kfc_q3Vx9LmT2pZr7KcW4nBf8YdH1sJe6GaUo0iXtNvQwEk/lines", {
method: "POST",
headers: {
"X-Storefront-Token": process.env.KAIZENA_STOREFRONT_TOKEN,
"Content-Type": "application/json",
},
body: JSON.stringify({
"variantId": "046b011d-cb87-43c6-a7d6-7e9ede678b85",
"quantity": 1
}),
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/storefront/v1/your-store/carts/kfc_q3Vx9LmT2pZr7KcW4nBf8YdH1sJe6GaUo0iXtNvQwEk/lines",
method="POST",
headers={
"X-Storefront-Token": os.environ["KAIZENA_STOREFRONT_TOKEN"],
"Content-Type": "application/json",
},
data=json.dumps({
"variantId": "046b011d-cb87-43c6-a7d6-7e9ede678b85",
"quantity": 1,
}).encode(),
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)PATCH /carts/{cart}/lines/{variantId}
PATCH https://kaizenaflow.com/api/storefront/v1/{store}/carts/{cart}/lines/{variantId}
Sets a line to exactly { quantity }; 0 removes it. A quantity the rule does not allow is refused.
Answers:
200, the answer.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
store | string | yes | The store, by its slug. |
cart | string | yes | The cart's key (kfc_…). |
variantId | string | yes | The variant's id. |
Body
JSON, with Content-Type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
quantity | integer, 0 to 999 | yes |
Answer
| Field | Type | Description |
|---|---|---|
market | object | |
market.slug | string | |
market.country | string | |
market.name | string | |
market.currency | string | |
market.language | string | |
lines | list of objects | |
lines[].variant_id | string (uuid) | |
lines[].product_id | string (uuid) | |
lines[].handle | string | |
lines[].title | string | |
lines[].options | map of string to string | |
lines[].image | object or null | |
lines[].image.url | string | |
lines[].image.alt | string | |
lines[].url | string | |
lines[].quantity | integer | |
lines[].status | one of ok, insufficient, quantity, unavailable | ok; insufficient (see available); quantity (the rule allows fitted); unavailable (left out of the subtotal). |
lines[].available | number | |
lines[].fitted | integer | The quantity counted in the subtotal: the one asked, fitted to the rule and the stock. |
lines[].quantity_rule | object | How many at a time: the least, the most and the step. |
lines[].quantity_rule.min | integer | |
lines[].quantity_rule.max | integer | |
lines[].quantity_rule.step | integer | |
lines[].quantity_rule.text | string or null | |
lines[].backorder | object or null | |
lines[].backorder.units | integer | |
lines[].backorder.days | integer | |
lines[].unit | object or null | |
lines[].unit.text | string | The price as the store shows it, such as "kr 199,00". |
lines[].unit.vat_label | string | Whether VAT is included, in the market's language. |
lines[].unit.from_label | string or null | "From" when the variants differ in price and this is the lowest. |
lines[].unit.prior_label | string or null | For a genuine reduction only: the words for the lowest price in the last 30 days. |
lines[].unit.prior_text | string or null | |
lines[].unit.unit_text | string or null | The unit price, such as "199,60 kr/kg", when the product has a content to compare by. |
lines[].unit.amount_minor | integer | |
lines[].unit.amount_decimal | string | The amount as a decimal written as text, such as "199.00". |
lines[].unit.currency | string | |
lines[].line_text | string or null | |
subtotal_minor | integer | |
subtotal_text | string | |
vat_label | string | |
count | integer | |
labels | map of string to string | Words for a cart and a product page in the market's language; {n} stands for a number. |
cart | string | The cart's key (kfc_…): only you hold it. Keep it secret. |
Errors
| Status | Codes | When |
|---|---|---|
| 400 | invalid_line | The request could not be read: the error's code says which part. |
| 401 | unauthorized | No storefront token of this store in X-Storefront-Token. |
| 404 | not_found | No such store (or it is not open, sells nothing or is private), market, product or cart. |
| 422 | unavailable, quantity, too_many_lines | Nothing changed: the error's code says why. |
| 429 | rate_limited | Too many calls; Retry-After says when to try again. |
Example request
curl
curl -X PATCH 'https://kaizenaflow.com/api/storefront/v1/your-store/carts/kfc_q3Vx9LmT2pZr7KcW4nBf8YdH1sJe6GaUo0iXtNvQwEk/lines/046b011d-cb87-43c6-a7d6-7e9ede678b85' \
-H "X-Storefront-Token: $KAIZENA_STOREFRONT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"quantity":1}'JavaScript
const response = await fetch("https://kaizenaflow.com/api/storefront/v1/your-store/carts/kfc_q3Vx9LmT2pZr7KcW4nBf8YdH1sJe6GaUo0iXtNvQwEk/lines/046b011d-cb87-43c6-a7d6-7e9ede678b85", {
method: "PATCH",
headers: {
"X-Storefront-Token": process.env.KAIZENA_STOREFRONT_TOKEN,
"Content-Type": "application/json",
},
body: JSON.stringify({
"quantity": 1
}),
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/storefront/v1/your-store/carts/kfc_q3Vx9LmT2pZr7KcW4nBf8YdH1sJe6GaUo0iXtNvQwEk/lines/046b011d-cb87-43c6-a7d6-7e9ede678b85",
method="PATCH",
headers={
"X-Storefront-Token": os.environ["KAIZENA_STOREFRONT_TOKEN"],
"Content-Type": "application/json",
},
data=json.dumps({
"quantity": 1,
}).encode(),
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)DELETE /carts/{cart}/lines/{variantId}
DELETE https://kaizenaflow.com/api/storefront/v1/{store}/carts/{cart}/lines/{variantId}
Removes a line.
Answers:
200, the answer.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
store | string | yes | The store, by its slug. |
cart | string | yes | The cart's key (kfc_…). |
variantId | string | yes | The variant's id. |
Answer
| Field | Type | Description |
|---|---|---|
market | object | |
market.slug | string | |
market.country | string | |
market.name | string | |
market.currency | string | |
market.language | string | |
lines | list of objects | |
lines[].variant_id | string (uuid) | |
lines[].product_id | string (uuid) | |
lines[].handle | string | |
lines[].title | string | |
lines[].options | map of string to string | |
lines[].image | object or null | |
lines[].image.url | string | |
lines[].image.alt | string | |
lines[].url | string | |
lines[].quantity | integer | |
lines[].status | one of ok, insufficient, quantity, unavailable | ok; insufficient (see available); quantity (the rule allows fitted); unavailable (left out of the subtotal). |
lines[].available | number | |
lines[].fitted | integer | The quantity counted in the subtotal: the one asked, fitted to the rule and the stock. |
lines[].quantity_rule | object | How many at a time: the least, the most and the step. |
lines[].quantity_rule.min | integer | |
lines[].quantity_rule.max | integer | |
lines[].quantity_rule.step | integer | |
lines[].quantity_rule.text | string or null | |
lines[].backorder | object or null | |
lines[].backorder.units | integer | |
lines[].backorder.days | integer | |
lines[].unit | object or null | |
lines[].unit.text | string | The price as the store shows it, such as "kr 199,00". |
lines[].unit.vat_label | string | Whether VAT is included, in the market's language. |
lines[].unit.from_label | string or null | "From" when the variants differ in price and this is the lowest. |
lines[].unit.prior_label | string or null | For a genuine reduction only: the words for the lowest price in the last 30 days. |
lines[].unit.prior_text | string or null | |
lines[].unit.unit_text | string or null | The unit price, such as "199,60 kr/kg", when the product has a content to compare by. |
lines[].unit.amount_minor | integer | |
lines[].unit.amount_decimal | string | The amount as a decimal written as text, such as "199.00". |
lines[].unit.currency | string | |
lines[].line_text | string or null | |
subtotal_minor | integer | |
subtotal_text | string | |
vat_label | string | |
count | integer | |
labels | map of string to string | Words for a cart and a product page in the market's language; {n} stands for a number. |
cart | string | The cart's key (kfc_…): only you hold it. Keep it secret. |
Errors
| Status | Codes | When |
|---|---|---|
| 400 | invalid_line | The request could not be read: the error's code says which part. |
| 401 | unauthorized | No storefront token of this store in X-Storefront-Token. |
| 404 | not_found | No such store (or it is not open, sells nothing or is private), market, product or cart. |
| 422 | unavailable, quantity, too_many_lines | Nothing changed: the error's code says why. |
| 429 | rate_limited | Too many calls; Retry-After says when to try again. |
Example request
curl
curl -X DELETE 'https://kaizenaflow.com/api/storefront/v1/your-store/carts/kfc_q3Vx9LmT2pZr7KcW4nBf8YdH1sJe6GaUo0iXtNvQwEk/lines/046b011d-cb87-43c6-a7d6-7e9ede678b85' \
-H "X-Storefront-Token: $KAIZENA_STOREFRONT_TOKEN"JavaScript
const response = await fetch("https://kaizenaflow.com/api/storefront/v1/your-store/carts/kfc_q3Vx9LmT2pZr7KcW4nBf8YdH1sJe6GaUo0iXtNvQwEk/lines/046b011d-cb87-43c6-a7d6-7e9ede678b85", {
method: "DELETE",
headers: {
"X-Storefront-Token": process.env.KAIZENA_STOREFRONT_TOKEN,
},
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/storefront/v1/your-store/carts/kfc_q3Vx9LmT2pZr7KcW4nBf8YdH1sJe6GaUo0iXtNvQwEk/lines/046b011d-cb87-43c6-a7d6-7e9ede678b85",
method="DELETE",
headers={
"X-Storefront-Token": os.environ["KAIZENA_STOREFRONT_TOKEN"],
},
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)POST /carts/{cart}/checkout
POST https://kaizenaflow.com/api/storefront/v1/{store}/carts/{cart}/checkout
Hands the cart to the store's checkout: a one-time address for fifteen minutes. The key opens nothing after this.
Answers:
200, the answer.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
store | string | yes | The store, by its slug. |
cart | string | yes | The cart's key (kfc_…). |
Answer
| Field | Type | Description |
|---|---|---|
url | string | The one-time address of the store's checkout, for fifteen minutes. |
Errors
| Status | Codes | When |
|---|---|---|
| 401 | unauthorized | No storefront token of this store in X-Storefront-Token. |
| 404 | not_found, no_such_cart | No such store (or it is not open, sells nothing or is private), market, product or cart. |
| 422 | nothing_to_buy | Nothing changed: the error's code says why. |
| 429 | rate_limited | Too many calls; Retry-After says when to try again. |
Example request
curl
curl -X POST 'https://kaizenaflow.com/api/storefront/v1/your-store/carts/kfc_q3Vx9LmT2pZr7KcW4nBf8YdH1sJe6GaUo0iXtNvQwEk/checkout' \
-H "X-Storefront-Token: $KAIZENA_STOREFRONT_TOKEN"JavaScript
const response = await fetch("https://kaizenaflow.com/api/storefront/v1/your-store/carts/kfc_q3Vx9LmT2pZr7KcW4nBf8YdH1sJe6GaUo0iXtNvQwEk/checkout", {
method: "POST",
headers: {
"X-Storefront-Token": process.env.KAIZENA_STOREFRONT_TOKEN,
},
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/storefront/v1/your-store/carts/kfc_q3Vx9LmT2pZr7KcW4nBf8YdH1sJe6GaUo0iXtNvQwEk/checkout",
method="POST",
headers={
"X-Storefront-Token": os.environ["KAIZENA_STOREFRONT_TOKEN"],
},
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)