Skip to content
Kaizena FlowDocs
Search

Search the docs

Carts

A cart's price now, a cart the store keeps, and the hand-over to the store's own checkout.

OperationWhat it does
POST /cartWhat lines kept on your site cost now, without keeping a cart: { lines: [{ variantId, quantity }] }.
POST /checkoutMakes a cart of the lines given and answers the one-time address of the store's checkout.
POST /cartsMakes 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}/linesAdds 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}/checkoutHands 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

NameTypeRequiredDescription
storestringyesThe store, by its slug.

Body

JSON, with Content-Type: application/json.

FieldTypeRequiredDescription
lineslist of objects, 1 to 50 itemsyes
lines[].variantIdstring (uuid)yes
lines[].quantityinteger, 1 to 999yes

Answer

FieldTypeDescription
marketobject
market.slugstring
market.countrystring
market.namestring
market.currencystring
market.languagestring
lineslist of objects
lines[].variant_idstring (uuid)
lines[].product_idstring (uuid)
lines[].handlestring
lines[].titlestring
lines[].optionsmap of string to string
lines[].imageobject or null
lines[].image.urlstring
lines[].image.altstring
lines[].urlstring
lines[].quantityinteger
lines[].statusone of ok, insufficient, quantity, unavailableok; insufficient (see available); quantity (the rule allows fitted); unavailable (left out of the subtotal).
lines[].availablenumber
lines[].fittedintegerThe quantity counted in the subtotal: the one asked, fitted to the rule and the stock.
lines[].quantity_ruleobjectHow many at a time: the least, the most and the step.
lines[].quantity_rule.mininteger
lines[].quantity_rule.maxinteger
lines[].quantity_rule.stepinteger
lines[].quantity_rule.textstring or null
lines[].backorderobject or null
lines[].backorder.unitsinteger
lines[].backorder.daysinteger
lines[].unitobject or null
lines[].unit.textstringThe price as the store shows it, such as "kr 199,00".
lines[].unit.vat_labelstringWhether VAT is included, in the market's language.
lines[].unit.from_labelstring or null"From" when the variants differ in price and this is the lowest.
lines[].unit.prior_labelstring or nullFor a genuine reduction only: the words for the lowest price in the last 30 days.
lines[].unit.prior_textstring or null
lines[].unit.unit_textstring or nullThe unit price, such as "199,60 kr/kg", when the product has a content to compare by.
lines[].unit.amount_minorinteger
lines[].unit.amount_decimalstringThe amount as a decimal written as text, such as "199.00".
lines[].unit.currencystring
lines[].line_textstring or null
subtotal_minorinteger
subtotal_textstring
vat_labelstring
countinteger
labelsmap of string to stringWords for a cart and a product page in the market's language; {n} stands for a number.

Errors

StatusCodesWhen
400invalid_cartThe request could not be read: the error's code says which part.
401unauthorizedNo storefront token of this store in X-Storefront-Token.
404not_found, no_such_marketNo such store (or it is not open, sells nothing or is private), market, product or cart.
429rate_limitedToo 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

NameTypeRequiredDescription
storestringyesThe store, by its slug.

Body

JSON, with Content-Type: application/json.

FieldTypeRequiredDescription
lineslist of objects, 1 to 50 itemsyes
lines[].variantIdstring (uuid)yes
lines[].quantityinteger, 1 to 999yes

Answer

FieldTypeDescription
urlstringThe one-time address of the store's checkout, for fifteen minutes.
lineslist of objects
lines[].variant_idstring (uuid)
lines[].quantityinteger
lines[].outcomestring

Errors

StatusCodesWhen
400invalid_cartThe request could not be read: the error's code says which part.
401unauthorizedNo storefront token of this store in X-Storefront-Token.
404not_found, no_such_marketNo such store (or it is not open, sells nothing or is private), market, product or cart.
422nothing_to_buyNothing changed: the error's code says why.
429rate_limitedToo 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 in cart.

Path parameters

NameTypeRequiredDescription
storestringyesThe store, by its slug.

Body

JSON, with Content-Type: application/json.

FieldTypeRequiredDescription
lineslist of objects, at most 50 itemsno, default []
lines[].variantIdstring (uuid)yes
lines[].quantityinteger, 1 to 999yes

Answer

FieldTypeDescription
marketobject
market.slugstring
market.countrystring
market.namestring
market.currencystring
market.languagestring
lineslist of objects
lines[].variant_idstring (uuid)
lines[].product_idstring (uuid)
lines[].handlestring
lines[].titlestring
lines[].optionsmap of string to string
lines[].imageobject or null
lines[].image.urlstring
lines[].image.altstring
lines[].urlstring
lines[].quantityinteger
lines[].statusone of ok, insufficient, quantity, unavailableok; insufficient (see available); quantity (the rule allows fitted); unavailable (left out of the subtotal).
lines[].availablenumber
lines[].fittedintegerThe quantity counted in the subtotal: the one asked, fitted to the rule and the stock.
lines[].quantity_ruleobjectHow many at a time: the least, the most and the step.
lines[].quantity_rule.mininteger
lines[].quantity_rule.maxinteger
lines[].quantity_rule.stepinteger
lines[].quantity_rule.textstring or null
lines[].backorderobject or null
lines[].backorder.unitsinteger
lines[].backorder.daysinteger
lines[].unitobject or null
lines[].unit.textstringThe price as the store shows it, such as "kr 199,00".
lines[].unit.vat_labelstringWhether VAT is included, in the market's language.
lines[].unit.from_labelstring or null"From" when the variants differ in price and this is the lowest.
lines[].unit.prior_labelstring or nullFor a genuine reduction only: the words for the lowest price in the last 30 days.
lines[].unit.prior_textstring or null
lines[].unit.unit_textstring or nullThe unit price, such as "199,60 kr/kg", when the product has a content to compare by.
lines[].unit.amount_minorinteger
lines[].unit.amount_decimalstringThe amount as a decimal written as text, such as "199.00".
lines[].unit.currencystring
lines[].line_textstring or null
subtotal_minorinteger
subtotal_textstring
vat_labelstring
countinteger
labelsmap of string to stringWords for a cart and a product page in the market's language; {n} stands for a number.
cartstringThe cart's key (kfc_…): only you hold it. Keep it secret.

Errors

StatusCodesWhen
400invalid_cartThe request could not be read: the error's code says which part.
401unauthorizedNo storefront token of this store in X-Storefront-Token.
404not_found, no_such_marketNo such store (or it is not open, sells nothing or is private), market, product or cart.
429rate_limitedToo 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

NameTypeRequiredDescription
storestringyesThe store, by its slug.
cartstringyesThe cart's key (kfc_…).

Answer

FieldTypeDescription
marketobject
market.slugstring
market.countrystring
market.namestring
market.currencystring
market.languagestring
lineslist of objects
lines[].variant_idstring (uuid)
lines[].product_idstring (uuid)
lines[].handlestring
lines[].titlestring
lines[].optionsmap of string to string
lines[].imageobject or null
lines[].image.urlstring
lines[].image.altstring
lines[].urlstring
lines[].quantityinteger
lines[].statusone of ok, insufficient, quantity, unavailableok; insufficient (see available); quantity (the rule allows fitted); unavailable (left out of the subtotal).
lines[].availablenumber
lines[].fittedintegerThe quantity counted in the subtotal: the one asked, fitted to the rule and the stock.
lines[].quantity_ruleobjectHow many at a time: the least, the most and the step.
lines[].quantity_rule.mininteger
lines[].quantity_rule.maxinteger
lines[].quantity_rule.stepinteger
lines[].quantity_rule.textstring or null
lines[].backorderobject or null
lines[].backorder.unitsinteger
lines[].backorder.daysinteger
lines[].unitobject or null
lines[].unit.textstringThe price as the store shows it, such as "kr 199,00".
lines[].unit.vat_labelstringWhether VAT is included, in the market's language.
lines[].unit.from_labelstring or null"From" when the variants differ in price and this is the lowest.
lines[].unit.prior_labelstring or nullFor a genuine reduction only: the words for the lowest price in the last 30 days.
lines[].unit.prior_textstring or null
lines[].unit.unit_textstring or nullThe unit price, such as "199,60 kr/kg", when the product has a content to compare by.
lines[].unit.amount_minorinteger
lines[].unit.amount_decimalstringThe amount as a decimal written as text, such as "199.00".
lines[].unit.currencystring
lines[].line_textstring or null
subtotal_minorinteger
subtotal_textstring
vat_labelstring
countinteger
labelsmap of string to stringWords for a cart and a product page in the market's language; {n} stands for a number.
cartstringThe cart's key (kfc_…): only you hold it. Keep it secret.

Errors

StatusCodesWhen
401unauthorizedNo storefront token of this store in X-Storefront-Token.
404not_found, no_such_cartNo such store (or it is not open, sells nothing or is private), market, product or cart.
429rate_limitedToo 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

NameTypeRequiredDescription
storestringyesThe store, by its slug.
cartstringyesThe cart's key (kfc_…).

Body

JSON, with Content-Type: application/json.

FieldTypeRequiredDescription
variantIdstring (uuid)yes
quantityinteger, 1 to 999yes

Answer

FieldTypeDescription
marketobject
market.slugstring
market.countrystring
market.namestring
market.currencystring
market.languagestring
lineslist of objects
lines[].variant_idstring (uuid)
lines[].product_idstring (uuid)
lines[].handlestring
lines[].titlestring
lines[].optionsmap of string to string
lines[].imageobject or null
lines[].image.urlstring
lines[].image.altstring
lines[].urlstring
lines[].quantityinteger
lines[].statusone of ok, insufficient, quantity, unavailableok; insufficient (see available); quantity (the rule allows fitted); unavailable (left out of the subtotal).
lines[].availablenumber
lines[].fittedintegerThe quantity counted in the subtotal: the one asked, fitted to the rule and the stock.
lines[].quantity_ruleobjectHow many at a time: the least, the most and the step.
lines[].quantity_rule.mininteger
lines[].quantity_rule.maxinteger
lines[].quantity_rule.stepinteger
lines[].quantity_rule.textstring or null
lines[].backorderobject or null
lines[].backorder.unitsinteger
lines[].backorder.daysinteger
lines[].unitobject or null
lines[].unit.textstringThe price as the store shows it, such as "kr 199,00".
lines[].unit.vat_labelstringWhether VAT is included, in the market's language.
lines[].unit.from_labelstring or null"From" when the variants differ in price and this is the lowest.
lines[].unit.prior_labelstring or nullFor a genuine reduction only: the words for the lowest price in the last 30 days.
lines[].unit.prior_textstring or null
lines[].unit.unit_textstring or nullThe unit price, such as "199,60 kr/kg", when the product has a content to compare by.
lines[].unit.amount_minorinteger
lines[].unit.amount_decimalstringThe amount as a decimal written as text, such as "199.00".
lines[].unit.currencystring
lines[].line_textstring or null
subtotal_minorinteger
subtotal_textstring
vat_labelstring
countinteger
labelsmap of string to stringWords for a cart and a product page in the market's language; {n} stands for a number.
cartstringThe cart's key (kfc_…): only you hold it. Keep it secret.

Errors

StatusCodesWhen
400invalid_lineThe request could not be read: the error's code says which part.
401unauthorizedNo storefront token of this store in X-Storefront-Token.
404not_foundNo such store (or it is not open, sells nothing or is private), market, product or cart.
422unavailable, quantity, too_many_linesNothing changed: the error's code says why.
429rate_limitedToo 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

NameTypeRequiredDescription
storestringyesThe store, by its slug.
cartstringyesThe cart's key (kfc_…).
variantIdstringyesThe variant's id.

Body

JSON, with Content-Type: application/json.

FieldTypeRequiredDescription
quantityinteger, 0 to 999yes

Answer

FieldTypeDescription
marketobject
market.slugstring
market.countrystring
market.namestring
market.currencystring
market.languagestring
lineslist of objects
lines[].variant_idstring (uuid)
lines[].product_idstring (uuid)
lines[].handlestring
lines[].titlestring
lines[].optionsmap of string to string
lines[].imageobject or null
lines[].image.urlstring
lines[].image.altstring
lines[].urlstring
lines[].quantityinteger
lines[].statusone of ok, insufficient, quantity, unavailableok; insufficient (see available); quantity (the rule allows fitted); unavailable (left out of the subtotal).
lines[].availablenumber
lines[].fittedintegerThe quantity counted in the subtotal: the one asked, fitted to the rule and the stock.
lines[].quantity_ruleobjectHow many at a time: the least, the most and the step.
lines[].quantity_rule.mininteger
lines[].quantity_rule.maxinteger
lines[].quantity_rule.stepinteger
lines[].quantity_rule.textstring or null
lines[].backorderobject or null
lines[].backorder.unitsinteger
lines[].backorder.daysinteger
lines[].unitobject or null
lines[].unit.textstringThe price as the store shows it, such as "kr 199,00".
lines[].unit.vat_labelstringWhether VAT is included, in the market's language.
lines[].unit.from_labelstring or null"From" when the variants differ in price and this is the lowest.
lines[].unit.prior_labelstring or nullFor a genuine reduction only: the words for the lowest price in the last 30 days.
lines[].unit.prior_textstring or null
lines[].unit.unit_textstring or nullThe unit price, such as "199,60 kr/kg", when the product has a content to compare by.
lines[].unit.amount_minorinteger
lines[].unit.amount_decimalstringThe amount as a decimal written as text, such as "199.00".
lines[].unit.currencystring
lines[].line_textstring or null
subtotal_minorinteger
subtotal_textstring
vat_labelstring
countinteger
labelsmap of string to stringWords for a cart and a product page in the market's language; {n} stands for a number.
cartstringThe cart's key (kfc_…): only you hold it. Keep it secret.

Errors

StatusCodesWhen
400invalid_lineThe request could not be read: the error's code says which part.
401unauthorizedNo storefront token of this store in X-Storefront-Token.
404not_foundNo such store (or it is not open, sells nothing or is private), market, product or cart.
422unavailable, quantity, too_many_linesNothing changed: the error's code says why.
429rate_limitedToo 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

NameTypeRequiredDescription
storestringyesThe store, by its slug.
cartstringyesThe cart's key (kfc_…).
variantIdstringyesThe variant's id.

Answer

FieldTypeDescription
marketobject
market.slugstring
market.countrystring
market.namestring
market.currencystring
market.languagestring
lineslist of objects
lines[].variant_idstring (uuid)
lines[].product_idstring (uuid)
lines[].handlestring
lines[].titlestring
lines[].optionsmap of string to string
lines[].imageobject or null
lines[].image.urlstring
lines[].image.altstring
lines[].urlstring
lines[].quantityinteger
lines[].statusone of ok, insufficient, quantity, unavailableok; insufficient (see available); quantity (the rule allows fitted); unavailable (left out of the subtotal).
lines[].availablenumber
lines[].fittedintegerThe quantity counted in the subtotal: the one asked, fitted to the rule and the stock.
lines[].quantity_ruleobjectHow many at a time: the least, the most and the step.
lines[].quantity_rule.mininteger
lines[].quantity_rule.maxinteger
lines[].quantity_rule.stepinteger
lines[].quantity_rule.textstring or null
lines[].backorderobject or null
lines[].backorder.unitsinteger
lines[].backorder.daysinteger
lines[].unitobject or null
lines[].unit.textstringThe price as the store shows it, such as "kr 199,00".
lines[].unit.vat_labelstringWhether VAT is included, in the market's language.
lines[].unit.from_labelstring or null"From" when the variants differ in price and this is the lowest.
lines[].unit.prior_labelstring or nullFor a genuine reduction only: the words for the lowest price in the last 30 days.
lines[].unit.prior_textstring or null
lines[].unit.unit_textstring or nullThe unit price, such as "199,60 kr/kg", when the product has a content to compare by.
lines[].unit.amount_minorinteger
lines[].unit.amount_decimalstringThe amount as a decimal written as text, such as "199.00".
lines[].unit.currencystring
lines[].line_textstring or null
subtotal_minorinteger
subtotal_textstring
vat_labelstring
countinteger
labelsmap of string to stringWords for a cart and a product page in the market's language; {n} stands for a number.
cartstringThe cart's key (kfc_…): only you hold it. Keep it secret.

Errors

StatusCodesWhen
400invalid_lineThe request could not be read: the error's code says which part.
401unauthorizedNo storefront token of this store in X-Storefront-Token.
404not_foundNo such store (or it is not open, sells nothing or is private), market, product or cart.
422unavailable, quantity, too_many_linesNothing changed: the error's code says why.
429rate_limitedToo 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

NameTypeRequiredDescription
storestringyesThe store, by its slug.
cartstringyesThe cart's key (kfc_…).

Answer

FieldTypeDescription
urlstringThe one-time address of the store's checkout, for fifteen minutes.

Errors

StatusCodesWhen
401unauthorizedNo storefront token of this store in X-Storefront-Token.
404not_found, no_such_cartNo such store (or it is not open, sells nothing or is private), market, product or cart.
422nothing_to_buyNothing changed: the error's code says why.
429rate_limitedToo 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)

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

Was this page helpful?