NAV Navbar
bash Commerce.js javascript python

Introduction

API libraries: Currently we have JavaScript & PHP SDKs available

API endpoint: https://api.chec.io/v1

Welcome to Commerce.js

Commerce.js is a full-stack eCommerce API built for designers and developers. We provide helper functions for each core endpoint to cater for common checks you’d normally have to create manually, for example “is this variant available for this order” or “what’s the list of provinces in Canada or regions in New Zealand?”.

We use these same APIs to generate our own hosted checkouts and product displays for Chec. We’re a team of full-stack designers & engineers which gives us the unique ability to think as both the designer, the front end developer, and the engineer. This philosophy is reflected in the design & structure of our APIs.

All of our API’s are designed to work either alone or with each other. Our API’s are organized around REST and are designed to have predictable, resource-oriented URLs that use HTTP response codes to indicate API errors. To make it a little easier for developers to use our APIs to update things, we allow PUT requests to perform partial data updates so you don't have to send an entire data payload every time you want to change a title.

Our Commerce.js JavaScript SDK is designed to work along side our server-side SDKs, making the API limited to public key scoped calls. Commerce.js utilizes your public API key which can be used to retrieve non sensitive data, or capture orders.

Authentication

$ curl https://api.chec.io/v1/products \
-H "X-Authorization: sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27"

You authenticate by providing your secret or public API key. You can manage your API keys from your dashboard.

All API requests using live API keys must be made over HTTPS. Calls made over plain HTTP will fail. You must authenticate for all requests. All API requests using sandbox API keys can be made over HTTP or HTTPS.

The public API key can only be used on the products, cart, and checkout resources. You will be unable to access orders, and other sensitive information using this key for security reasons. You must use your private API key (and use server side code) for these requests. It is up to you to decide if you should use your private API key or public API key.

API keys are sent using the X-Authorization header.

We may switch to OAuth authentication in the future, depending on the feedback we receive from developers & designers.

Responses & errors

HTTP status code summary

200 - OK Everything worked as expected.
400 - Bad Request The request was unacceptable, often due to missing a required parameter.
401 - Unauthorized No valid API key provided, or live request made over HTTP.
422 - Validation Validation error. Data submitted was missing something, or in the wrong format.
402 - Request Failed The parameters were valid but the request failed or returned false (i.e. quantity not available).
404 - Not Found The requested resource doesn't exist.
Other 4XX, 500, 502,
503, 504 - Server Errors
Something went wrong on our end.

We use conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a charge failed, etc.), and codes in the 5xx range indicate an error with our servers.

Not all errors map cleanly onto HTTP response codes, please keep us posted if you get an uncaught error.

Versioning

The current API version is 2020-09-23.

In our efforts to make a developer friendly API, we sometimes have to make backwards incompatible changes. When we make these changes, we introduce a new version of the API that corresponds to the date the new version becomes available. The version of the API that you use is determined by a setting on your account - this can be edited from the "developer" section in your settings.

You may request a specific version of the API on a single request by providing the Chec-Version header with your requested API version. The version of the API that was used for your request is available in the response headers as Chec-Version.

Below is a list of changes that are considered breaking, and the API version that these changes first appeared. This changelog serves as a list of available versions and as a migration guide to newer versions of the API. Every effort is made to make new features available for older versions of the API, but in cases where this is not possible, the minimum API version for a feature is listed with the documentation for that feature.

2020-09-23

2020-08-26

2020-08-12

2020-07-29

2020-07-01

2020-06-17

The initial version of the API is 2020-02-01.

Types

This documentation includes details about the responses from APIs, including descriptions and types for each key in a response. Most types are standard native JavaScript types (like boolean or integer) but some types are standardised objects that are detailed here:

Price

Prices returned by the API are objects with the following structure:

Parameter Type Description Example
raw number The raw price as a decimal number 125.6
formatted string The raw price formatted as a string "125.60"
formatted_with_symbol string The formatted price with the relevant currency symbol attached "$125.60"
formatted_with_code string The formatted price with the currency code appended "125.60 USD"

Assets

List assets

Requires authentication

Lists all assets for the current merchant.

Request

curl -X GET \
    -G "https://api.chec.io/v1/assets" \
    -H "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
    "https://api.chec.io/v1/assets"
);

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/assets'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Response (200)

{
    "data": [
        {
            "id": "ast_1ypbroE658n4ea",
            "url": "https://cdn.chec.io/testing.jpg",
            "is_image": true,
            "filename": "bar",
            "file_size": null,
            "file_extension": "",
            "meta": [],
            "created_at": 1604428019,
            "updated_at": 1604428019
        },
        {
            "id": "ast_1ypbroE658n4ea",
            "url": "https://cdn.chec.io/testing.jpg",
            "is_image": true,
            "filename": "bar",
            "file_size": null,
            "file_extension": "",
            "meta": [],
            "created_at": 1604428019,
            "updated_at": 1604428019
        }
    ],
    "meta": {
        "pagination": {
            "total": 2,
            "count": 2,
            "per_page": 2,
            "current_page": 1,
            "total_pages": 1,
            "links": {}
        }
    }
}

Request

GET /v1/assets

Query Parameters

Parameter Status Description
limit optional The number of items to return per page (default: 15)
page optional The page number to return

Response Parameters

Parameter Type Description
id string The asset ID
url string The asset URL that you may use to serve the asset
is_image boolean Whether the asset is an image
filename string The original filename that the file was uploaded with
file_extension string The file extension for the asset
file_size integer The file size in bytes
meta object A given array or keyed object with metadata
created_at integer A unix timestamp when the asset was originally uploaded

Get asset

Requires authentication

Retrieves an asset by its ID.

Request

curl -X GET \
    -G "https://api.chec.io/v1/assets/ast_B7ZQobNDa4AgNn" \
    -H "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
    "https://api.chec.io/v1/assets/ast_B7ZQobNDa4AgNn"
);

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/assets/ast_B7ZQobNDa4AgNn'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Response (200)

{
    "id": "ast_1ypbroE658n4ea",
    "url": "https://cdn.chec.io/testing.jpg",
    "is_image": true,
    "filename": "bar",
    "file_size": null,
    "file_extension": "",
    "meta": [],
    "created_at": 1604428019,
    "updated_at": 1604428019
}

Request

GET /v1/assets/{asset_id}

URL Parameters

Parameter Status Description
asset_id required The asset ID to retrieve

Response Parameters

Parameter Type Description
id string The asset ID
url string The asset URL that you may use to serve the asset
is_image boolean Whether the asset is an image
filename string The original filename that the file was uploaded with
file_extension string The file extension for the asset
file_size integer The file size in bytes
meta object A given array or keyed object with metadata
created_at integer A unix timestamp when the asset was originally uploaded

Create new asset

Requires authentication

Creates a new asset. You may provide either a base 64 encoded contents argument with the asset's file content, or a url argument with a remote URL for us to download your asset from. Additional metadata may be provided under the data key.

If both the contents and url arguments are provided, contents will be used.

Uploaded assets must be one of the following types: - Images: JPG, PNG, GIF, ICO - Fulfillments: image options, PDF, DOC(X), PPT(X), ODT, XLS(X), MP3, M4A, OGG, WAV, FLAC, MP4, M4V, MOV, WMV, AVI, MPG, OGV, 3GP/3G2, ZIP/RAR (archive)

When uploading an asset, the maximum accepted filesize using the contents method is 2mb, while the maximum for the url method is 10mb. If you are uploading an asset for digital delivery and experiencing issues with your file size via the contents method, you may consider the url method instead.

If you would like to associate a product image with a product (for example), you may use the "Products > Add asset to product" API.

Request

curl -X POST \
    "https://api.chec.io/v1/assets" \
    -H "X-Authorization: {token}" \
    -H "Content-Type: application/json" \
    -d '{"filename":"my-photo.jpg","contents":"VGVzdGluZw==","url":"https:\/\/mywebsite.com\/my\/image.jpg","private":false}'

// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
    "https://api.chec.io/v1/assets"
);

let headers = {
    "X-Authorization": "{token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "filename": "my-photo.jpg",
    "contents": "VGVzdGluZw==",
    "url": "https:\/\/mywebsite.com\/my\/image.jpg",
    "private": false
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/assets'
payload = {
    "filename": "my-photo.jpg",
    "contents": "VGVzdGluZw==",
    "url": "https:\/\/mywebsite.com\/my\/image.jpg",
    "private": false
}
headers = {
  'X-Authorization': '{token}',
  'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Response (201)

{
    "id": "ast_VNplJa1EaYwL60",
    "url": "https://assets.chec-cdn.com/merchant/123/assets/SH542KJlsd7h2Hdu-my-photo.jpg"
}

Request

POST /v1/assets

Body Parameters

Parameter Type Status Description
filename string required The asset filename
contents string optional Base 64 encoded file contents. Required if url is not provided.
url string optional A remote asset URL. Required if contents is not provided.
meta array optional An optional array of metadata to store on the asset
private boolean optional Whether this asset should be private on the CDN. Defaults to public

Update asset

Requires authentication

Update the details of an asset. Currently this endpoint is only used to complete uploads using the "presigned" method.

Request

curl -X PUT \
    "https://api.chec.io/v1/assets/1" \
    -H "X-Authorization: {token}" \
    -H "Content-Type: application/json" \
    -d '{"pending":true}'

// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
    "https://api.chec.io/v1/assets/1"
);

let headers = {
    "X-Authorization": "{token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "pending": true
}

fetch(url, {
    method: "PUT",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/assets/1'
payload = {
    "pending": true
}
headers = {
  'X-Authorization': '{token}',
  'Content-Type': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()

Response (200)

{
    "id": "ast_VNplJa1EaYwL60",
    "url": "https://assets.chec-cdn.com/merchant/123/assets/SH542KJlsd7h2Hdu-my-photo.jpg"
}

Request

PUT /v1/assets/{asset_id}

Body Parameters

Parameter Type Status Description
pending boolean required Set as true when the upload is complete

Delete asset

Requires authentication

Deletes an asset from the system, and from the Chec CDN. This action is not reversible.

Request

curl -X DELETE \
    "https://api.chec.io/v1/assets/ast_VNplJa1EaYwL60" \
    -H "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
    "https://api.chec.io/v1/assets/ast_VNplJa1EaYwL60"
);

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/assets/ast_VNplJa1EaYwL60'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()

Response (200)

{
    "deleted": true
}

Request

DELETE /v1/assets/{asset_id}

URL Parameters

Parameter Status Description
asset_id required The asset ID to delete

Carts

Create a cart

Requires authentication

Initializes a new cart, and returns the new cart object.

Request

curl -X GET \
    -G "https://api.chec.io/v1/carts" \
    -H "X-Authorization: {token}"
// Retrieve the customers current cart (tracked by their browser)
Commerce.cart.retrieve().then(cart => console.log(cart));

// Create a new cart rather than using any existing cart
Commerce.cart.refresh().then(cart => console.log(cart));
const url = new URL(
    "https://api.chec.io/v1/carts"
);

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/carts'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Response (201)

{
    "id": "cart_2Jwr9yJAeN4VlP",
    "created": 1479424851,
    "last_updated": 1479424851,
    "expires": 1482016851,
    "total_items": 0,
    "total_unique_items": 0,
    "subtotal": {
        "raw": 0,
        "formatted": "0.00",
        "formatted_with_symbol": "$0.00",
        "formatted_with_code": "0.00 USD"
    },
    "currency": {
        "code": "USD",
        "symbol": "$"
    },
    "discount_code": [],
    "hosted_checkout_url": "https://checkout.chec.io/cart/cart_2Jwr9yJAeN4VlP",
    "line_items": []
}

Request

GET /v1/carts

Retrieve a cart

Requires authentication

If successful, this will return the cart object.

Request

curl -X GET \
    -G "https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP" \
    -H "X-Authorization: {token}"
const cartId = 'cart_2Jwr9yJAeN4VlP';

Commerce.cart.retrieve(cartId).then(cart => console.log(cart));
const url = new URL(
    "https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP"
);

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Response (200)

{
    "id": "cart_2Jwr9yJAeN4VlP",
    "created": 1479424851,
    "last_updated": 1479429666,
    "expires": 1482016851,
    "total_items": 1,
    "total_unique_items": 1,
    "subtotal": {
        "raw": 1,
        "formatted": "1.00",
        "formatted_with_symbol": "$1.00",
        "formatted_with_code": "1.00 USD"
    },
    "currency": {
        "code": "USD",
        "symbol": "$"
    },
    "discount_code": [],
    "hosted_checkout_url": "https://checkout.chec.io/cart/cart_2Jwr9yJAeN4VlP",
    "line_items": [
        {
            "id": "item_7RyWOwmK5nEa2V",
            "product_id": "prod_R4OANwRqklvYL8",
            "name": "Cart Debug w/ Digital",
            "quantity": 1,
            "price": {
                "raw": 1,
                "formatted": "1.00",
                "formatted_with_symbol": "$1.00",
                "formatted_with_code": "1.00 USD"
            },
            "line_total": {
                "raw": 1,
                "formatted": "1.00",
                "formatted_with_symbol": "$1.00",
                "formatted_with_code": "1.00 USD"
            },
            "variants": []
        }
    ]
}

Request

GET /v1/carts/{cart_id}

URL Parameters

Parameter Status Description
cart_id required ID of the cart you wish to retrieve

Add item to cart

Requires authentication

Request

curl -X POST \
    "https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP" \
    -H "X-Authorization: {token}" \
    -H "Content-Type: application/json" \
    -d '{"id":"prod_R4OANwRqklvYL8","quantity":5}'

const productId = 'prod_R4OANwRqklvYL8';
const quantity = 5;

// Uses the cart that was previously created or retrieved
Commerce.cart.add(productId, quantity).then(json => console.log(json));
const url = new URL(
    "https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP"
);

let headers = {
    "X-Authorization": "{token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id": "prod_R4OANwRqklvYL8",
    "quantity": 5
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP'
payload = {
    "id": "prod_R4OANwRqklvYL8",
    "quantity": 5
}
headers = {
  'X-Authorization': '{token}',
  'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Response (200)

{
    "success": true,
    "event": "Cart.Item.Added",
    "line_item_id": "item_1ypbroE658n4ea",
    "product_id": "prod_4VPvL5zRQ5AQkX",
    "product_name": "Cart Debug Digital + Physical",
    "quantity": 5,
    "line_total": {
        "raw": 80,
        "formatted": "80.00",
        "formatted_with_symbol": "$80.00",
        "formatted_with_code": "80.00 USD"
    },
    "cart": {
        "id": "cart_2Jwr9yJAeN4VlP",
        "created": 1479424851,
        "last_updated": 1479430066,
        "expires": 1482016851,
        "total_items": 6,
        "total_unique_items": 2,
        "subtotal": {
            "raw": 81,
            "formatted": "81.00",
            "formatted_with_symbol": "$81.00",
            "formatted_with_code": "81.00 USD"
        },
        "currency": {
            "code": "USD",
            "symbol": "$"
        },
        "discount_code": [],
        "hosted_checkout_url": "https://checkout.chec.io/cart/cart_2Jwr9yJAeN4VlP",
        "line_items": [
            {
                "id": "item_7RyWOwmK5nEa2V",
                "product_id": "prod_R4OANwRqklvYL8",
                "name": "Cart Debug w/ Digital",
                "quantity": 1,
                "price": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "line_total": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "variants": []
            },
            {
                "id": "item_1ypbroE658n4ea",
                "product_id": "prod_4VPvL5zRQ5AQkX",
                "name": "Cart Debug Digital + Physical",
                "quantity": 5,
                "price": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "line_total": {
                    "raw": 80,
                    "formatted": "80.00",
                    "formatted_with_symbol": "$80.00",
                    "formatted_with_code": "80.00 USD"
                },
                "variants": [
                    {
                        "variant_id": "vrnt_Kvg9l6Apq51bB7",
                        "variant_name": "Variant #1",
                        "option_id": "optn_ZG6kVw7vOl2eDx",
                        "option_name": "Options 1",
                        "price": {
                            "raw": 5,
                            "formatted": "5.00",
                            "formatted_with_symbol": "$5.00",
                            "formatted_with_code": "5.00 USD"
                        }
                    },
                    {
                        "variant_id": "vrnt_kpnNwAyBrwmXB3",
                        "variant_name": "Variant #2",
                        "option_id": "optn_7RyWOwmG95nEa2",
                        "option_name": "Option 1",
                        "price": {
                            "raw": 10,
                            "formatted": "10.00",
                            "formatted_with_symbol": "$10.00",
                            "formatted_with_code": "10.00 USD"
                        }
                    }
                ]
            }
        ]
    }
}

Request

POST /v1/carts/{cart_id}

URL Parameters

Parameter Status Description
cart_id required ID of the cart you'd like to use

Body Parameters

Parameter Type Status Description
id string required ID of the product you'd like to add to the cart
quantity integer optional The quantity of the product you'd like to add (default: 1)
variant object optional The specific variant and variant option to use. The key should be your variant ID, and the value should be your variant option ID.

Update item in cart

Requires authentication

Updates the quantity or variant ID for the line item ID in the cart. If a quantity of zero is provided, the line item will be removed from the cart.

Request

curl -X PUT \
    "https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP/items/item_7RyWOwmK5nEa2V" \
    -H "X-Authorization: {token}" \
    -H "Content-Type: application/json" \
    -d '{"quantity":5}'

const lineItemId = 'item_7RyWOwmK5nEa2V';
const newQuantity = 3;

// Uses the cart that was previously created or retrieved
Commerce.cart.update(lineItemId, { quantity: newQuantity }).then(json => console.log(json));
const url = new URL(
    "https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP/items/item_7RyWOwmK5nEa2V"
);

let headers = {
    "X-Authorization": "{token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "quantity": 5
}

fetch(url, {
    method: "PUT",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP/items/item_7RyWOwmK5nEa2V'
payload = {
    "quantity": 5
}
headers = {
  'X-Authorization': '{token}',
  'Content-Type': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()

Response (200)

{
    "success": true,
    "event": "Cart.Item.Updated",
    "line_item_id": "item_1ypbroE658n4ea",
    "product_id": "prod_4VPvL5zRQ5AQkX",
    "product_name": "Cart Debug Digital + Physical",
    "quantity": 10,
    "line_total": {
        "raw": 160,
        "formatted": "160.00",
        "formatted_with_symbol": "$160.00",
        "formatted_with_code": "160.00 USD"
    },
    "cart": {
        "id": "cart_2Jwr9yJAeN4VlP",
        "created": 1479424851,
        "last_updated": 1479430198,
        "expires": 1482016851,
        "total_items": 11,
        "total_unique_items": 2,
        "subtotal": {
            "raw": 161,
            "formatted": "161.00",
            "formatted_with_symbol": "$161.00",
            "formatted_with_code": "161.00 USD"
        },
        "currency": {
            "code": "USD",
            "symbol": "$"
        },
        "discount_code": [],
        "hosted_checkout_url": "https://checkout.chec.io/cart/cart_2Jwr9yJAeN4VlP",
        "line_items": [
            {
                "id": "item_7RyWOwmK5nEa2V",
                "product_id": "prod_R4OANwRqklvYL8",
                "name": "Cart Debug w/ Digital",
                "quantity": 1,
                "price": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "line_total": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "variants": []
            },
            {
                "id": "item_1ypbroE658n4ea",
                "product_id": "prod_4VPvL5zRQ5AQkX",
                "name": "Cart Debug Digital + Physical",
                "quantity": 10,
                "price": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "line_total": {
                    "raw": 160,
                    "formatted": "160.00",
                    "formatted_with_symbol": "$160.00",
                    "formatted_with_code": "160.00 USD"
                },
                "variants": [
                    {
                        "variant_id": "vrnt_Kvg9l6Apq51bB7",
                        "variant_name": "Variant #1",
                        "option_id": "optn_ZG6kVw7vOl2eDx",
                        "option_name": "Options 1",
                        "price": {
                            "raw": 5,
                            "formatted": "5.00",
                            "formatted_with_symbol": "$5.00",
                            "formatted_with_code": "5.00 USD"
                        }
                    },
                    {
                        "variant_id": "vrnt_kpnNwAyBrwmXB3",
                        "variant_name": "Variant #2",
                        "option_id": "optn_7RyWOwmG95nEa2",
                        "option_name": "Option 1",
                        "price": {
                            "raw": 10,
                            "formatted": "10.00",
                            "formatted_with_symbol": "$10.00",
                            "formatted_with_code": "10.00 USD"
                        }
                    }
                ]
            }
        ]
    }
}

Request

PUT /v1/carts/{cart_id}/items/{line_item_id}

URL Parameters

Parameter Status Description
cart_id required ID of the cart you wish to update
line_item_id required ID of the line item you wish to update

Body Parameters

Parameter Type Status Description
quantity integer optional The new line item quantity to use
variant array optional The specific variant and variant option to use. The key should be your variant ID, and the value should be your variant option ID.

Delete cart

Requires authentication

Removes a cart entirely.

Request

curl -X DELETE \
    "https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP" \
    -H "X-Authorization: {token}"
// Uses the cart that was previously created or retrieved
Commerce.cart.delete().then(json => console.log(json));
const url = new URL(
    "https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP"
);

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()

Response (200)

{
    "success": true,
    "event": "Cart.Deleted",
    "cart_id": "cart_GKwbzLLjMbbvw3"
}

Request

DELETE /v1/carts/{cart_id}

URL Parameters

Parameter Status Description
cart_id required ID of the cart you wish to delete

Response Parameters

Parameter Type Description
success boolean Whether the cart was deleted
event string The event name, e.g. "Cart.Delete"
cart_id string The cart ID that was deleted

Empty cart

Requires authentication

Clears the contents of the cart.

Request

curl -X DELETE \
    "https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP/items" \
    -H "X-Authorization: {token}"
// Uses the cart that was previously created or retrieved
Commerce.cart.empty().then(json => console.log(json));
const url = new URL(
    "https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP/items"
);

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP/items'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()

Response (200)

{
    "success": true,
    "event": "Cart.Emptied",
    "cart": {
        "id": "cart_2Jwr9yJAeN4VlP",
        "created": 1479424851,
        "last_updated": 1479430274,
        "expires": 1482016851,
        "total_items": 0,
        "total_unique_items": 0,
        "subtotal": {
            "raw": 0,
            "formatted": "0.00",
            "formatted_with_symbol": "$0.00",
            "formatted_with_code": "0.00 USD"
        },
        "currency": {
            "code": "USD",
            "symbol": "$"
        },
        "discount_code": [],
        "hosted_checkout_url": "https://checkout.chec.io/cart/cart_2Jwr9yJAeN4VlP",
        "line_items": []
    }
}

Request

DELETE /v1/carts/{cart_id}/items

URL Parameters

Parameter Status Description
cart_id required ID of the cart you wish to empty

Remove item from cart

Requires authentication

Removes the specified line item from the cart.

Request

curl -X DELETE \
    "https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP/items/item_7RyWOwmK5nEa2V" \
    -H "X-Authorization: {token}"
const lineItemId = 'item_7RyWOwmK5nEa2V';

// Uses the cart that was previously created or retrieved
Commerce.cart.remove(lineItemId).then(json => console.log(json));
const url = new URL(
    "https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP/items/item_7RyWOwmK5nEa2V"
);

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP/items/item_7RyWOwmK5nEa2V'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()

Response (200)

{
    "success": true,
    "event": "Cart.Item.Removed",
    "line_item_id": "item_1ypbroE658n4ea",
    "cart": {
        "id": "cart_2Jwr9yJAeN4VlP",
        "created": 1479424851,
        "last_updated": 1479430227,
        "expires": 1482016851,
        "total_items": 1,
        "total_unique_items": 1,
        "subtotal": {
            "raw": 1,
            "formatted": "1.00",
            "formatted_with_symbol": "$1.00",
            "formatted_with_code": "1.00 USD"
        },
        "currency": {
            "code": "USD",
            "symbol": "$"
        },
        "discount_code": [],
        "hosted_checkout_url": "https://checkout.chec.io/cart/cart_2Jwr9yJAeN4VlP",
        "line_items": [
            {
                "id": "item_7RyWOwmK5nEa2V",
                "product_id": "prod_R4OANwRqklvYL8",
                "name": "Cart Debug w/ Digital",
                "quantity": 1,
                "price": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "line_total": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "variants": []
            }
        ]
    }
}

Request

DELETE /v1/carts/{cart_id}/items/{line_item_id}

URL Parameters

Parameter Status Description
cart_id required ID of the cart you wish to remove items from
line_item_id required ID of the line item you wish to remove

Categories

List all categories

Requires authentication

Returns a list of all of a merchant's product categories.

Request

curl -X GET \
    -G "https://api.chec.io/v1/categories" \
    -H "X-Authorization: {token}"
Commerce.categories.list().then(categories => console.log(categories.data));
const url = new URL(
    "https://api.chec.io/v1/categories"
);

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/categories'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Response (200)

{
    "data": [
        {
            "id": "cat_1ypbroE658n4ea",
            "slug": "shoes",
            "name": "Shoes and Footwear",
            "description": "Get great deals on shoes",
            "created": 1550926172,
            "meta": {
                "season": "summer"
            }
        },
        {
            "id": "cat_1ypbroE658n4ea",
            "slug": "shoes",
            "name": "Shoes and Footwear",
            "description": "Get great deals on shoes",
            "created": 1550926172,
            "meta": {
                "season": "summer"
            }
        }
    ],
    "meta": {
        "pagination": {
            "total": 2,
            "count": 2,
            "per_page": 2,
            "current_page": 1,
            "total_pages": 1,
            "links": {}
        }
    }
}

Request

GET /v1/categories

Response Parameters

Parameter Type Description
id string The category ID
slug string A given "slug" for the category. Should be URL safe.
name string A given name for the category
description string A given description for the category
created integer The unix timestamp for when the order was created
meta A custom object that can be set on a category

Retrieve category

Requires authentication

Gets a detailed dataset for the provided category ID.

Request

curl -X GET \
    -G "https://api.chec.io/v1/categories/cat_7RqEv5xKOoZz4j?type=slug" \
    -H "X-Authorization: {token}"
// Fetch a category by ID
const categoryId = 'cat_7RqEv5xKOoZz4j';
Commerce.categories.retrieve(categoryId)
  .then(category => console.log(category));

// Fetch a category by slug
const categorySlug = 'shoes'
Commerce.categories.retrieve(categorySlug, { type: 'slug' })
  .then(category => console.log(category));
const url = new URL(
    "https://api.chec.io/v1/categories/cat_7RqEv5xKOoZz4j"
);

let params = {
    "type": "slug",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/categories/cat_7RqEv5xKOoZz4j'
params = {
  'type': 'slug',
}
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()

Response (200)

{
    "id": "cat_1ypbroE658n4ea",
    "slug": "shoes",
    "name": "Shoes and Footwear",
    "description": "Get great deals on shoes",
    "created": 1550926172,
    "meta": {
        "season": "summer"
    }
}

Request

GET /v1/categories/{id}

URL Parameters

Parameter Status Description
id required Category ID to retrieve

Query Parameters

Parameter Status Description
type optional Filter by ID or slug

Response Parameters

Parameter Type Description
id string The category ID
slug string A given "slug" for the category. Should be URL safe.
name string A given name for the category
description string A given description for the category
created integer The unix timestamp for when the order was created
meta A custom object that can be set on a category

Create category

Requires authentication

Create a new category with the provided slug, name, and description.

Request

curl -X POST \
    "https://api.chec.io/v1/categories" \
    -H "X-Authorization: {token}" \
    -H "Content-Type: application/json" \
    -d '{"slug":"running-shoes","name":"Running shoes","description":"Running shoes are essential to support the arches of the foot."}'

// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
    "https://api.chec.io/v1/categories"
);

let headers = {
    "X-Authorization": "{token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "slug": "running-shoes",
    "name": "Running shoes",
    "description": "Running shoes are essential to support the arches of the foot."
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/categories'
payload = {
    "slug": "running-shoes",
    "name": "Running shoes",
    "description": "Running shoes are essential to support the arches of the foot."
}
headers = {
  'X-Authorization': '{token}',
  'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Response (201)

{
    "id": "cat_7RqEv5xKOoZz4j",
    "slug": "running-shoes",
    "name": "Running shoes",
    "description": "Running shoes are essential to support the arches of the foot.",
    "created": 1568409246,
    "meta": {
        "season": "winter"
    }
}

Request

POST /v1/categories

Body Parameters

Parameter Type Status Description
slug string required Category slug, URL segment, or permalink
name string required Category name
description string optional Category description
meta object optional Optional metadata to store on the category

Update category

Requires authentication

Update the category with the provided slug, name, and description.

Request

curl -X PUT \
    "https://api.chec.io/v1/categories/cat_7RqEv5xKOoZz4j" \
    -H "X-Authorization: {token}" \
    -H "Content-Type: application/json" \
    -d '{"slug":"hiking-boots","name":"Hiking boots","description":"Hiking boots are essential to support the structural integrity of your feet."}'

// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
    "https://api.chec.io/v1/categories/cat_7RqEv5xKOoZz4j"
);

let headers = {
    "X-Authorization": "{token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "slug": "hiking-boots",
    "name": "Hiking boots",
    "description": "Hiking boots are essential to support the structural integrity of your feet."
}

fetch(url, {
    method: "PUT",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/categories/cat_7RqEv5xKOoZz4j'
payload = {
    "slug": "hiking-boots",
    "name": "Hiking boots",
    "description": "Hiking boots are essential to support the structural integrity of your feet."
}
headers = {
  'X-Authorization': '{token}',
  'Content-Type': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()

Response (200)

{
    "id": "cat_7RqEv5xKOoZz4j",
    "slug": "hiking-boots",
    "name": "Hiking boots",
    "description": "Hiking boots are essential to support the structural integrity of your feet.",
    "created": 1585792315,
    "meta": []
}

Request

PUT /v1/categories/{id}

URL Parameters

Parameter Status Description
id required Category ID to update

Body Parameters

Parameter Type Status Description
slug string required Category slug, URL segment, or permalink
name string required Category name
description string optional Category description
meta object optional Optional metadata to store on the category

Delete category

Requires authentication

Deletes a category.

Request

curl -X DELETE \
    "https://api.chec.io/v1/categories/cat_7RqEv5xKOoZz4j" \
    -H "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
    "https://api.chec.io/v1/categories/cat_7RqEv5xKOoZz4j"
);

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/categories/cat_7RqEv5xKOoZz4j'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()

Response (200)

{
    "id": "cat_7RqEv5xKOoZz4j",
    "success": true
}

Request

DELETE /v1/categories/{id}

URL Parameters

Parameter Status Description
id required Category ID to delete

Checkout

Generate token

Requires authentication

Generates a checkout token which can be used to initiate the process of capturing an order from a cart. To generate a checkout token you need to provide an ID for either the product or cart, or the product’s permalink.

If successful, this will return the checkout token object which should contain everything you need to create the checkout.

Request

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/YfFoyi?type=permalink" \
    -H "X-Authorization: {token}"
// Generate a token from a product permalink
const productPermalink = 'YfFoyi';
Commerce.checkout.generateTokenFrom('permalink', productPermalink)
  .then(response => console.log(response.id));

// Generate a token from a product ID
const productId = 'prod_R4OANwRqklvYL8';
Commerce.checkout.generateTokenFrom('product_id', productId)
  .then(response => console.log(response.id));

// Generate a token from the cart that was previously created or retrieved
Commerce.checkout.generateTokenFrom('cart', Commerce.cart.id())
  .then(response => console.log(response.id));
const url = new URL(
    "https://api.chec.io/v1/checkouts/YfFoyi"
);

let params = {
    "type": "permalink",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/checkouts/YfFoyi'
params = {
  'type': 'permalink',
}
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()

Response (201)

{
    "id": "chkt_L5z3kmQpdpkGlA",
    "cart_id": "cart_1ql93d0MGB9poz",
    "created": 1479499329,
    "expires": 1479672129,
    "analytics": {
        "google": {
            "settings": {
                "tracking_id": "UA-76990030-2",
                "linked_domains": [
                    "checkout.chec.io"
                ]
            }
        }
    },
    "conditionals": {
        "collects_fullname": false,
        "collects_shipping_address": true,
        "collects_billing_address": false,
        "has_physical_delivery": true,
        "has_digital_delivery": true,
        "has_available_discounts": true,
        "has_pay_what_you_want": false,
        "collects_extrafields": true,
        "is_cart_free": false
    },
    "collects": {
        "fullname": false,
        "shipping_address": true,
        "billing_address": false,
        "extrafields": true
    },
    "has": {
        "physical_delivery": true,
        "digital_delivery": true,
        "available_discounts": true,
        "pay_what_you_want": false
    },
    "is": {
        "cart_free": false
    },
    "line_items": [
        {
            "id": "item_7RyWOwmK5nEa2V",
            "product_id": "prod_4VPvL5zRQ5AQkX",
            "name": "Cart Debug Digital + Physical",
            "image": null,
            "description": null,
            "quantity": 1,
            "price": {
                "raw": 1,
                "formatted": "1.00",
                "formatted_with_symbol": "$1.00",
                "formatted_with_code": "1.00 USD"
            },
            "subtotal": {
                "raw": 1,
                "formatted": "1.00",
                "formatted_with_symbol": "$1.00",
                "formatted_with_code": "1.00 USD"
            },
            "variants": [
                {
                    "id": "vrnt_Kvg9l6Apq51bB7",
                    "name": "Variant #1",
                    "options": [
                        {
                            "id": "optn_ZG6kVw7vOl2eDx",
                            "name": "Options 1",
                            "price": {
                                "raw": 5,
                                "formatted": "5.00",
                                "formatted_with_symbol": "$5.00",
                                "formatted_with_code": "5.00 USD"
                            }
                        },
                        {
                            "id": "optn_QO3bR5XDk5nzdj",
                            "name": "Option 2",
                            "price": {
                                "raw": 10,
                                "formatted": "10.00",
                                "formatted_with_symbol": "$10.00",
                                "formatted_with_code": "10.00 USD"
                            }
                        }
                    ]
                },
                {
                    "id": "vrnt_kpnNwAyBrwmXB3",
                    "name": "Variant #2",
                    "options": [
                        {
                            "id": "optn_7RyWOwmG95nEa2",
                            "name": "Option 1",
                            "price": {
                                "raw": 10,
                                "formatted": "10.00",
                                "formatted_with_symbol": "$10.00",
                                "formatted_with_code": "10.00 USD"
                            }
                        },
                        {
                            "id": "optn_1ypbroEyno8n4e",
                            "name": "Option 2",
                            "price": {
                                "raw": 20,
                                "formatted": "20.00",
                                "formatted_with_symbol": "$20.00",
                                "formatted_with_code": "20.00 USD"
                            }
                        }
                    ]
                }
            ],
            "conditionals": {
                "is_active": true,
                "is_free": false,
                "is_pay_what_you_want": false,
                "is_quantity_limited": false,
                "is_sold_out": false,
                "has_digital_delivery": true,
                "has_physical_delivery": true,
                "has_images": false,
                "has_video": false,
                "collects_fullname": false,
                "collects_shipping_address": true,
                "collects_billing_address": false,
                "collects_extrafields": false
            },
            "is": {
                "active": true,
                "free": false,
                "pay_what_you_want": false,
                "quantity_limited": false,
                "sold_out": false
            },
            "has": {
                "digital_delivery": true,
                "physical_delivery": true,
                "images": false,
                "video": false
            },
            "collects": {
                "fullname": false,
                "shipping_address": true,
                "billing_address": false,
                "extrafields": false
            }
        },
        {
            "id": "item_1ypbroE658n4ea",
            "product_id": "prod_4VPvL5zRQ5AQkX",
            "name": "Cart Debug Digital + Physical",
            "image": null,
            "description": null,
            "quantity": 1,
            "price": {
                "raw": 1,
                "formatted": "1.00",
                "formatted_with_symbol": "$1.00",
                "formatted_with_code": "1.00 USD"
            },
            "subtotal": {
                "raw": 1,
                "formatted": "1.00",
                "formatted_with_symbol": "$1.00",
                "formatted_with_code": "1.00 USD"
            },
            "variants": [
                {
                    "id": "vrnt_Kvg9l6Apq51bB7",
                    "name": "Variant #1",
                    "options": [
                        {
                            "id": "optn_ZG6kVw7vOl2eDx",
                            "name": "Options 1",
                            "price": {
                                "raw": 5,
                                "formatted": "5.00",
                                "formatted_with_symbol": "$5.00",
                                "formatted_with_code": "5.00 USD"
                            }
                        },
                        {
                            "id": "optn_QO3bR5XDk5nzdj",
                            "name": "Option 2",
                            "price": {
                                "raw": 10,
                                "formatted": "10.00",
                                "formatted_with_symbol": "$10.00",
                                "formatted_with_code": "10.00 USD"
                            }
                        }
                    ]
                },
                {
                    "id": "vrnt_kpnNwAyBrwmXB3",
                    "name": "Variant #2",
                    "options": [
                        {
                            "id": "optn_7RyWOwmG95nEa2",
                            "name": "Option 1",
                            "price": {
                                "raw": 10,
                                "formatted": "10.00",
                                "formatted_with_symbol": "$10.00",
                                "formatted_with_code": "10.00 USD"
                            }
                        },
                        {
                            "id": "optn_1ypbroEyno8n4e",
                            "name": "Option 2",
                            "price": {
                                "raw": 20,
                                "formatted": "20.00",
                                "formatted_with_symbol": "$20.00",
                                "formatted_with_code": "20.00 USD"
                            }
                        }
                    ]
                }
            ],
            "conditionals": {
                "is_active": true,
                "is_free": false,
                "is_pay_what_you_want": false,
                "is_quantity_limited": false,
                "is_sold_out": false,
                "has_digital_delivery": true,
                "has_physical_delivery": true,
                "has_images": false,
                "has_video": false,
                "collects_fullname": false,
                "collects_shipping_address": true,
                "collects_billing_address": false,
                "collects_extrafields": false
            },
            "is": {
                "active": true,
                "free": false,
                "pay_what_you_want": false,
                "quantity_limited": false,
                "sold_out": false
            },
            "has": {
                "digital_delivery": true,
                "physical_delivery": true,
                "images": false,
                "video": false
            },
            "collects": {
                "fullname": false,
                "shipping_address": true,
                "billing_address": false,
                "extrafields": false
            }
        }
    ],
    "merchant": {
        "id": 2,
        "business_name": "Test, Inc.",
        "business_description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent auctor sodales magna convallis laoreet. Vestibulum odio neque, euismod sit amet consectetur ullamcorper, ornare ultricies.",
        "currency": {
            "symbol": "$",
            "code": "USD"
        },
        "support_email": "hello@trychec.com",
        "logo": "https://cdn.chec.io/merchants/2/local/images/icon/8b8709949f5eb64b6f9bea722954253d89d599bc56ffb8d5e6773|Commecejs_logo.png",
        "logo_shape": "squared",
        "cover": "https://cdn.chec.io/merchants/2/local/images/cover/18bb006778c1b3efe0b46a063b34ce664a49f5dc5700c83ec7293|Chec.Twitter.Header copy.png",
        "has": {
            "logo": true,
            "cover": true,
            "business_description": true
        }
    },
    "extrafields": [
        {
            "id": "extr_7RyWOwmK5nEa2V",
            "name": "Website",
            "type": "text",
            "required": false,
            "options": null
        }
    ],
    "gateways": {
        "available": {
            "test_gateway": true,
            "stripe": true,
            "chec": false,
            "paypal": true
        },
        "available_count": 3,
        "test_gateway": {
            "type": "card",
            "settings": []
        },
        "stripe": {
            "type": "card",
            "settings": {
                "publishable_key": "pk_test_zURSwkv193kOIY2bfSahD0bj"
            },
            "cards_accepted": [
                "visa",
                "mastercard",
                "amex"
            ]
        },
        "paypal": {
            "type": "third_party",
            "settings": {
                "email": "devan.koshal+merchant@gmail.com"
            }
        }
    },
    "shipping_methods": [
        {
            "id": "ship_31q0o3e21lDdjR",
            "description": "USPS",
            "price": {
                "raw": 0.99,
                "formatted": "0.99",
                "formatted_with_symbol": "$0.99",
                "formatted_with_code": "0.99 USD"
            },
            "countries": [
                "US"
            ]
        },
        {
            "id": "ship_dKvg9l6vl1bB76",
            "description": "Domestic",
            "price": {
                "raw": 0,
                "formatted": "0.00",
                "formatted_with_symbol": "$0.00",
                "formatted_with_code": "0.00 USD"
            },
            "countries": [
                "US"
            ]
        }
    ],
    "live": {
        "merchant_id": 2,
        "currency": {
            "code": "USD",
            "symbol": "$"
        },
        "line_items": [
            {
                "id": "item_7RyWOwmK5nEa2V",
                "product_id": "prod_4VPvL5zRQ5AQkX",
                "product_name": "Cart Debug Digital + Physical",
                "quantity": 5,
                "price": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "line_total": {
                    "raw": 80,
                    "formatted": "80.00",
                    "formatted_with_symbol": "$80.00",
                    "formatted_with_code": "80.00 USD"
                },
                "variants": [
                    {
                        "variant_id": "vrnt_Kvg9l6Apq51bB7",
                        "option_id": "optn_ZG6kVw7vOl2eDx",
                        "variant_name": "Variant #1",
                        "option_name": "Options 1",
                        "price": {
                            "raw": 5,
                            "formatted": "5.00",
                            "formatted_with_symbol": "$5.00",
                            "formatted_with_code": "5.00 USD"
                        }
                    },
                    {
                        "variant_id": "vrnt_kpnNwAyBrwmXB3",
                        "option_id": "optn_7RyWOwmG95nEa2",
                        "variant_name": "Variant #2",
                        "option_name": "Option 1",
                        "price": {
                            "raw": 10,
                            "formatted": "10.00",
                            "formatted_with_symbol": "$10.00",
                            "formatted_with_code": "10.00 USD"
                        }
                    }
                ],
                "tax": {
                    "is_taxable": false,
                    "taxable_amount": null,
                    "amount": null,
                    "breakdown": null
                }
            },
            {
                "id": "item_1ypbroE658n4ea",
                "product_id": "prod_4VPvL5zRQ5AQkX",
                "product_name": "Cart Debug Digital + Physical",
                "quantity": 5,
                "price": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "line_total": {
                    "raw": 30,
                    "formatted": "30.00",
                    "formatted_with_symbol": "$30.00",
                    "formatted_with_code": "30.00 USD"
                },
                "variants": [
                    {
                        "variant_id": "vrnt_Kvg9l6Apq51bB7",
                        "option_id": "optn_ZG6kVw7vOl2eDx",
                        "variant_name": "Variant #1",
                        "option_name": "Options 1",
                        "price": {
                            "raw": 5,
                            "formatted": "5.00",
                            "formatted_with_symbol": "$5.00",
                            "formatted_with_code": "5.00 USD"
                        }
                    }
                ],
                "tax": {
                    "is_taxable": false,
                    "taxable_amount": null,
                    "amount": null,
                    "breakdown": null
                }
            }
        ],
        "subtotal": {
            "raw": 110,
            "formatted": "110.00",
            "formatted_with_symbol": "$110.00",
            "formatted_with_code": "110.00 USD"
        },
        "discount": [],
        "shipping": {
            "available_options": [
                {
                    "id": "ship_31q0o3e21lDdjR",
                    "description": "USPS",
                    "price": {
                        "raw": 0.99,
                        "formatted": "0.99",
                        "formatted_with_symbol": "$0.99",
                        "formatted_with_code": "0.99 USD"
                    },
                    "countries": [
                        "US"
                    ]
                },
                {
                    "id": "ship_dKvg9l6vl1bB76",
                    "description": "Domestic",
                    "price": {
                        "raw": 0,
                        "formatted": "0.00",
                        "formatted_with_symbol": "$0.00",
                        "formatted_with_code": "0.00 USD"
                    },
                    "countries": [
                        "US"
                    ]
                }
            ],
            "price": {
                "raw": 0,
                "formatted": "0.00",
                "formatted_with_symbol": "$0.00",
                "formatted_with_code": "0.00 USD"
            }
        },
        "tax": {
            "amount": {
                "raw": 0,
                "formatted": "0.00",
                "formatted_with_symbol": "$0.00",
                "formatted_with_code": "0.00 USD"
            }
        },
        "total": {
            "raw": 110,
            "formatted": "110.00",
            "formatted_with_symbol": "$110.00",
            "formatted_with_code": "110.00 USD"
        },
        "total_with_tax": {
            "raw": 110,
            "formatted": "110.00",
            "formatted_with_symbol": "$110.00",
            "formatted_with_code": "110.00 USD"
        },
        "pay_what_you_want": {
            "enabled": false,
            "minimum": null,
            "customer_set_price": null
        }
    }
}

Request

GET /v1/checkouts/{id}

URL Parameters

Parameter Status Description
id required The ID of the product or cart, or the permalink of the product

Query Parameters

Parameter Status Description
type optional The type of identifier. Types: product_id, cart, permalink (default)

Capture order

Requires authentication

Captures an order and payment by providing the checkout token and necessary data for the order to be completed.

Request

We utilize key => value multidimensional arrays to immediately associate values with their parent(s) ID. For example with line items, the key would be the line_item_id and related values would be nested under that key.

Response

Returns the order object on success, unless using PayPal, in which case the response returned will contain the information required for you to redirect your customer to PayPal in order to complete their transaction.

Request

curl -X POST \
    "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA" \
    -H "X-Authorization: {token}" \
    -H "Content-Type: application/json" \
    -d '{"line_items":{"item_7RyWOwmK5nEa2V":{"quantity":1,"variants":{"vrnt_p6dP5g0M4ln7kA":"optn_DeN1ql93doz3ym"}}},"discount_code":"20off","extrafields":{"extr_Kvg9l6zvnl1bB7":"415-111-2222","extr_bWZ3l8zLNokpEQ":"google.com"},"customer":{"id":"cstmr_7RyWOwmK5nEa2V","firstname":"John","lastname":"Doe","email":"john.doe@example.com"},"shipping":{"name":"John Doe","street":"123 Fake St","town_city":"San Francisco","county_state":"California","postal_zip_code":"94103","country":"US"},"fulfillment":{"shipping_method":"ship_7RyWOwmK5nEa2V"},"billing":{"name":"John Doe","street":"234 Fake St","town_city":"San Francisco","county_state":"California","postal_zip_code":"94103","country":"US"},"payment":{"gateway":"stripe","card":{"number":"4242 4242 4242 4242","expires":"11\/19","cvc":123,"postal_zip_code":"94107","token":"irh98298g49","nonce":293074902374234},"razorpay":{"payment_id":"839h8d89wg87r3cz3trbis8"}},"pay_what_you_want":"149.99"}'

Commerce.checkout.capture('chkt_959gvxcZ6lnJ7', {
  line_items: {
    // Key is the line item ID for our test product
    item_7RyWOwmK5nEa2V: {
      quantity: 1,
      variants: {
        // Key is the variant ID for "Color", value is the option ID for "Blue"
        vrnt_bO6J5apWnVoEjp: 'optn_Op1YoVppylXLv9',
        // Key is the variant ID for "Size", value is the option ID for "Small"
        vrnt_4WJvlKpg7pwbYV: 'optn_zkK6oL99G5Xn0Q',
      }
    }
  },
  customer: {
    firstname: 'John',
    lastname: 'Doe',
    email: 'john.doe@example.com',
  },
  shipping: {
    name: 'John Doe',
    street: '123 Fake St',
    town_city: 'San Francisco',
    county_state: 'CA',
    postal_zip_code: '94103',
    country: 'US',
  },
  fulfillment: {
    // The shipping method ID for "USPS Ground" (for example)
    // You can use commerce.checkout.getShippingOptions() to get a list
    shipping_method: 'ship_1ypbroE658n4ea',
  },
  payment: {
    // Test Gateway is enabled by default, and is used when you submit orders with
    // your sandbox API key
    gateway: 'test_gateway',
    card: {
      number: '4242 4242 4242 4242',
      expiry_month: '01',
      expiry_year: '2023',
      cvc: '123',
      postal_zip_code: '94103',
    },
  },
})
  .then(response => {
    console.log('Great, your checkout was captured successfully! Checkout the response object for receipt info.');
  })
  .catch(error => console.error(error));
const url = new URL(
    "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA"
);

let headers = {
    "X-Authorization": "{token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "line_items": {
        "item_7RyWOwmK5nEa2V": {
            "quantity": 1,
            "variants": {
                "vrnt_p6dP5g0M4ln7kA": "optn_DeN1ql93doz3ym"
            }
        }
    },
    "discount_code": "20off",
    "extrafields": {
        "extr_Kvg9l6zvnl1bB7": "415-111-2222",
        "extr_bWZ3l8zLNokpEQ": "google.com"
    },
    "customer": {
        "id": "cstmr_7RyWOwmK5nEa2V",
        "firstname": "John",
        "lastname": "Doe",
        "email": "john.doe@example.com"
    },
    "shipping": {
        "name": "John Doe",
        "street": "123 Fake St",
        "town_city": "San Francisco",
        "county_state": "California",
        "postal_zip_code": "94103",
        "country": "US"
    },
    "fulfillment": {
        "shipping_method": "ship_7RyWOwmK5nEa2V"
    },
    "billing": {
        "name": "John Doe",
        "street": "234 Fake St",
        "town_city": "San Francisco",
        "county_state": "California",
        "postal_zip_code": "94103",
        "country": "US"
    },
    "payment": {
        "gateway": "stripe",
        "card": {
            "number": "4242 4242 4242 4242",
            "expires": "11\/19",
            "cvc": 123,
            "postal_zip_code": "94107",
            "token": "irh98298g49",
            "nonce": 293074902374234
        },
        "razorpay": {
            "payment_id": "839h8d89wg87r3cz3trbis8"
        }
    },
    "pay_what_you_want": "149.99"
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA'
payload = {
    "line_items": {
        "item_7RyWOwmK5nEa2V": {
            "quantity": 1,
            "variants": {
                "vrnt_p6dP5g0M4ln7kA": "optn_DeN1ql93doz3ym"
            }
        }
    },
    "discount_code": "20off",
    "extrafields": {
        "extr_Kvg9l6zvnl1bB7": "415-111-2222",
        "extr_bWZ3l8zLNokpEQ": "google.com"
    },
    "customer": {
        "id": "cstmr_7RyWOwmK5nEa2V",
        "firstname": "John",
        "lastname": "Doe",
        "email": "john.doe@example.com"
    },
    "shipping": {
        "name": "John Doe",
        "street": "123 Fake St",
        "town_city": "San Francisco",
        "county_state": "California",
        "postal_zip_code": "94103",
        "country": "US"
    },
    "fulfillment": {
        "shipping_method": "ship_7RyWOwmK5nEa2V"
    },
    "billing": {
        "name": "John Doe",
        "street": "234 Fake St",
        "town_city": "San Francisco",
        "county_state": "California",
        "postal_zip_code": "94103",
        "country": "US"
    },
    "payment": {
        "gateway": "stripe",
        "card": {
            "number": "4242 4242 4242 4242",
            "expires": "11\/19",
            "cvc": 123,
            "postal_zip_code": "94107",
            "token": "irh98298g49",
            "nonce": 293074902374234
        },
        "razorpay": {
            "payment_id": "839h8d89wg87r3cz3trbis8"
        }
    },
    "pay_what_you_want": "149.99"
}
headers = {
  'X-Authorization': '{token}',
  'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Response (200)

{
    "id": "ord_p7ZAMo1xwNJ4xX",
    "cart_id": "cart_XmwD43GnjbAXwr",
    "checkout_token_id": "chkt_Lwj1jnaN6W9pl3",
    "created": 1479510592,
    "redirect": false,
    "customer_reference": "TSTNC-21",
    "status_payment": "paid",
    "status_fulfillment": "not_fulfilled",
    "customer": {
        "email": "hello@chec.io"
    },
    "extrafields": [
        {
            "id": "extr_7RyWOwmK5nEa2V",
            "name": "Test",
            "value": "Test",
            "required": true
        },
        {
            "id": "extr_1ypbroE658n4ea",
            "name": "Website",
            "value": "commercejs.com",
            "required": false
        }
    ],
    "shipping": {
        "name": "John Doe",
        "street": "1161 Mission St",
        "town_city": "San Francisco",
        "county_state": "CA",
        "postal_zip_code": "94103",
        "country": "US"
    },
    "billing": null,
    "order": {
        "line_items": [
            {
                "id": "item_7RyWOwmK5nEa2V",
                "product_id": "prod_4VPvL5zRQ5AQkX",
                "product_name": "Cart Debug Digital + Physical",
                "quantity": 1,
                "price": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "line_total": {
                    "raw": 31,
                    "formatted": "31.00",
                    "formatted_with_symbol": "$31.00",
                    "formatted_with_code": "31.00 USD"
                },
                "variants": [
                    {
                        "variant_id": "vrnt_kpnNwAyBrwmXB3",
                        "option_id": "optn_PAYrQlWDbwnbR4",
                        "variant_name": "Variant #2",
                        "option_name": "Option 2",
                        "price": {
                            "raw": 20,
                            "formatted": "20.00",
                            "formatted_with_symbol": "$20.00",
                            "formatted_with_code": "20.00 USD"
                        }
                    },
                    {
                        "variant_id": "vrnt_Kvg9l6Apq51bB7",
                        "option_id": "optn_r31q0o3E8lDdjR",
                        "variant_name": "Variant #1",
                        "option_name": "Option 2",
                        "price": {
                            "raw": 10,
                            "formatted": "10.00",
                            "formatted_with_symbol": "$10.00",
                            "formatted_with_code": "10.00 USD"
                        }
                    }
                ],
                "tax": {
                    "is_taxable": true,
                    "taxable_amount": 31,
                    "amount": 2.72,
                    "breakdown": [
                        {
                            "amount": 1.94,
                            "rate": 0.0625,
                            "rate_percentage": "6.25%",
                            "type": "state"
                        },
                        {
                            "amount": 0,
                            "rate": 0,
                            "rate_percentage": "0%",
                            "type": "city"
                        },
                        {
                            "amount": 0.08,
                            "rate": 0.0025,
                            "rate_percentage": "0.25%",
                            "type": "county"
                        },
                        {
                            "amount": 0.7,
                            "rate": 0.0225,
                            "rate_percentage": "2.25%",
                            "type": "district"
                        }
                    ]
                }
            },
            {
                "id": "item_1ypbroE658n4ea",
                "product_id": "prod_2yA6nldRBoEWbz",
                "product_name": "Cart Debug W/ Shipping",
                "quantity": 1,
                "price": {
                    "raw": 11,
                    "formatted": "11.00",
                    "formatted_with_symbol": "$11.00",
                    "formatted_with_code": "11.00 USD"
                },
                "line_total": {
                    "raw": 11,
                    "formatted": "11.00",
                    "formatted_with_symbol": "$11.00",
                    "formatted_with_code": "11.00 USD"
                },
                "variants": [],
                "tax": {
                    "is_taxable": true,
                    "taxable_amount": 11,
                    "amount": 0.97,
                    "breakdown": [
                        {
                            "amount": 0.69,
                            "rate": 0.0625,
                            "rate_percentage": "6.25%",
                            "type": "state"
                        },
                        {
                            "amount": 0,
                            "rate": 0,
                            "rate_percentage": "0%",
                            "type": "city"
                        },
                        {
                            "amount": 0.03,
                            "rate": 0.0025,
                            "rate_percentage": "0.25%",
                            "type": "county"
                        },
                        {
                            "amount": 0.25,
                            "rate": 0.0225,
                            "rate_percentage": "2.25%",
                            "type": "district"
                        }
                    ]
                }
            },
            {
                "id": "item_dKvg9l6vl1bB76",
                "product_id": "prod_Ekd6Ll2KYwV2mj",
                "product_name": "Cart Debug",
                "quantity": 1,
                "price": {
                    "raw": 12,
                    "formatted": "12.00",
                    "formatted_with_symbol": "$12.00",
                    "formatted_with_code": "12.00 USD"
                },
                "line_total": {
                    "raw": 12,
                    "formatted": "12.00",
                    "formatted_with_symbol": "$12.00",
                    "formatted_with_code": "12.00 USD"
                },
                "variants": [],
                "tax": {
                    "is_taxable": false,
                    "taxable_amount": 0,
                    "amount": 0,
                    "breakdown": null
                }
            }
        ],
        "subtotal": {
            "raw": 54,
            "formatted": "54.00",
            "formatted_with_symbol": "$54.00",
            "formatted_with_code": "54.00 USD"
        },
        "discount": [],
        "shipping": {
            "id": "ship_31q0o3e21lDdjR",
            "description": "USPS",
            "price": {
                "raw": 0.99,
                "formatted": "0.99",
                "formatted_with_symbol": "$0.99",
                "formatted_with_code": "0.99 USD"
            }
        },
        "tax": {
            "amount": {
                "raw": 3.69,
                "formatted": "3.69",
                "formatted_with_symbol": "$3.69",
                "formatted_with_code": "3.69 USD"
            },
            "included_in_price": false,
            "breakdown": [
                {
                    "amount": 2.63,
                    "rate": 0.0625,
                    "rate_percentage": "6.25%",
                    "type": "state"
                },
                {
                    "amount": 0,
                    "rate": 0,
                    "rate_percentage": "0%",
                    "type": "city"
                },
                {
                    "amount": 0.11,
                    "rate": 0.0025,
                    "rate_percentage": "0.25%",
                    "type": "county"
                },
                {
                    "amount": 0.95,
                    "rate": 0.0225,
                    "rate_percentage": "2.25%",
                    "type": "district"
                }
            ],
            "zone": {
                "country": "US",
                "region": "CA",
                "postal_zip_code": "94103",
                "ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
            }
        },
        "total": {
            "raw": 54.99,
            "formatted": "54.99",
            "formatted_with_symbol": "$54.99",
            "formatted_with_code": "54.99 USD"
        },
        "total_with_tax": {
            "raw": 58.68,
            "formatted": "58.68",
            "formatted_with_symbol": "$58.68",
            "formatted_with_code": "58.68 USD"
        },
        "pay_what_you_want": {
            "enabled": true,
            "minimum": {
                "raw": 58.68,
                "formatted": "58.68",
                "formatted_with_symbol": "$58.68",
                "formatted_with_code": "58.68 USD"
            },
            "customer_set_price": {
                "raw": 100,
                "formatted": "100.00",
                "formatted_with_symbol": "$100.00",
                "formatted_with_code": "100.00 USD"
            }
        }
    },
    "payment": {
        "id": "pymnt_20icw2ZVLRq4",
        "transaction_id": "ch_19HLUQDm0vyxCdYanLOHURDE",
        "card_type": "Visa",
        "gateway": "stripe",
        "reference": 4242
    },
    "fulfillment": {
        "shipping": {
            "id": "ful_j0YnEoq65e7P61",
            "description": "USPS",
            "price": {
                "raw": 0.99,
                "formatted": "0.99",
                "formatted_with_symbol": "$0.99",
                "formatted_with_code": "0.99 USD"
            },
            "shipping_method_id": "ship_31q0o3e21lDdjR",
            "provider": "chec",
            "provider_type": "native_shipping"
        },
        "digital": [
            {
                "provider": "chec",
                "provider_type": "native_digital",
                "line_item_id": "item_7RyWOwmK5nEa2V",
                "product_id": "prod_4VPvL5zRQ5AQkX",
                "product_name": "Cart Debug Digital + Physical",
                "packages": [
                    {
                        "id": "ful_Ekd6Ll2zlV2mjK",
                        "name": "commerce-js-example.html",
                        "access_link": "http://api.chec.dev/fulfill/ord_p7ZAMo1xwNJ4xX/ful_Ekd6Ll2zlV2mjK",
                        "ext": "HTML",
                        "size": "10.44 KB",
                        "size_in_bytes": "10694"
                    }
                ],
                "lifespan": {
                    "expires": false,
                    "expiry_date": null,
                    "duration": null,
                    "period": null,
                    "download_limit": "unlimited",
                    "human": "Download links do not expire, and can be accessed unlimited time(s)"
                }
            }
        ]
    },
    "conditionals": {
        "collects_fullname": false,
        "collects_shipping_address": true,
        "collects_billing_address": false,
        "fulfill_shipping": true,
        "fulfill_digital": true,
        "has_available_discounts": true,
        "has_pay_what_you_want": true,
        "collects_extrafields": true,
        "is_cart_free": false
    },
    "metadata": [],
    "fraud": {
        "provider": "siftscience",
        "score": "11"
    },
    "merchant": {
        "id": 2,
        "business_name": "Test, Inc.",
        "business_description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent auctor sodales magna convallis laoreet. Vestibulum odio neque, euismod sit amet consectetur ullamcorper, ornare ultricies.",
        "currency": {
            "symbol": "$",
            "code": "USD"
        },
        "support_email": "hello@trychec.com",
        "logo": "https://cdn.chec.io/merchants/2/local/images/icon/8b8709949f5eb64b6f9bea722954253d89d599bc56ffb8d5e6773|Commecejs_logo.png",
        "logo_shape": "squared",
        "cover": "https://cdn.chec.io/merchants/2/local/images/cover/18bb006778c1b3efe0b46a063b34ce664a49f5dc5700c83ec7293|Chec.Twitter.Header copy.png",
        "statement_descriptor": null,
        "has": {
            "logo": true,
            "cover": true,
            "business_description": true
        }
    }
}

Response (402)

{
    "error": {
        "type": "account_limitation",
        "message": "This merchant's account is disabled."
    },
    "status_code": 402
}

Response (404)

{
    "error": {
        "type": "not_found",
        "message": "Checkout token (chkt_L5z3kmQpdpkGlA) does not exist"
    },
    "status_code": 404
}

Response (422)

{
    "error": {
        "type": "not_valid",
        "message": "Requested quantity not available for one or more of the variants"
    },
    "status_code": 422
}

Request

POST /v1/checkouts/{checkout_token_id}

URL Parameters

Parameter Status Description
checkout_token_id required The checkout token

Body Parameters

Parameter Type Status Description
line_items.item_7RyWOwmK5nEa2V.quantity integer required The requested quantity for this line item
line_items.item_7RyWOwmK5nEa2V.variants.vrnt_p6dP5g0M4ln7kA string required The line item ID to be purchased
discount_code string optional A discount code requested
extrafields.extr_Kvg9l6zvnl1bB7 string optional The collected data for the extra field
extrafields.extr_bWZ3l8zLNokpEQ string optional The collected data for the extra field
customer.id string optional A Customer ID to associate the order with. If none is provided, a customer will be associated or created from the email address.
customer.firstname string optional Customer's first name, if required
customer.lastname string optional Customer's last name, if required
customer.email string required Customer's email address. Not required when providing customer.id
shipping.name string optional The ship to name
shipping.street string optional Shipping street address for order
shipping.town_city string optional Shipping town or city for order
shipping.county_state string optional Shipping county/state/province for order
shipping.postal_zip_code string optional Shipping postal or ZIP code for order:
shipping.country string optional Shipping country for order (ISO 3166-1 alpha-2, e.g. GB - United Kingdom)
fulfillment.shipping_method string optional The id of the selected shipping option, if required
billing.name string optional The customer's billing name name
billing.street string optional Billing street address for order
billing.town_city string optional Billing town or city for order
billing.county_state string optional Billing county/state/province for order
billing.postal_zip_code string optional Billing postal or ZIP code for order:
billing.country string optional Shipping country for order (ISO 3166-1 alpha-2, e.g. GB - United Kingdom)
payment.gateway string optional The payment gateway type, e.g. paypal, stripe, square, razorpay, test_gateway, manual
payment.card.number string optional Credit card number
payment.card.expires string optional Credit card expiry data
payment.card.cvc integer optional Credit card CVC number
payment.card.postal_zip_code string optional ZIP code associated with credit card
payment.card.token string optional The card token generated if using Stripe
payment.card.nonce integer optional The nonce returned if using Square (Square Payment Form)
payment.razorpay.payment_id string optional The payment ID returned by Razorpay (if using Razorpay)
pay_what_you_want string optional The amount to pay, if using "pay what you want"

Response Parameters

Parameter Type Description
id string The order ID
sandbox boolean Whether this order is a "sandbox" order
checkout_token_id string The ID for the checkout that was used to make the order
cart_id string The cart ID that was used to make the order
customer_reference string The customer friendly reference for this order, generated by Chec
created integer The unix timestamp for when the order was created/captured
status_payment string Indicates the payment status of the order. One of "paid", "not_paid", "partially_paid", "refunded", or "authorized"
status_fulfillment string Indicates the fulfillment status of the order. One of "fulfilled", "not_fulfilled", "partially_fulfilled", or "returned"
currency.code string The currency code (ISO 4217) of the currency in the order
currency.symbol string The currency symbol used in the order
order_value Price The total price of the order
redirect string The URL for the order's redirect confirmation page, or false
customer.email string The email address that the customer provided for the order
customer.firstname string The first name that the customer provided for the order. Only present if one was provided
customer.lastname string The last name that the customer provided for the order. Only present if one was provided
extrafields.*.id string The extra field ID
extrafields.*.name string A given name for the extra field ID - usually used as a field label
extrafields.*.type string A type for the extra field. Currently only "text" is supported for products
extrafields.*.required boolean Whether this extra field is required
extrafields.*.value string The value provided by the customer for this field
shipping.name string The recipient name who the order should be shipped to
shipping.street string Shipping street address for the order
shipping.street_2 string A second line for the shipping street address for the order
shipping.town_city string Shipping town or city for the order
shipping.country_state string Shipping county/state/province for the order
shipping.postal_zip_code string Shipping postal or ZIP code for the order:
shipping.country string Shipping country for the order (ISO 3166-1 alpha-2, e.g. GB - United Kingdom)
billing.name string The recipient name who the order should be billed to
billing.street string Billing street address for the order
billing.street_2 string A second line for the billing street address for the order
billing.town_city string Billing town or city for the order
billing.country_state string Billing county/state/province for the order
billing.postal_zip_code string Billing postal or ZIP code for the order:
billing.country string Billing country for the order (ISO 3166-1 alpha-2, e.g. GB - United Kingdom)
order.line_items.*.id string The ID of the line item in the order
order.line_items.*.product_id string The ID of the product for the line item
order.line_items.*.product_name string The product name in the line item
order.line_items.*.quantity integer The quantity of this line item in the order
order.line_items.*.price Price The base price for one of this line item
order.line_items.*.line_total Price the total price for this line item, including the selected variant options
order.line_items.*.variants.*.variant_id string Variant ID for the product in the order
order.line_items.*.variants.*.variant_name string Name of variant for the product in the order
order.line_items.*.variants.*.option_id string Variant's option ID for the product in the order
order.line_items.*.variants.*.option_name string Variant's option name for the product in the order
order.line_items.*.variants.*.price Price The price delta for the variant, applied to the base product price
order.line_items.*.taxable_amount Price The raw value (price) that is taxable for this line item
order.line_items.*.tax_rate Price A decimal that represents the rate of this tax
order.line_items.*.tax_rate_percentage number A decimal that represents the rate of this tax
order.line_items.*.tax_amount The raw calculated tax for this type of tax
order.line_items.*.tax_lines.*.amount number The raw calculated tax for this type of tax
order.line_items.*.tax_lines.*.rate number A decimal that represents the rate of this tax
order.line_items.*.tax_lines.*.rate_percentage string The decimal rate formatted as a percentage
order.line_items.*.tax_lines.*.type string A name given to this part of the total tax
order.subtotal Price The subtotal of the order object, summing all of the line items
order.discount.type string The type of the discount, "percentage" or "fixed"
order.discount.code string The "code" used to redeem the discount
order.discount.value number A percentage or fixed fee which represents the discount that should be applied
order.discount.product_id string The product ID that this discount can only be applied to - or null if the discount is generic
order.discount.amount_saved Price The amount that has been taken off the total cost by this discount
order.shipping.id string The ID for the shipping method chosen for the order
order.shipping.description string The stored description for this shipping method
order.shipping.price Price The price for the chosen shipping method for the order
order.tax.zone.country string The ISO 3166-2 code for the customers country
order.tax.zone.region string The customer provided (or geo-located) region for the customer
order.tax.zone.postal_zip_code string The customer provided (or geo-located) postal/ZIP code for the customer
order.tax.zone.ip_address string The IP address used when the tax information has been calculcated from the IP address
order.tax.amount Price The total amount of the total that is tax
order.total Price The total of the order, excluding tax
order.total_with_tax Price The total of the order, including tax
order.giftcard.id string The giftcard ID that has been redeemed on the order
order.giftcard.code string The code for the giftcard that has been redeemed on the order
order.giftcard.balance number The balance of the giftcard, without a deduction for the current live object
order.giftcard.credit Price The amount of the giftcards balance that will be deducted once an order has been captured from the order
order.pay_what_you_want.enabled boolean Whether a customer set "pay what you want" price is enabled for this live object
order.pay_what_you_want.minumum Price The minimum value a customer may choose for "pay what you want"
order.pay_what_you_want.customer_set_price Price The current price the customer has chosen for this live object
payments.*.id string The payment ID
payments.*.gateway_transaction_id string An ID provided by the configured gateway for this payment
payments.*.created integer A unix timestamp that indicates when this payment was created
payments.*.type string The "type" of payment this is. This can depend on your configured gateway.
payments.*.gateway string The gateway that processed this payment
payments.*.reference string A reference to the customer of this transaction. Depends on the gateway.
payments.*.amount Price The amount that was paid with this payment
payments.*.currency.code string The currency code (ISO 4217) of the currency used for the payment
payments.*.currency.symbol string The currency symbol used in the order
payments.*.is_refunded boolean Whether this payment was subsequently refunded
payments.*.refund_date integer A unix timestamp for the date that this payment was refunded, if it was refunded
payments.*.payment_source object An object that details what the source of the payment. For example, masked card details are provided for credit card payments.
refunds.*.payment_id string The payment ID that was refunded
refunds.*.gateway_transaction_id string An ID provided by the configured gateway for the payment
refunds.*.type string The "type" of this refund. Currently only "full" refunds are supported
refunds.*.gateway string The gateway that processed the payment
refunds.*.amount Price The amount that was refunded
refunds.*.currency.code string The currency code (ISO 4217) of the currency used for the payment
refunds.*.currency.symbol string The currency symbol used in the order
refunds.*.created integer A unix timestamp for the date that this payment was refunded
refunds.*.reason string A reason for this refund, if set
fulfillment.physical.items.*.id string The ID for this fulfillment
fulfillment.physical.items.*.shipping_method_id string The ID for the chosen shipping method
fulfillment.physical.items.*.line_item_id string The ID for line item that this fulfillment is for
fulfillment.physical.items.*.product_id string The ID for the product that is being fulfilled
fulfillment.physical.items.*.shipping_description string The description of the shipping method at the time it was chosen
fulfillment.physical.items.*.provider string The fulfillment provider that manages fulfillments
fulfillment.physical.items.*.provider_type string The type of fulfillment provider
fulfillment.physical.items.*.product_name string The name of the product at the time the fulfillment was created
fulfillment.physical.items.*.variants.*.variant_id string Variant ID for the product in the order
fulfillment.physical.items.*.variants.*.variant_name string Name of variant for the product in the order
fulfillment.physical.items.*.variants.*.option_id string Variant's option ID for the product in the order
fulfillment.physical.items.*.variants.*.option_name string Variant's option name for the product in the order
fulfillment.physical.items.*.status string The status of this fulfillment. One of "fulfilled", "not_fulfilled", or "returned"
fulfillment.physical.items.*.quantity integer The total quantity of items in this fulfillment
fulfillment.physical.items.*.quantity_fulfilled integer The quantity of items in this fulfillment which have been fulfilled
fulfillment.physical.items.*.quantity_remaining integer The quantity of items in this fulfillment which have yet to be fulfilled
fulfillment.physical.items.*.last_updated integer A unix timestamp indicating the last time this fulfillment was modified
fulfillment.physical.items.*.linked_shipments array An array of shipment IDs that related to this fulfillment
fulfillment.physical.shipments.*.id string This ID for this shipment
fulfillment.physical.shipments.*.customer_reference string A reference for this shipment for the customer generated by Chec
fulfillment.physical.shipments.*.shipped_on integer A unix timestamp indicating the time this shipment was dispatched
fulfillment.physical.shipments.*.provider string The shipping provider that manages shipping
fulfillment.physical.shipments.*.provider_type string The type of shipping provider
fulfillment.physical.shipments.*.carrier string The carrier that is delivering the shipment
fulfillment.physical.shipments.*.carrier_name string A full name of the carrier if applicable
fulfillment.physical.shipments.*.tracking_number string A tracking code/number for the shipment, provided by the carrier
fulfillment.physical.shipments.*.tracking_url string A tracking URL for the shipment if it can be deduced from the tracking number or has been provided by the carrier
fulfillment.physical.shipments.*.created integer A unix timestamp indicating when the shipment was created
fulfillment.physical.shipments.*.metadata object An object of additional metadata on a shipment
fulfillment.digital.downloads.*.provider string The digital download provider for digital fulfillment
fulfillment.digital.downloads.*.provider_type string The type of digital provider
fulfillment.digital.downloads.*.line_item_id string The ID of the line item
fulfillment.digital.downloads.*.product_id string the ID of the product
fulfillment.digital.downloads.*.product_name string The name of the product at the time the fulfillment was created
fulfillment.digital.downloads.*.packages.*.id string The ID of the download
fulfillment.digital.downloads.*.packages.*.name string The filename of the download
fulfillment.digital.downloads.*.packages.*.access_link string A URL that can be used to access the file
fulfillment.digital.downloads.*.packages.*.ext string The parsed file extension for the download
fulfillment.digital.downloads.*.packages.*.size string A human readable size of the file
fulfillment.digital.downloads.*.packages.*.size_in_bytes integer A raw integer of the size of the file in bytes
fulfillment.digital.downloads.*.packages.*.remaining_downloads integer Either an integer indicating the number of times the download link can be accessed, or null if there are unlimited downloads
fulfillment.digital.downloads.*.packages.*.is_unlimited boolean Indicates whether the link can be accessed unlimited times
fulfillment.digital.downloads.*.packages.*.is_access_revoked boolean Indicates if this download is no longer available, regardless of remaining downloads or unlimited configuration
fulfillment.digital.downloads.*.lifespan.expires boolean Whether this fulfillment is configured to expire
fulfillment.digital.downloads.*.lifespan.expiry_date integer A unix timestamp that indicates when this fulfillment will no longer be available for download
fulfillment.digital.downloads.*.lifespan.duration integer An integer that indicates the number of "periods" this fulfillment is available for download
fulfillment.digital.downloads.*.lifespan.period string Indicates what period the duration key refers to. One of "days", "weeks", or "months"
fulfillment.digital.downloads.*.lifespan.download_limit integer The number of downloads that were allowed for this fulfillment initially
fulfillment.digital.downloads.*.lifespan.human string A sentence that describes the lifespan conditions
fulfillment.digital.downloads.*.is_expired boolean Whether all the "packages" available are expired
fulfillment.digital.downloads.*.is_access_revoked boolean Whether all the "packages" available have had their access revoked
conditionals.collected_fullname boolean Whether this order was required to collect the customers full name
conditionals.collected_shipping_address boolean Whether this order was required to collect the customers shipping address
conditionals.collected_billing_address boolean Whether this order was required to collect the customers billing address
conditionals.collected_extrafields boolean Whether this order was required to collect some configured extra fields
conditionals.collected_tax boolean Whether this order was required to collect tax
conditionals.collected_eu_vat_moss_evidence boolean Whether this order was required to collect EU VAT moss evidence
conditionals.has_physical_fulfillment boolean Whether this order has a physical fulfillment
conditionals.has_digital_fulfillment boolean Whether this order has a digital fulfillment
conditionals.has_pay_what_you_want boolean Whether this order has a customer set price using the "pay what you want" feature
conditionals.has_discounts boolean Whether discounts were redeemed on this order
conditionals.is_free boolean Whether this order is free
conditionals.is_fulfilled boolean Whether this order has been completely fulfilled
collected.fullname boolean Whether this order was required to collect the customers full name
collected.shipping_address boolean Whether this order was required to collect the customers shipping address
collected.billing_address boolean Whether this order was required to collect the customers billing address
collected.extrafields boolean Whether this order was required to collect some configured extra fields
collected.tax boolean Whether this order was required to collect tax
collected.eu_vat_moss_evidence boolean Whether this order was required to collect EU VAT moss evidence
has.physical_fulfillment boolean Whether this order has a physical fulfillment
has.digital_fulfillment boolean Whether this order has a digital fulfillment
has.pay_what_you_want boolean Whether this order has a customer set price using the "pay what you want" feature
has.discounts boolean Whether discounts were redeemed on this order
is.free boolean Whether this order is free
is.fulfilled boolean Whether this order has been completely fulfilled
fraud.provider string A string that indicates which third party provider was used to identify the risk of fraud
fraud.response object The response provided by the fraud provider
client_details.ip_address string the IP address of the customer - collected when using the protect endpoint
client_details.country_code The ISO 3166-1 two-character code for the country that was resolved from the IP address
client_details.country_name The full name of the country that was resolved from the IP address
client_details.region_code The ISO 3166-2 region code for the subdivision that was resolved from the IP address
client_details.region_name The full name of the subdivision that was resolved from the IP address
client_details.city The full name of the city that was resolved from the IP address
client_details.postal_zip_code The postal/ZIP code that was resolved from the IP address
meta object A custom object that can be set on an order

Get existing token

Requires authentication

Returns an existing token and checkout response from the provided ID. The output from this request will be the same as that of "Generate token".

Request

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/tokens/chkt_L5z3kmQpdpkGlA" \
    -H "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';
Commerce.checkout.getToken(checkoutTokenId).then(token => console.log(token));
const url = new URL(
    "https://api.chec.io/v1/checkouts/tokens/chkt_L5z3kmQpdpkGlA"
);

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/checkouts/tokens/chkt_L5z3kmQpdpkGlA'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Response (200)

{
    "id": "chkt_L5z3kmQpdpkGlA",
    "cart_id": "cart_1ql93d0MGB9poz",
    "created": 1479499329,
    "expires": 1479672129,
    "analytics": {
        "google": {
            "settings": {
                "tracking_id": "UA-76990030-2",
                "linked_domains": [
                    "checkout.chec.io"
                ]
            }
        }
    },
    "conditionals": {
        "collects_fullname": false,
        "collects_shipping_address": true,
        "collects_billing_address": false,
        "has_physical_delivery": true,
        "has_digital_delivery": true,
        "has_available_discounts": true,
        "has_pay_what_you_want": false,
        "collects_extrafields": true,
        "is_cart_free": false
    },
    "collects": {
        "fullname": false,
        "shipping_address": true,
        "billing_address": false,
        "extrafields": true
    },
    "has": {
        "physical_delivery": true,
        "digital_delivery": true,
        "available_discounts": true,
        "pay_what_you_want": false
    },
    "is": {
        "cart_free": false
    },
    "line_items": [
        {
            "id": "item_7RyWOwmK5nEa2V",
            "product_id": "prod_4VPvL5zRQ5AQkX",
            "name": "Cart Debug Digital + Physical",
            "image": null,
            "description": null,
            "quantity": 1,
            "price": {
                "raw": 1,
                "formatted": "1.00",
                "formatted_with_symbol": "$1.00",
                "formatted_with_code": "1.00 USD"
            },
            "subtotal": {
                "raw": 1,
                "formatted": "1.00",
                "formatted_with_symbol": "$1.00",
                "formatted_with_code": "1.00 USD"
            },
            "variants": [
                {
                    "id": "vrnt_Kvg9l6Apq51bB7",
                    "name": "Variant #1",
                    "options": [
                        {
                            "id": "optn_ZG6kVw7vOl2eDx",
                            "name": "Options 1",
                            "price": {
                                "raw": 5,
                                "formatted": "5.00",
                                "formatted_with_symbol": "$5.00",
                                "formatted_with_code": "5.00 USD"
                            }
                        },
                        {
                            "id": "optn_QO3bR5XDk5nzdj",
                            "name": "Option 2",
                            "price": {
                                "raw": 10,
                                "formatted": "10.00",
                                "formatted_with_symbol": "$10.00",
                                "formatted_with_code": "10.00 USD"
                            }
                        }
                    ]
                },
                {
                    "id": "vrnt_kpnNwAyBrwmXB3",
                    "name": "Variant #2",
                    "options": [
                        {
                            "id": "optn_7RyWOwmG95nEa2",
                            "name": "Option 1",
                            "price": {
                                "raw": 10,
                                "formatted": "10.00",
                                "formatted_with_symbol": "$10.00",
                                "formatted_with_code": "10.00 USD"
                            }
                        },
                        {
                            "id": "optn_1ypbroEyno8n4e",
                            "name": "Option 2",
                            "price": {
                                "raw": 20,
                                "formatted": "20.00",
                                "formatted_with_symbol": "$20.00",
                                "formatted_with_code": "20.00 USD"
                            }
                        }
                    ]
                }
            ],
            "conditionals": {
                "is_active": true,
                "is_free": false,
                "is_pay_what_you_want": false,
                "is_quantity_limited": false,
                "is_sold_out": false,
                "has_digital_delivery": true,
                "has_physical_delivery": true,
                "has_images": false,
                "has_video": false,
                "collects_fullname": false,
                "collects_shipping_address": true,
                "collects_billing_address": false,
                "collects_extrafields": false
            },
            "is": {
                "active": true,
                "free": false,
                "pay_what_you_want": false,
                "quantity_limited": false,
                "sold_out": false
            },
            "has": {
                "digital_delivery": true,
                "physical_delivery": true,
                "images": false,
                "video": false
            },
            "collects": {
                "fullname": false,
                "shipping_address": true,
                "billing_address": false,
                "extrafields": false
            }
        },
        {
            "id": "item_1ypbroE658n4ea",
            "product_id": "prod_4VPvL5zRQ5AQkX",
            "name": "Cart Debug Digital + Physical",
            "image": null,
            "description": null,
            "quantity": 1,
            "price": {
                "raw": 1,
                "formatted": "1.00",
                "formatted_with_symbol": "$1.00",
                "formatted_with_code": "1.00 USD"
            },
            "subtotal": {
                "raw": 1,
                "formatted": "1.00",
                "formatted_with_symbol": "$1.00",
                "formatted_with_code": "1.00 USD"
            },
            "variants": [
                {
                    "id": "vrnt_Kvg9l6Apq51bB7",
                    "name": "Variant #1",
                    "options": [
                        {
                            "id": "optn_ZG6kVw7vOl2eDx",
                            "name": "Options 1",
                            "price": {
                                "raw": 5,
                                "formatted": "5.00",
                                "formatted_with_symbol": "$5.00",
                                "formatted_with_code": "5.00 USD"
                            }
                        },
                        {
                            "id": "optn_QO3bR5XDk5nzdj",
                            "name": "Option 2",
                            "price": {
                                "raw": 10,
                                "formatted": "10.00",
                                "formatted_with_symbol": "$10.00",
                                "formatted_with_code": "10.00 USD"
                            }
                        }
                    ]
                },
                {
                    "id": "vrnt_kpnNwAyBrwmXB3",
                    "name": "Variant #2",
                    "options": [
                        {
                            "id": "optn_7RyWOwmG95nEa2",
                            "name": "Option 1",
                            "price": {
                                "raw": 10,
                                "formatted": "10.00",
                                "formatted_with_symbol": "$10.00",
                                "formatted_with_code": "10.00 USD"
                            }
                        },
                        {
                            "id": "optn_1ypbroEyno8n4e",
                            "name": "Option 2",
                            "price": {
                                "raw": 20,
                                "formatted": "20.00",
                                "formatted_with_symbol": "$20.00",
                                "formatted_with_code": "20.00 USD"
                            }
                        }
                    ]
                }
            ],
            "conditionals": {
                "is_active": true,
                "is_free": false,
                "is_pay_what_you_want": false,
                "is_quantity_limited": false,
                "is_sold_out": false,
                "has_digital_delivery": true,
                "has_physical_delivery": true,
                "has_images": false,
                "has_video": false,
                "collects_fullname": false,
                "collects_shipping_address": true,
                "collects_billing_address": false,
                "collects_extrafields": false
            },
            "is": {
                "active": true,
                "free": false,
                "pay_what_you_want": false,
                "quantity_limited": false,
                "sold_out": false
            },
            "has": {
                "digital_delivery": true,
                "physical_delivery": true,
                "images": false,
                "video": false
            },
            "collects": {
                "fullname": false,
                "shipping_address": true,
                "billing_address": false,
                "extrafields": false
            }
        }
    ],
    "merchant": {
        "id": 2,
        "business_name": "Test, Inc.",
        "business_description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent auctor sodales magna convallis laoreet. Vestibulum odio neque, euismod sit amet consectetur ullamcorper, ornare ultricies.",
        "currency": {
            "symbol": "$",
            "code": "USD"
        },
        "support_email": "hello@trychec.com",
        "logo": "https://cdn.chec.io/merchants/2/local/images/icon/8b8709949f5eb64b6f9bea722954253d89d599bc56ffb8d5e6773|Commecejs_logo.png",
        "logo_shape": "squared",
        "cover": "https://cdn.chec.io/merchants/2/local/images/cover/18bb006778c1b3efe0b46a063b34ce664a49f5dc5700c83ec7293|Chec.Twitter.Header copy.png",
        "has": {
            "logo": true,
            "cover": true,
            "business_description": true
        }
    },
    "extrafields": [
        {
            "id": "extr_7RyWOwmK5nEa2V",
            "name": "Website",
            "type": "text",
            "required": false,
            "options": null
        }
    ],
    "gateways": {
        "available": {
            "test_gateway": true,
            "stripe": true,
            "chec": false,
            "paypal": true
        },
        "available_count": 3,
        "test_gateway": {
            "type": "card",
            "settings": []
        },
        "stripe": {
            "type": "card",
            "settings": {
                "publishable_key": "pk_test_zURSwkv193kOIY2bfSahD0bj"
            },
            "cards_accepted": [
                "visa",
                "mastercard",
                "amex"
            ]
        },
        "paypal": {
            "type": "third_party",
            "settings": {
                "email": "devan.koshal+merchant@gmail.com"
            }
        }
    },
    "shipping_methods": [
        {
            "id": "ship_31q0o3e21lDdjR",
            "description": "USPS",
            "price": {
                "raw": 0.99,
                "formatted": "0.99",
                "formatted_with_symbol": "$0.99",
                "formatted_with_code": "0.99 USD"
            },
            "countries": [
                "US"
            ]
        },
        {
            "id": "ship_dKvg9l6vl1bB76",
            "description": "Domestic",
            "price": {
                "raw": 0,
                "formatted": "0.00",
                "formatted_with_symbol": "$0.00",
                "formatted_with_code": "0.00 USD"
            },
            "countries": [
                "US"
            ]
        }
    ],
    "live": {
        "merchant_id": 2,
        "currency": {
            "code": "USD",
            "symbol": "$"
        },
        "line_items": [
            {
                "id": "item_7RyWOwmK5nEa2V",
                "product_id": "prod_4VPvL5zRQ5AQkX",
                "product_name": "Cart Debug Digital + Physical",
                "quantity": 5,
                "price": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "line_total": {
                    "raw": 80,
                    "formatted": "80.00",
                    "formatted_with_symbol": "$80.00",
                    "formatted_with_code": "80.00 USD"
                },
                "variants": [
                    {
                        "variant_id": "vrnt_Kvg9l6Apq51bB7",
                        "option_id": "optn_ZG6kVw7vOl2eDx",
                        "variant_name": "Variant #1",
                        "option_name": "Options 1",
                        "price": {
                            "raw": 5,
                            "formatted": "5.00",
                            "formatted_with_symbol": "$5.00",
                            "formatted_with_code": "5.00 USD"
                        }
                    },
                    {
                        "variant_id": "vrnt_kpnNwAyBrwmXB3",
                        "option_id": "optn_7RyWOwmG95nEa2",
                        "variant_name": "Variant #2",
                        "option_name": "Option 1",
                        "price": {
                            "raw": 10,
                            "formatted": "10.00",
                            "formatted_with_symbol": "$10.00",
                            "formatted_with_code": "10.00 USD"
                        }
                    }
                ],
                "tax": {
                    "is_taxable": false,
                    "taxable_amount": null,
                    "amount": null,
                    "breakdown": null
                }
            },
            {
                "id": "item_1ypbroE658n4ea",
                "product_id": "prod_4VPvL5zRQ5AQkX",
                "product_name": "Cart Debug Digital + Physical",
                "quantity": 5,
                "price": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "line_total": {
                    "raw": 30,
                    "formatted": "30.00",
                    "formatted_with_symbol": "$30.00",
                    "formatted_with_code": "30.00 USD"
                },
                "variants": [
                    {
                        "variant_id": "vrnt_Kvg9l6Apq51bB7",
                        "option_id": "optn_ZG6kVw7vOl2eDx",
                        "variant_name": "Variant #1",
                        "option_name": "Options 1",
                        "price": {
                            "raw": 5,
                            "formatted": "5.00",
                            "formatted_with_symbol": "$5.00",
                            "formatted_with_code": "5.00 USD"
                        }
                    }
                ],
                "tax": {
                    "is_taxable": false,
                    "taxable_amount": null,
                    "amount": null,
                    "breakdown": null
                }
            }
        ],
        "subtotal": {
            "raw": 110,
            "formatted": "110.00",
            "formatted_with_symbol": "$110.00",
            "formatted_with_code": "110.00 USD"
        },
        "discount": [],
        "shipping": {
            "available_options": [
                {
                    "id": "ship_31q0o3e21lDdjR",
                    "description": "USPS",
                    "price": {
                        "raw": 0.99,
                        "formatted": "0.99",
                        "formatted_with_symbol": "$0.99",
                        "formatted_with_code": "0.99 USD"
                    },
                    "countries": [
                        "US"
                    ]
                },
                {
                    "id": "ship_dKvg9l6vl1bB76",
                    "description": "Domestic",
                    "price": {
                        "raw": 0,
                        "formatted": "0.00",
                        "formatted_with_symbol": "$0.00",
                        "formatted_with_code": "0.00 USD"
                    },
                    "countries": [
                        "US"
                    ]
                }
            ],
            "price": {
                "raw": 0,
                "formatted": "0.00",
                "formatted_with_symbol": "$0.00",
                "formatted_with_code": "0.00 USD"
            }
        },
        "tax": {
            "amount": {
                "raw": 0,
                "formatted": "0.00",
                "formatted_with_symbol": "$0.00",
                "formatted_with_code": "0.00 USD"
            }
        },
        "total": {
            "raw": 110,
            "formatted": "110.00",
            "formatted_with_symbol": "$110.00",
            "formatted_with_code": "110.00 USD"
        },
        "total_with_tax": {
            "raw": 110,
            "formatted": "110.00",
            "formatted_with_symbol": "$110.00",
            "formatted_with_code": "110.00 USD"
        },
        "pay_what_you_want": {
            "enabled": false,
            "minimum": null,
            "customer_set_price": null
        }
    }
}

Request

GET /v1/checkouts/tokens/{checkout_token_id}

URL Parameters

Parameter Status Description
checkout_token_id required The checkout token

Checkout helpers

Get the live object

Requires authentication

The live object is a living object which adjusts to show the live tax rates, prices, and totals for a checkout token. Every time a checkout helper endpoint is called this object will be updated to show update information which can be used to help display data back to the customer on the checkout. All checkout helpers that affect price (e.g. check quantity, check variant, check discount etc) will return the live object in their payload.

Request

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/live" \
    -H "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';
Commerce.checkout.getLive(checkoutTokenId).then(live => console.log(live));
const url = new URL(
    "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/live"
);

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/live'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Response (200)

{
    "merchant_id": 2,
    "currency": {
        "code": "USD",
        "symbol": "$"
    },
    "line_items": [
        {
            "id": "item_7RyWOwmK5nEa2V",
            "product_id": "prod_4VPvL5zRQ5AQkX",
            "product_name": "Cart Debug Digital + Physical",
            "quantity": 1,
            "price": {
                "raw": 1,
                "formatted": "1.00",
                "formatted_with_symbol": "$1.00",
                "formatted_with_code": "1.00 USD"
            },
            "line_total": {
                "raw": 21,
                "formatted": "21.00",
                "formatted_with_symbol": "$21.00",
                "formatted_with_code": "21.00 USD"
            },
            "variants": [
                {
                    "variant_id": "vrnt_Kvg9l6Apq51bB7",
                    "option_id": "optn_r31q0o3E8lDdjR",
                    "variant_name": "Variant #1",
                    "option_name": "Option 2",
                    "price": {
                        "raw": 10,
                        "formatted": "10.00",
                        "formatted_with_symbol": "$10.00",
                        "formatted_with_code": "10.00 USD"
                    }
                },
                {
                    "variant_id": "vrnt_kpnNwAyBrwmXB3",
                    "option_id": "optn_jp6dP5gMRwn7kA",
                    "variant_name": "Variant #2",
                    "option_name": "Option 1",
                    "price": {
                        "raw": 10,
                        "formatted": "10.00",
                        "formatted_with_symbol": "$10.00",
                        "formatted_with_code": "10.00 USD"
                    }
                }
            ],
            "tax": {
                "is_taxable": true,
                "taxable_amount": 21,
                "amount": 1.83,
                "breakdown": [
                    {
                        "amount": 1.31,
                        "rate": 0.0625,
                        "rate_percentage": "6.25%",
                        "type": "state"
                    },
                    {
                        "amount": 0,
                        "rate": 0,
                        "rate_percentage": "0%",
                        "type": "city"
                    },
                    {
                        "amount": 0.05,
                        "rate": 0.0025,
                        "rate_percentage": "0.25%",
                        "type": "county"
                    },
                    {
                        "amount": 0.47,
                        "rate": 0.0225,
                        "rate_percentage": "2.25%",
                        "type": "district"
                    }
                ]
            }
        },
        {
            "id": "item_1ypbroE658n4ea",
            "product_id": "prod_2yA6nldRBoEWbz",
            "product_name": "Cart Debug W/ Shipping",
            "quantity": 1,
            "price": {
                "raw": 11,
                "formatted": "11.00",
                "formatted_with_symbol": "$11.00",
                "formatted_with_code": "11.00 USD"
            },
            "line_total": {
                "raw": 11,
                "formatted": "11.00",
                "formatted_with_symbol": "$11.00",
                "formatted_with_code": "11.00 USD"
            },
            "variants": [],
            "tax": {
                "is_taxable": true,
                "taxable_amount": 11,
                "amount": 0.97,
                "breakdown": [
                    {
                        "amount": 0.69,
                        "rate": 0.0625,
                        "rate_percentage": "6.25%",
                        "type": "state"
                    },
                    {
                        "amount": 0,
                        "rate": 0,
                        "rate_percentage": "0%",
                        "type": "city"
                    },
                    {
                        "amount": 0.03,
                        "rate": 0.0025,
                        "rate_percentage": "0.25%",
                        "type": "county"
                    },
                    {
                        "amount": 0.25,
                        "rate": 0.0225,
                        "rate_percentage": "2.25%",
                        "type": "district"
                    }
                ]
            }
        }
    ],
    "subtotal": {
        "raw": 32,
        "formatted": "32.00",
        "formatted_with_symbol": "$32.00",
        "formatted_with_code": "32.00 USD"
    },
    "discount": [],
    "shipping": {
        "available_options": [
            {
                "id": "ship_bO6J5a8NyoEjpK",
                "description": "tes",
                "price": {
                    "raw": 2.33,
                    "formatted": "2.33",
                    "formatted_with_symbol": "$2.33",
                    "formatted_with_code": "2.33 USD"
                },
                "countries": [
                    "US"
                ]
            },
            {
                "id": "ship_31q0o3e21lDdjR",
                "description": "USPS",
                "price": {
                    "raw": 0.99,
                    "formatted": "0.99",
                    "formatted_with_symbol": "$0.99",
                    "formatted_with_code": "0.99 USD"
                },
                "countries": [
                    "US"
                ]
            },
            {
                "id": "ship_dKvg9l6vl1bB76",
                "description": "Domestic",
                "price": {
                    "raw": 0,
                    "formatted": "0.00",
                    "formatted_with_symbol": "$0.00",
                    "formatted_with_code": "0.00 USD"
                },
                "countries": [
                    "US"
                ]
            }
        ],
        "id": "ship_31q0o3e21lDdjR",
        "description": "USPS",
        "price": {
            "raw": 0.99,
            "formatted": "0.99",
            "formatted_with_symbol": "$0.99",
            "formatted_with_code": "0.99 USD"
        }
    },
    "tax": {
        "amount": {
            "raw": 2.8,
            "formatted": "2.80",
            "formatted_with_symbol": "$2.80",
            "formatted_with_code": "2.80 USD"
        },
        "included_in_price": false,
        "breakdown": [
            {
                "amount": 2,
                "rate": 0.0625,
                "rate_percentage": "6.25%",
                "type": "state"
            },
            {
                "amount": 0,
                "rate": 0,
                "rate_percentage": "0%",
                "type": "city"
            },
            {
                "amount": 0.08,
                "rate": 0.0025,
                "rate_percentage": "0.25%",
                "type": "county"
            },
            {
                "amount": 0.72,
                "rate": 0.0225,
                "rate_percentage": "2.25%",
                "type": "district"
            }
        ],
        "zone": {
            "country": "US",
            "region": "CA",
            "postal_zip_code": "94103",
            "ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
        }
    },
    "total": {
        "raw": 32.99,
        "formatted": "32.99",
        "formatted_with_symbol": "$32.99",
        "formatted_with_code": "32.99 USD"
    },
    "total_with_tax": {
        "raw": 35.79,
        "formatted": "35.79",
        "formatted_with_symbol": "$35.79",
        "formatted_with_code": "35.79 USD"
    },
    "pay_what_you_want": {
        "enabled": false,
        "minimum": null,
        "customer_set_price": null
    }
}

Request

GET /v1/checkouts/{checkout_token_id}/live

URL Parameters

Parameter Status Description
checkout_token_id required The checkout token

Check "Pay What You Want" amount

Requires authentication

Validates and saves the desired "pay what you want" amount for the provided checkout token, if enabled. If the amount is too low, an invalid response will be returned with the minimum amount required.

Request

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/pay_what_you_want?customer_set_price=100.00" \
    -H "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';
const customerSetPrice = '100.00';

Commerce.checkout.checkPayWhatYouWant(checkoutTokenId, {
  customer_set_price: customerSetPrice,
}).then(response => console.log(response.valid, response.live));
const url = new URL(
    "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/pay_what_you_want"
);

let params = {
    "customer_set_price": "100.00",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/pay_what_you_want'
params = {
  'customer_set_price': '100.00',
}
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()

Response (200)

{
    "valid": true,
    "customer_set_price": {
        "raw": 100,
        "formatted": "100.00",
        "formatted_with_symbol": "$100.00",
        "formatted_with_code": "100.00 USD"
    },
    "live": {
        "merchant_id": 2,
        "currency": {
            "code": "USD",
            "symbol": "$"
        },
        "line_items": [
            {
                "id": "item_7RyWOwmK5nEa2V",
                "product_id": "prod_4VPvL5zRQ5AQkX",
                "product_name": "Cart Debug Digital + Physical",
                "quantity": 1,
                "price": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "line_total": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "variants": [],
                "tax": {
                    "is_taxable": true,
                    "taxable_amount": 1,
                    "amount": 0.08,
                    "breakdown": [
                        {
                            "amount": 0.06,
                            "rate": 0.0625,
                            "rate_percentage": "6.25%",
                            "type": "state"
                        },
                        {
                            "amount": 0,
                            "rate": 0,
                            "rate_percentage": "0%",
                            "type": "city"
                        },
                        {
                            "amount": 0,
                            "rate": 0.0025,
                            "rate_percentage": "0.25%",
                            "type": "county"
                        },
                        {
                            "amount": 0.02,
                            "rate": 0.0225,
                            "rate_percentage": "2.25%",
                            "type": "district"
                        }
                    ]
                }
            },
            {
                "id": "item_1ypbroE658n4ea",
                "product_id": "prod_2yA6nldRBoEWbz",
                "product_name": "Cart Debug W/ Shipping",
                "quantity": 1,
                "price": {
                    "raw": 11,
                    "formatted": "11.00",
                    "formatted_with_symbol": "$11.00",
                    "formatted_with_code": "11.00 USD"
                },
                "line_total": {
                    "raw": 11,
                    "formatted": "11.00",
                    "formatted_with_symbol": "$11.00",
                    "formatted_with_code": "11.00 USD"
                },
                "variants": [],
                "tax": {
                    "is_taxable": true,
                    "taxable_amount": 11,
                    "amount": 0.97,
                    "breakdown": [
                        {
                            "amount": 0.69,
                            "rate": 0.0625,
                            "rate_percentage": "6.25%",
                            "type": "state"
                        },
                        {
                            "amount": 0,
                            "rate": 0,
                            "rate_percentage": "0%",
                            "type": "city"
                        },
                        {
                            "amount": 0.03,
                            "rate": 0.0025,
                            "rate_percentage": "0.25%",
                            "type": "county"
                        },
                        {
                            "amount": 0.25,
                            "rate": 0.0225,
                            "rate_percentage": "2.25%",
                            "type": "district"
                        }
                    ]
                }
            },
            {
                "id": "item_dKvg9l6vl1bB76",
                "product_id": "prod_Ekd6Ll2KYwV2mj",
                "product_name": "Cart Debug",
                "quantity": 1,
                "price": {
                    "raw": 12,
                    "formatted": "12.00",
                    "formatted_with_symbol": "$12.00",
                    "formatted_with_code": "12.00 USD"
                },
                "line_total": {
                    "raw": 12,
                    "formatted": "12.00",
                    "formatted_with_symbol": "$12.00",
                    "formatted_with_code": "12.00 USD"
                },
                "variants": [],
                "tax": {
                    "is_taxable": false,
                    "taxable_amount": 0,
                    "amount": 0,
                    "breakdown": null
                }
            }
        ],
        "subtotal": {
            "raw": 24,
            "formatted": "24.00",
            "formatted_with_symbol": "$24.00",
            "formatted_with_code": "24.00 USD"
        },
        "discount": [],
        "shipping": {
            "available_options": [
                {
                    "id": "ship_bO6J5a8NyoEjpK",
                    "description": "tes",
                    "price": {
                        "raw": 2.33,
                        "formatted": "2.33",
                        "formatted_with_symbol": "$2.33",
                        "formatted_with_code": "2.33 USD"
                    },
                    "countries": [
                        "US"
                    ]
                },
                {
                    "id": "ship_31q0o3e21lDdjR",
                    "description": "USPS",
                    "price": {
                        "raw": 0.99,
                        "formatted": "0.99",
                        "formatted_with_symbol": "$0.99",
                        "formatted_with_code": "0.99 USD"
                    },
                    "countries": [
                        "US"
                    ]
                },
                {
                    "id": "ship_dKvg9l6vl1bB76",
                    "description": "Domestic",
                    "price": {
                        "raw": 0,
                        "formatted": "0.00",
                        "formatted_with_symbol": "$0.00",
                        "formatted_with_code": "0.00 USD"
                    },
                    "countries": [
                        "US"
                    ]
                }
            ],
            "price": {
                "raw": 0,
                "formatted": "0.00",
                "formatted_with_symbol": "$0.00",
                "formatted_with_code": "0.00 USD"
            }
        },
        "tax": {
            "amount": {
                "raw": 1.05,
                "formatted": "1.05",
                "formatted_with_symbol": "$1.05",
                "formatted_with_code": "1.05 USD"
            },
            "included_in_price": false,
            "breakdown": [
                {
                    "amount": 0.75,
                    "rate": 0.0625,
                    "rate_percentage": "6.25%",
                    "type": "state"
                },
                {
                    "amount": 0,
                    "rate": 0,
                    "rate_percentage": "0%",
                    "type": "city"
                },
                {
                    "amount": 0.03,
                    "rate": 0.0025,
                    "rate_percentage": "0.25%",
                    "type": "county"
                },
                {
                    "amount": 0.27,
                    "rate": 0.0225,
                    "rate_percentage": "2.25%",
                    "type": "district"
                }
            ],
            "zone": {
                "country": "US",
                "region": "CA",
                "postal_zip_code": "94103",
                "ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
            }
        },
        "total": {
            "raw": 24,
            "formatted": "24.00",
            "formatted_with_symbol": "$24.00",
            "formatted_with_code": "24.00 USD"
        },
        "total_with_tax": {
            "raw": 25.05,
            "formatted": "25.05",
            "formatted_with_symbol": "$25.05",
            "formatted_with_code": "25.05 USD"
        },
        "pay_what_you_want": {
            "enabled": true,
            "minimum": {
                "raw": 25.05,
                "formatted": "25.05",
                "formatted_with_symbol": "$25.05",
                "formatted_with_code": "25.05 USD"
            },
            "customer_set_price": {
                "raw": 100,
                "formatted": "100.00",
                "formatted_with_symbol": "$100.00",
                "formatted_with_code": "100.00 USD"
            }
        }
    }
}

Request

GET /v1/checkouts/{checkout_token_id}/check/pay_what_you_want

URL Parameters

Parameter Status Description
checkout_token_id required The checkout token

Query Parameters

Parameter Status Description
customer_set_price required The customer set price as an integer or float

Response Parameters

Parameter Type Description
valid boolean Whether the given price is valid (and has been applied to the live object)
customer_set_price Price The given price, converted into a price object
message string A message indicating why the customer set price is invalid. Only provided if the given price is invalid
live object The live object. See "get the live object"

Check variant

Requires authentication

Validates that the provided variant and variant option IDs are valid for the provided checkout token and line item ID.

Request

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/item_7RyWOwmK5nEa2V/variant?variant_id=vrnt_Kvg9l6Apq51bB7&option_id=optn_3BkyN5YDRo0b69" \
    -H "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';
const lineItemId = 'item_7RyWOwmK5nEa2V';
const variantId = 'vrnt_Kvg9l6Apq51bB7';
const optionId = 'optn_3BkyN5YDRo0b69';

Commerce.checkout.checkVariant(checkoutTokenId, lineItemId, {
  variant_id: variantId,
  option_id: optionId,
}).then(response => console.log(response.available));
const url = new URL(
    "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/item_7RyWOwmK5nEa2V/variant"
);

let params = {
    "variant_id": "vrnt_Kvg9l6Apq51bB7",
    "option_id": "optn_3BkyN5YDRo0b69",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/item_7RyWOwmK5nEa2V/variant'
params = {
  'variant_id': 'vrnt_Kvg9l6Apq51bB7',
  'option_id': 'optn_3BkyN5YDRo0b69',
}
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()

Response (200)

{
    "available": true,
    "name": "Options 1",
    "price": {
        "raw": 5,
        "formatted": "5.00",
        "formatted_with_symbol": "$5.00",
        "formatted_with_code": "5.00 USD"
    },
    "option_id": "optn_3BkyN5YDRo0b69",
    "variant_id": "vrnt_Kvg9l6Apq51bB7",
    "line_item_id": "item_7RyWOwmK5nEa2V",
    "live": {
        "merchant_id": 2,
        "currency": {
            "code": "USD",
            "symbol": "$"
        },
        "line_items": [
            {
                "id": "item_7RyWOwmK5nEa2V",
                "product_id": "prod_4VPvL5zRQ5AQkX",
                "product_name": "Cart Debug Digital + Physical",
                "quantity": 1,
                "price": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "line_total": {
                    "raw": 6,
                    "formatted": "6.00",
                    "formatted_with_symbol": "$6.00",
                    "formatted_with_code": "6.00 USD"
                },
                "variants": [
                    {
                        "variant_id": "vrnt_Kvg9l6Apq51bB7",
                        "option_id": "optn_3BkyN5YDRo0b69",
                        "variant_name": "Variant #1",
                        "option_name": "Options 1",
                        "price": {
                            "raw": 5,
                            "formatted": "5.00",
                            "formatted_with_symbol": "$5.00",
                            "formatted_with_code": "5.00 USD"
                        }
                    }
                ],
                "tax": {
                    "is_taxable": false,
                    "taxable_amount": null,
                    "amount": null,
                    "breakdown": null
                }
            },
            {
                "id": "item_1ypbroE658n4ea",
                "product_id": "prod_2yA6nldRBoEWbz",
                "product_name": "Cart Debug W/ Shipping",
                "quantity": 1,
                "price": {
                    "raw": 11,
                    "formatted": "11.00",
                    "formatted_with_symbol": "$11.00",
                    "formatted_with_code": "11.00 USD"
                },
                "line_total": {
                    "raw": 11,
                    "formatted": "11.00",
                    "formatted_with_symbol": "$11.00",
                    "formatted_with_code": "11.00 USD"
                },
                "variants": [],
                "tax": {
                    "is_taxable": false,
                    "taxable_amount": null,
                    "amount": null,
                    "breakdown": null
                }
            }
        ],
        "subtotal": {
            "raw": 17,
            "formatted": "17.00",
            "formatted_with_symbol": "$17.00",
            "formatted_with_code": "17.00 USD"
        },
        "discount": [],
        "shipping": {
            "available_options": [
                {
                    "id": "ship_bO6J5a8NyoEjpK",
                    "description": "tes",
                    "price": {
                        "raw": 2.33,
                        "formatted": "2.33",
                        "formatted_with_symbol": "$2.33",
                        "formatted_with_code": "2.33 USD"
                    },
                    "countries": [
                        "US"
                    ]
                },
                {
                    "id": "ship_31q0o3e21lDdjR",
                    "description": "USPS",
                    "price": {
                        "raw": 0.99,
                        "formatted": "0.99",
                        "formatted_with_symbol": "$0.99",
                        "formatted_with_code": "0.99 USD"
                    },
                    "countries": [
                        "US"
                    ]
                },
                {
                    "id": "ship_dKvg9l6vl1bB76",
                    "description": "Domestic",
                    "price": {
                        "raw": 0,
                        "formatted": "0.00",
                        "formatted_with_symbol": "$0.00",
                        "formatted_with_code": "0.00 USD"
                    },
                    "countries": [
                        "US"
                    ]
                }
            ],
            "price": {
                "raw": 0,
                "formatted": "0.00",
                "formatted_with_symbol": "$0.00",
                "formatted_with_code": "0.00 USD"
            }
        },
        "tax": {
            "amount": {
                "raw": 0,
                "formatted": "0.00",
                "formatted_with_symbol": "$0.00",
                "formatted_with_code": "0.00 USD"
            },
            "included_in_price": false,
            "breakdown": null,
            "zone": null
        },
        "total": {
            "raw": 17,
            "formatted": "17.00",
            "formatted_with_symbol": "$17.00",
            "formatted_with_code": "17.00 USD"
        },
        "total_with_tax": {
            "raw": 17,
            "formatted": "17.00",
            "formatted_with_symbol": "$17.00",
            "formatted_with_code": "17.00 USD"
        },
        "pay_what_you_want": {
            "enabled": false,
            "minimum": null,
            "customer_set_price": null
        }
    }
}

Request

GET /v1/checkouts/{checkout_token_id}/check/{line_item_id}/variant

URL Parameters

Parameter Status Description
checkout_token_id required The checkout token
line_item_id required The line item ID to check the variant for

Query Parameters

Parameter Status Description
variant_id required The variant ID to check
option_id required The variant option ID to check

Response Parameters

Parameter Type Description
available boolean Indicates that requested variant is available and can be chosen in the live object
name string The option name that matches the ID provided
price Price The price of the given option
option_id string The option ID that was provided
variant_id string The variant ID that was provided
line_item_id string The line item ID that was provided
live object The live object. See "get the live object"

Check requested quantity

Requires authentication

Validates that the requested quantity is available for the provided line item ID, and adjusts it in the order.

Request

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/item_7RyWOwmK5nEa2V/quantity?amount=5" \
    -H "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';
const lineItemId = 'item_7RyWOwmK5nEa2V';
const variantId = 'vrnt_Kvg9l6Apq51bB7';
const optionId = 'optn_3BkyN5YDRo0b69';

Commerce.checkout.checkVariant(checkoutTokenId, lineItemId, {
  variant_id: variantId,
  option_id: optionId,
}).then(response => console.log(response.available));
const url = new URL(
    "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/item_7RyWOwmK5nEa2V/quantity"
);

let params = {
    "amount": "5",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/item_7RyWOwmK5nEa2V/quantity'
params = {
  'amount': '5',
}
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()

Response (200)

{
    "available": true,
    "line_item_id": "item_7RyWOwmK5nEa2V",
    "requested_quantity": 5,
    "live": {
        "merchant_id": 2,
        "currency": {
            "code": "USD",
            "symbol": "$"
        },
        "line_items": [
            {
                "id": "item_7RyWOwmK5nEa2V",
                "product_id": "prod_4VPvL5zRQ5AQkX",
                "product_name": "Cart Debug Digital + Physical",
                "quantity": 5,
                "price": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "line_total": {
                    "raw": 55,
                    "formatted": "55.00",
                    "formatted_with_symbol": "$55.00",
                    "formatted_with_code": "55.00 USD"
                },
                "variants": [
                    {
                        "variant_id": "vrnt_kpnNwAyBrwmXB3",
                        "option_id": "optn_jp6dP5gMRwn7kA",
                        "variant_name": "Variant #2",
                        "option_name": "Option 1",
                        "price": {
                            "raw": 10,
                            "formatted": "10.00",
                            "formatted_with_symbol": "$10.00",
                            "formatted_with_code": "10.00 USD"
                        }
                    }
                ],
                "tax": {
                    "is_taxable": true,
                    "taxable_amount": 55,
                    "amount": 4.82,
                    "breakdown": [
                        {
                            "amount": 3.44,
                            "rate": 0.0625,
                            "rate_percentage": "6.25%",
                            "type": "state"
                        },
                        {
                            "amount": 0,
                            "rate": 0,
                            "rate_percentage": "0%",
                            "type": "city"
                        },
                        {
                            "amount": 0.14,
                            "rate": 0.0025,
                            "rate_percentage": "0.25%",
                            "type": "county"
                        },
                        {
                            "amount": 1.24,
                            "rate": 0.0225,
                            "rate_percentage": "2.25%",
                            "type": "district"
                        }
                    ]
                }
            },
            {
                "id": "item_1ypbroE658n4ea",
                "product_id": "prod_2yA6nldRBoEWbz",
                "product_name": "Cart Debug W/ Shipping",
                "quantity": 1,
                "price": {
                    "raw": 11,
                    "formatted": "11.00",
                    "formatted_with_symbol": "$11.00",
                    "formatted_with_code": "11.00 USD"
                },
                "line_total": {
                    "raw": 11,
                    "formatted": "11.00",
                    "formatted_with_symbol": "$11.00",
                    "formatted_with_code": "11.00 USD"
                },
                "variants": [],
                "tax": {
                    "is_taxable": true,
                    "taxable_amount": 11,
                    "amount": 0.97,
                    "breakdown": [
                        {
                            "amount": 0.69,
                            "rate": 0.0625,
                            "rate_percentage": "6.25%",
                            "type": "state"
                        },
                        {
                            "amount": 0,
                            "rate": 0,
                            "rate_percentage": "0%",
                            "type": "city"
                        },
                        {
                            "amount": 0.03,
                            "rate": 0.0025,
                            "rate_percentage": "0.25%",
                            "type": "county"
                        },
                        {
                            "amount": 0.25,
                            "rate": 0.0225,
                            "rate_percentage": "2.25%",
                            "type": "district"
                        }
                    ]
                }
            }
        ],
        "subtotal": {
            "raw": 66,
            "formatted": "66.00",
            "formatted_with_symbol": "$66.00",
            "formatted_with_code": "66.00 USD"
        },
        "discount": [],
        "shipping": {
            "available_options": [
                {
                    "id": "ship_bO6J5a8NyoEjpK",
                    "description": "tes",
                    "price": {
                        "raw": 2.33,
                        "formatted": "2.33",
                        "formatted_with_symbol": "$2.33",
                        "formatted_with_code": "2.33 USD"
                    },
                    "countries": [
                        "US"
                    ]
                },
                {
                    "id": "ship_31q0o3e21lDdjR",
                    "description": "USPS",
                    "price": {
                        "raw": 0.99,
                        "formatted": "0.99",
                        "formatted_with_symbol": "$0.99",
                        "formatted_with_code": "0.99 USD"
                    },
                    "countries": [
                        "US"
                    ]
                },
                {
                    "id": "ship_dKvg9l6vl1bB76",
                    "description": "Domestic",
                    "price": {
                        "raw": 0,
                        "formatted": "0.00",
                        "formatted_with_symbol": "$0.00",
                        "formatted_with_code": "0.00 USD"
                    },
                    "countries": [
                        "US"
                    ]
                }
            ],
            "price": {
                "raw": 0,
                "formatted": "0.00",
                "formatted_with_symbol": "$0.00",
                "formatted_with_code": "0.00 USD"
            }
        },
        "tax": {
            "amount": {
                "raw": 5.79,
                "formatted": "5.79",
                "formatted_with_symbol": "$5.79",
                "formatted_with_code": "5.79 USD"
            },
            "included_in_price": false,
            "breakdown": [
                {
                    "amount": 4.13,
                    "rate": 0.0625,
                    "rate_percentage": "6.25%",
                    "type": "state"
                },
                {
                    "amount": 0,
                    "rate": 0,
                    "rate_percentage": "0%",
                    "type": "city"
                },
                {
                    "amount": 0.17,
                    "rate": 0.0025,
                    "rate_percentage": "0.25%",
                    "type": "county"
                },
                {
                    "amount": 1.49,
                    "rate": 0.0225,
                    "rate_percentage": "2.25%",
                    "type": "district"
                }
            ],
            "zone": {
                "country": "US",
                "region": "CA",
                "postal_zip_code": "94103",
                "ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
            }
        },
        "total": {
            "raw": 66,
            "formatted": "66.00",
            "formatted_with_symbol": "$66.00",
            "formatted_with_code": "66.00 USD"
        },
        "total_with_tax": {
            "raw": 71.79,
            "formatted": "71.79",
            "formatted_with_symbol": "$71.79",
            "formatted_with_code": "71.79 USD"
        },
        "pay_what_you_want": {
            "enabled": false,
            "minimum": null,
            "customer_set_price": null
        }
    }
}

Request

GET /v1/checkouts/{checkout_token_id}/check/{line_item_id}/quantity

URL Parameters

Parameter Status Description
checkout_token_id required The checkout token
line_item_id required The line item ID to check the variant for

Query Parameters

Parameter Status Description
amount required Requested quantity amount as a positive integer

Response Parameters

Parameter Type Description
available boolean Whether the requested quantity is available and has been applied
line_item_id string The line item ID that was provided
requested_quantity integer The quantity that was requested for the line itme
live object The live object. See "get the live object"

Check discount code

Requires authentication

Validates a discount code for the provided checkout token, and applies it to the order.

Request

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/discount?code=ABC123ZYX" \
    -H "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';
const discountCode = 'ABC123ZYX';

Commerce.checkout.checkDiscount(checkoutTokenId, {
  code: discountCode,
}).then(response => console.log(response.valid, response.type, response.value));
const url = new URL(
    "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/discount"
);

let params = {
    "code": "ABC123ZYX",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/discount'
params = {
  'code': 'ABC123ZYX',
}
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()

Response (200)

{
    "valid": true,
    "type": "percentage",
    "code": "ABC123ZYX",
    "value": 50,
    "amount_saved": {
        "raw": 33,
        "formatted": "33.00",
        "formatted_with_symbol": "$33.00",
        "formatted_with_code": "33.00 USD"
    },
    "live": {
        "merchant_id": 2,
        "currency": {
            "code": "USD",
            "symbol": "$"
        },
        "line_items": [
            {
                "id": "item_7RyWOwmK5nEa2V",
                "product_id": "prod_4VPvL5zRQ5AQkX",
                "product_name": "Cart Debug Digital + Physical",
                "quantity": 5,
                "price": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "line_total": {
                    "raw": 55,
                    "formatted": "55.00",
                    "formatted_with_symbol": "$55.00",
                    "formatted_with_code": "55.00 USD"
                },
                "variants": [
                    {
                        "variant_id": "vrnt_kpnNwAyBrwmXB3",
                        "option_id": "optn_jp6dP5gMRwn7kA",
                        "variant_name": "Variant #2",
                        "option_name": "Option 1",
                        "price": {
                            "raw": 10,
                            "formatted": "10.00",
                            "formatted_with_symbol": "$10.00",
                            "formatted_with_code": "10.00 USD"
                        }
                    }
                ],
                "tax": {
                    "is_taxable": true,
                    "taxable_amount": 27.5,
                    "amount": 2.41,
                    "breakdown": [
                        {
                            "amount": 1.72,
                            "rate": 0.0625,
                            "rate_percentage": "6.25%",
                            "type": "state"
                        },
                        {
                            "amount": 0,
                            "rate": 0,
                            "rate_percentage": "0%",
                            "type": "city"
                        },
                        {
                            "amount": 0.07,
                            "rate": 0.0025,
                            "rate_percentage": "0.25%",
                            "type": "county"
                        },
                        {
                            "amount": 0.62,
                            "rate": 0.0225,
                            "rate_percentage": "2.25%",
                            "type": "district"
                        }
                    ]
                }
            },
            {
                "id": "item_1ypbroE658n4ea",
                "product_id": "prod_2yA6nldRBoEWbz",
                "product_name": "Cart Debug W/ Shipping",
                "quantity": 1,
                "price": {
                    "raw": 11,
                    "formatted": "11.00",
                    "formatted_with_symbol": "$11.00",
                    "formatted_with_code": "11.00 USD"
                },
                "line_total": {
                    "raw": 11,
                    "formatted": "11.00",
                    "formatted_with_symbol": "$11.00",
                    "formatted_with_code": "11.00 USD"
                },
                "variants": [],
                "tax": {
                    "is_taxable": true,
                    "taxable_amount": 5.5,
                    "amount": 0.47,
                    "breakdown": [
                        {
                            "amount": 0.34,
                            "rate": 0.0625,
                            "rate_percentage": "6.25%",
                            "type": "state"
                        },
                        {
                            "amount": 0,
                            "rate": 0,
                            "rate_percentage": "0%",
                            "type": "city"
                        },
                        {
                            "amount": 0.01,
                            "rate": 0.0025,
                            "rate_percentage": "0.25%",
                            "type": "county"
                        },
                        {
                            "amount": 0.12,
                            "rate": 0.0225,
                            "rate_percentage": "2.25%",
                            "type": "district"
                        }
                    ]
                }
            }
        ],
        "subtotal": {
            "raw": 66,
            "formatted": "66.00",
            "formatted_with_symbol": "$66.00",
            "formatted_with_code": "66.00 USD"
        },
        "discount": {
            "type": "percentage",
            "code": "ABC123ZYX",
            "value": "50.00",
            "amount_saved": {
                "raw": 33,
                "formatted": "33.00",
                "formatted_with_symbol": "$33.00",
                "formatted_with_code": "33.00 USD"
            },
            "product_id": null
        },
        "shipping": {
            "available_options": [
                {
                    "id": "ship_bO6J5a8NyoEjpK",
                    "description": "tes",
                    "price": {
                        "raw": 2.33,
                        "formatted": "2.33",
                        "formatted_with_symbol": "$2.33",
                        "formatted_with_code": "2.33 USD"
                    },
                    "countries": [
                        "US"
                    ]
                },
                {
                    "id": "ship_31q0o3e21lDdjR",
                    "description": "USPS",
                    "price": {
                        "raw": 0.99,
                        "formatted": "0.99",
                        "formatted_with_symbol": "$0.99",
                        "formatted_with_code": "0.99 USD"
                    },
                    "countries": [
                        "US"
                    ]
                },
                {
                    "id": "ship_dKvg9l6vl1bB76",
                    "description": "Domestic",
                    "price": {
                        "raw": 0,
                        "formatted": "0.00",
                        "formatted_with_symbol": "$0.00",
                        "formatted_with_code": "0.00 USD"
                    },
                    "countries": [
                        "US"
                    ]
                }
            ],
            "price": {
                "raw": 0,
                "formatted": "0.00",
                "formatted_with_symbol": "$0.00",
                "formatted_with_code": "0.00 USD"
            }
        },
        "tax": {
            "amount": {
                "raw": 2.88,
                "formatted": "2.88",
                "formatted_with_symbol": "$2.88",
                "formatted_with_code": "2.88 USD"
            },
            "included_in_price": false,
            "breakdown": [
                {
                    "amount": 2.06,
                    "rate": 0.0625,
                    "rate_percentage": "6.25%",
                    "type": "state"
                },
                {
                    "amount": 0,
                    "rate": 0,
                    "rate_percentage": "0%",
                    "type": "city"
                },
                {
                    "amount": 0.08,
                    "rate": 0.0025,
                    "rate_percentage": "0.25%",
                    "type": "county"
                },
                {
                    "amount": 0.74,
                    "rate": 0.0225,
                    "rate_percentage": "2.25%",
                    "type": "district"
                }
            ],
            "zone": {
                "country": "US",
                "region": "CA",
                "postal_zip_code": "94103",
                "ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
            }
        },
        "total": {
            "raw": 33,
            "formatted": "33.00",
            "formatted_with_symbol": "$33.00",
            "formatted_with_code": "33.00 USD"
        },
        "total_with_tax": {
            "raw": 35.88,
            "formatted": "35.88",
            "formatted_with_symbol": "$35.88",
            "formatted_with_code": "35.88 USD"
        },
        "pay_what_you_want": {
            "enabled": false,
            "minimum": null,
            "customer_set_price": null
        }
    }
}

Request

GET /v1/checkouts/{checkout_token_id}/check/discount

URL Parameters

Parameter Status Description
checkout_token_id required The checkout token

Query Parameters

Parameter Status Description
code required The discount code to use

Response Parameters

Parameter Type Description
valid boolean Whether the provided discount token was valid and has been applied to the live object
type string The type of the discount, "percentage" or "fixed"
code string The "code" used to redeem the discount
value number A percentage or fixed fee which represents the discount that should be applied
product_id string The product ID that this discount can only be applied to - or null if the discount is generic
amount_saved Price The amount that has been taken off the total cost by this discount
live object The live object. See "get the live object"

Check shipping method

Requires authentication

Validates a shipping method for the provided checkout token, and applies it to the order.

Request

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/shipping?shipping_option_id=ship_31q0o3e21lDdjR&country=US&region=CA" \
    -H "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';
const shippingOptionId = 'ship_31q0o3e21lDdjR';
const country = 'US';
const region = 'CA';

Commerce.checkout.checkShippingOption(checkoutTokenId, {
  shipping_option_id: shippingOptionId,
  country: country,
  region: region,
}).then(response => console.log(response.valid, response.live));
const url = new URL(
    "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/shipping"
);

let params = {
    "shipping_option_id": "ship_31q0o3e21lDdjR",
    "country": "US",
    "region": "CA",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/shipping'
params = {
  'shipping_option_id': 'ship_31q0o3e21lDdjR',
  'country': 'US',
  'region': 'CA',
}
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()

Response (200)

{
    "valid": true,
    "id": "ship_31q0o3e21lDdjR",
    "description": "USPS",
    "price": {
        "raw": 0.99,
        "formatted": "0.99",
        "formatted_with_symbol": "$0.99",
        "formatted_with_code": "0.99 USD"
    },
    "live": {
        "merchant_id": 2,
        "currency": {
            "code": "USD",
            "symbol": "$"
        },
        "line_items": [
            {
                "id": "item_7RyWOwmK5nEa2V",
                "product_id": "prod_4VPvL5zRQ5AQkX",
                "product_name": "Cart Debug Digital + Physical",
                "quantity": 5,
                "price": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "line_total": {
                    "raw": 55,
                    "formatted": "55.00",
                    "formatted_with_symbol": "$55.00",
                    "formatted_with_code": "55.00 USD"
                },
                "variants": [
                    {
                        "variant_id": "vrnt_kpnNwAyBrwmXB3",
                        "option_id": "optn_jp6dP5gMRwn7kA",
                        "variant_name": "Variant #2",
                        "option_name": "Option 1",
                        "price": {
                            "raw": 10,
                            "formatted": "10.00",
                            "formatted_with_symbol": "$10.00",
                            "formatted_with_code": "10.00 USD"
                        }
                    }
                ],
                "tax": {
                    "is_taxable": true,
                    "taxable_amount": 27.5,
                    "amount": 2.41,
                    "breakdown": [
                        {
                            "amount": 1.72,
                            "rate": 0.0625,
                            "rate_percentage": "6.25%",
                            "type": "state"
                        },
                        {
                            "amount": 0,
                            "rate": 0,
                            "rate_percentage": "0%",
                            "type": "city"
                        },
                        {
                            "amount": 0.07,
                            "rate": 0.0025,
                            "rate_percentage": "0.25%",
                            "type": "county"
                        },
                        {
                            "amount": 0.62,
                            "rate": 0.0225,
                            "rate_percentage": "2.25%",
                            "type": "district"
                        }
                    ]
                }
            },
            {
                "id": "item_1ypbroE658n4ea",
                "product_id": "prod_2yA6nldRBoEWbz",
                "product_name": "Cart Debug W/ Shipping",
                "quantity": 1,
                "price": {
                    "raw": 11,
                    "formatted": "11.00",
                    "formatted_with_symbol": "$11.00",
                    "formatted_with_code": "11.00 USD"
                },
                "line_total": {
                    "raw": 11,
                    "formatted": "11.00",
                    "formatted_with_symbol": "$11.00",
                    "formatted_with_code": "11.00 USD"
                },
                "variants": [],
                "tax": {
                    "is_taxable": true,
                    "taxable_amount": 5.5,
                    "amount": 0.47,
                    "breakdown": [
                        {
                            "amount": 0.34,
                            "rate": 0.0625,
                            "rate_percentage": "6.25%",
                            "type": "state"
                        },
                        {
                            "amount": 0,
                            "rate": 0,
                            "rate_percentage": "0%",
                            "type": "city"
                        },
                        {
                            "amount": 0.01,
                            "rate": 0.0025,
                            "rate_percentage": "0.25%",
                            "type": "county"
                        },
                        {
                            "amount": 0.12,
                            "rate": 0.0225,
                            "rate_percentage": "2.25%",
                            "type": "district"
                        }
                    ]
                }
            }
        ],
        "subtotal": {
            "raw": 66,
            "formatted": "66.00",
            "formatted_with_symbol": "$66.00",
            "formatted_with_code": "66.00 USD"
        },
        "discount": {
            "type": "percentage",
            "code": "50off",
            "value": "50.00",
            "amount_saved": {
                "raw": 33,
                "formatted": "33.00",
                "formatted_with_symbol": "$33.00",
                "formatted_with_code": "33.00 USD"
            },
            "product_id": null
        },
        "shipping": {
            "available_options": [
                {
                    "id": "ship_bO6J5a8NyoEjpK",
                    "description": "tes",
                    "price": {
                        "raw": 2.33,
                        "formatted": "2.33",
                        "formatted_with_symbol": "$2.33",
                        "formatted_with_code": "2.33 USD"
                    },
                    "countries": [
                        "US"
                    ]
                },
                {
                    "id": "ship_31q0o3e21lDdjR",
                    "description": "USPS",
                    "price": {
                        "raw": 0.99,
                        "formatted": "0.99",
                        "formatted_with_symbol": "$0.99",
                        "formatted_with_code": "0.99 USD"
                    },
                    "countries": [
                        "US"
                    ]
                },
                {
                    "id": "ship_dKvg9l6vl1bB76",
                    "description": "Domestic",
                    "price": {
                        "raw": 0,
                        "formatted": "0.00",
                        "formatted_with_symbol": "$0.00",
                        "formatted_with_code": "0.00 USD"
                    },
                    "countries": [
                        "US"
                    ]
                }
            ],
            "id": "ship_31q0o3e21lDdjR",
            "description": "USPS",
            "price": {
                "raw": 0.99,
                "formatted": "0.99",
                "formatted_with_symbol": "$0.99",
                "formatted_with_code": "0.99 USD"
            }
        },
        "tax": {
            "amount": {
                "raw": 2.88,
                "formatted": "2.88",
                "formatted_with_symbol": "$2.88",
                "formatted_with_code": "2.88 USD"
            },
            "included_in_price": false,
            "breakdown": [
                {
                    "amount": 2.06,
                    "rate": 0.0625,
                    "rate_percentage": "6.25%",
                    "type": "state"
                },
                {
                    "amount": 0,
                    "rate": 0,
                    "rate_percentage": "0%",
                    "type": "city"
                },
                {
                    "amount": 0.08,
                    "rate": 0.0025,
                    "rate_percentage": "0.25%",
                    "type": "county"
                },
                {
                    "amount": 0.74,
                    "rate": 0.0225,
                    "rate_percentage": "2.25%",
                    "type": "district"
                }
            ],
            "zone": {
                "country": "US",
                "region": "CA",
                "postal_zip_code": "94103",
                "ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
            }
        },
        "total": {
            "raw": 33.99,
            "formatted": "33.99",
            "formatted_with_symbol": "$33.99",
            "formatted_with_code": "33.99 USD"
        },
        "total_with_tax": {
            "raw": 36.87,
            "formatted": "36.87",
            "formatted_with_symbol": "$36.87",
            "formatted_with_code": "36.87 USD"
        },
        "pay_what_you_want": {
            "enabled": false,
            "minimum": null,
            "customer_set_price": null
        }
    }
}

Request

GET /v1/checkouts/{checkout_token_id}/check/shipping

URL Parameters

Parameter Status Description
checkout_token_id required The checkout token

Query Parameters

Parameter Status Description
shipping_option_id required The shipping method to use
country required The shipping country of the customer (a valid ISO 3166-1 alpha-2 country code)
region optional optional Required if regional shipping rates are enabled. Must be a valid short code for the region, e.g. CA for California or QB for Quebec. See helper "List all subdivisions for a country"

Response Parameters

Parameter Type Description
valid boolean Whether the provided shipping method was valid and has been applied to the live object
id string The shipping method ID
description string A description of the shipping method
price Price The cost of the shipping method
live object The live object. See "get the live object"

Check if order is free

Requires authentication

Returns whether the provided checkout token's order is free.

Request

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/is_free" \
    -H "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';

Commerce.checkout.isFree(checkoutTokenId).then(response => console.log(response.is_free));
const url = new URL(
    "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/is_free"
);

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/is_free'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Response (200)

{
    "is_free": false,
    "live": {
        "merchant_id": 2,
        "currency": {
            "code": "USD",
            "symbol": "$"
        },
        "line_items": [
            {
                "id": "item_7RyWOwmK5nEa2V",
                "product_id": "prod_4VPvL5zRQ5AQkX",
                "product_name": "Cart Debug Digital + Physical",
                "quantity": 1,
                "price": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "line_total": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "variants": [],
                "tax": {
                    "is_taxable": true,
                    "taxable_amount": 1,
                    "amount": 0.08,
                    "breakdown": [
                        {
                            "amount": 0.06,
                            "rate": 0.0625,
                            "rate_percentage": "6.25%",
                            "type": "state"
                        },
                        {
                            "amount": 0,
                            "rate": 0,
                            "rate_percentage": "0%",
                            "type": "city"
                        },
                        {
                            "amount": 0,
                            "rate": 0.0025,
                            "rate_percentage": "0.25%",
                            "type": "county"
                        },
                        {
                            "amount": 0.02,
                            "rate": 0.0225,
                            "rate_percentage": "2.25%",
                            "type": "district"
                        }
                    ]
                }
            },
            {
                "id": "item_1ypbroE658n4ea",
                "product_id": "prod_2yA6nldRBoEWbz",
                "product_name": "Cart Debug W/ Shipping",
                "quantity": 1,
                "price": {
                    "raw": 11,
                    "formatted": "11.00",
                    "formatted_with_symbol": "$11.00",
                    "formatted_with_code": "11.00 USD"
                },
                "line_total": {
                    "raw": 11,
                    "formatted": "11.00",
                    "formatted_with_symbol": "$11.00",
                    "formatted_with_code": "11.00 USD"
                },
                "variants": [],
                "tax": {
                    "is_taxable": true,
                    "taxable_amount": 11,
                    "amount": 0.97,
                    "breakdown": [
                        {
                            "amount": 0.69,
                            "rate": 0.0625,
                            "rate_percentage": "6.25%",
                            "type": "state"
                        },
                        {
                            "amount": 0,
                            "rate": 0,
                            "rate_percentage": "0%",
                            "type": "city"
                        },
                        {
                            "amount": 0.03,
                            "rate": 0.0025,
                            "rate_percentage": "0.25%",
                            "type": "county"
                        },
                        {
                            "amount": 0.25,
                            "rate": 0.0225,
                            "rate_percentage": "2.25%",
                            "type": "district"
                        }
                    ]
                }
            },
            {
                "id": "item_dKvg9l6vl1bB76",
                "product_id": "prod_Ekd6Ll2KYwV2mj",
                "product_name": "Cart Debug",
                "quantity": 1,
                "price": {
                    "raw": 12,
                    "formatted": "12.00",
                    "formatted_with_symbol": "$12.00",
                    "formatted_with_code": "12.00 USD"
                },
                "line_total": {
                    "raw": 12,
                    "formatted": "12.00",
                    "formatted_with_symbol": "$12.00",
                    "formatted_with_code": "12.00 USD"
                },
                "variants": [],
                "tax": {
                    "is_taxable": false,
                    "taxable_amount": 0,
                    "amount": 0,
                    "breakdown": null
                }
            }
        ],
        "subtotal": {
            "raw": 24,
            "formatted": "24.00",
            "formatted_with_symbol": "$24.00",
            "formatted_with_code": "24.00 USD"
        },
        "discount": [],
        "shipping": {
            "available_options": [
                {
                    "id": "ship_bO6J5a8NyoEjpK",
                    "description": "tes",
                    "price": {
                        "raw": 2.33,
                        "formatted": "2.33",
                        "formatted_with_symbol": "$2.33",
                        "formatted_with_code": "2.33 USD"
                    },
                    "countries": [
                        "US"
                    ]
                },
                {
                    "id": "ship_31q0o3e21lDdjR",
                    "description": "USPS",
                    "price": {
                        "raw": 0.99,
                        "formatted": "0.99",
                        "formatted_with_symbol": "$0.99",
                        "formatted_with_code": "0.99 USD"
                    },
                    "countries": [
                        "US"
                    ]
                },
                {
                    "id": "ship_dKvg9l6vl1bB76",
                    "description": "Domestic",
                    "price": {
                        "raw": 0,
                        "formatted": "0.00",
                        "formatted_with_symbol": "$0.00",
                        "formatted_with_code": "0.00 USD"
                    },
                    "countries": [
                        "US"
                    ]
                }
            ],
            "price": {
                "raw": 0,
                "formatted": "0.00",
                "formatted_with_symbol": "$0.00",
                "formatted_with_code": "0.00 USD"
            }
        },
        "tax": {
            "amount": {
                "raw": 1.05,
                "formatted": "1.05",
                "formatted_with_symbol": "$1.05",
                "formatted_with_code": "1.05 USD"
            },
            "included_in_price": false,
            "breakdown": [
                {
                    "amount": 0.75,
                    "rate": 0.0625,
                    "rate_percentage": "6.25%",
                    "type": "state"
                },
                {
                    "amount": 0,
                    "rate": 0,
                    "rate_percentage": "0%",
                    "type": "city"
                },
                {
                    "amount": 0.03,
                    "rate": 0.0025,
                    "rate_percentage": "0.25%",
                    "type": "county"
                },
                {
                    "amount": 0.27,
                    "rate": 0.0225,
                    "rate_percentage": "2.25%",
                    "type": "district"
                }
            ],
            "zone": {
                "country": "US",
                "region": "CA",
                "postal_zip_code": "94103",
                "ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
            }
        },
        "total": {
            "raw": 24,
            "formatted": "24.00",
            "formatted_with_symbol": "$24.00",
            "formatted_with_code": "24.00 USD"
        },
        "total_with_tax": {
            "raw": 25.05,
            "formatted": "25.05",
            "formatted_with_symbol": "$25.05",
            "formatted_with_code": "25.05 USD"
        },
        "pay_what_you_want": {
            "enabled": true,
            "minimum": {
                "raw": 25.05,
                "formatted": "25.05",
                "formatted_with_symbol": "$25.05",
                "formatted_with_code": "25.05 USD"
            },
            "customer_set_price": {
                "raw": 100,
                "formatted": "100.00",
                "formatted_with_symbol": "$100.00",
                "formatted_with_code": "100.00 USD"
            }
        }
    }
}

Request

GET /v1/checkouts/{checkout_token_id}/check/is_free

URL Parameters

Parameter Status Description
checkout_token_id required The checkout token

Response Parameters

Parameter Type Description
is_free boolean Whether no payment is required to capture an order
live object The live object. See "get the live object"

Get buyer's location from IP

Requires authentication

Calculates the buyer's physical location based on their IP address. This can be used to automatically select an appropriate shipping method.

You can provide an IP address to resolve, or it will be detected automatically for you. Please note that if you call this endpoint from a server-side request, the resolved IP will be that of your web server. In this case you must provide the IP address of the customer yourself.

Request

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/helper/location_from_ip?ip_address=123.45.67.89" \
    -H "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';
const ipAddress = '';

// Commerce.js will automatically use the clients IP if none is provided
Commerce.checkout.getLocationFromIP(checkoutTokenId, ipAddress).then(response => console.log(response));
const url = new URL(
    "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/helper/location_from_ip"
);

let params = {
    "ip_address": "123.45.67.89",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/helper/location_from_ip'
params = {
  'ip_address': '123.45.67.89',
}
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()

Response (200)

{
    "ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb",
    "country_code": "US",
    "country_name": "United States",
    "region_code": "CA",
    "region_name": "California",
    "city": "San Francisco",
    "postal_zip_code": "94103"
}

Request

GET /v1/checkouts/{checkout_token_id}/helper/location_from_ip

URL Parameters

Parameter Status Description
checkout_token_id required The checkout token

Query Parameters

Parameter Status Description
ip_address optional optional The IP address of the buyer

Response Parameters

Parameter Type Description
ip_address string The IP address that was provided or fetched from the request
country_code The ISO 3166-1 two-character code for the country that was resolved from the IP address
country_name The full name of the country that was resolved from the IP address
region_code The ISO 3166-2 region code for the subdivision that was resolved from the IP address
region_name The full name of the subdivision that was resolved from the IP address
city The full name of the city that was resolved from the IP address
postal_zip_code The postal/ZIP code that was resolved from the IP address

Check giftcard

Requires authentication

Validates a gift card for the provided checkout token, and applies it to the order.

Request

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/giftcard?code=ABC-123-ZYX" \
    -H "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';
const giftcardCode = 'ABC-123-ZYX';

Commerce.checkout.checkGiftcard(checkoutTokenId, {
  code: giftcardCode,
}).then(response => console.log(response.valid, response.credit, response.live));
const url = new URL(
    "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/giftcard"
);

let params = {
    "code": "ABC-123-ZYX",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/giftcard'
params = {
  'code': 'ABC-123-ZYX',
}
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()

Response (200)

{
    "valid": true,
    "code": "ABC-123-ZYX",
    "credit": "50.00",
    "tax_region": {
        "country": "US",
        "region": "CA",
        "postal_zip_code": "94103",
        "ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
    },
    "live": {
        "merchant_id": 2,
        "currency": {
            "code": "USD",
            "symbol": "$"
        },
        "line_items": [
            {
                "id": "item_7RyWOwmK5nEa2V",
                "product_id": "prod_4VPvL5zRQ5AQkX",
                "product_name": "Cart Debug Digital + Physical",
                "quantity": 1,
                "price": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "line_total": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "variants": [],
                "tax": {
                    "is_taxable": true,
                    "taxable_amount": 1,
                    "amount": 0.08,
                    "breakdown": [
                        {
                            "amount": 0.06,
                            "rate": 0.0625,
                            "rate_percentage": "6.25%",
                            "type": "state"
                        },
                        {
                            "amount": 0,
                            "rate": 0,
                            "rate_percentage": "0%",
                            "type": "city"
                        },
                        {
                            "amount": 0,
                            "rate": 0.0025,
                            "rate_percentage": "0.25%",
                            "type": "county"
                        },
                        {
                            "amount": 0.02,
                            "rate": 0.0225,
                            "rate_percentage": "2.25%",
                            "type": "district"
                        }
                    ]
                }
            },
            {
                "id": "item_1ypbroE658n4ea",
                "product_id": "prod_2yA6nldRBoEWbz",
                "product_name": "Cart Debug W/ Shipping",
                "quantity": 1,
                "price": {
                    "raw": 11,
                    "formatted": "11.00",
                    "formatted_with_symbol": "$11.00",
                    "formatted_with_code": "11.00 USD"
                },
                "line_total": {
                    "raw": 11,
                    "formatted": "11.00",
                    "formatted_with_symbol": "$11.00",
                    "formatted_with_code": "11.00 USD"
                },
                "variants": [],
                "tax": {
                    "is_taxable": true,
                    "taxable_amount": 11,
                    "amount": 0.97,
                    "breakdown": [
                        {
                            "amount": 0.69,
                            "rate": 0.0625,
                            "rate_percentage": "6.25%",
                            "type": "state"
                        },
                        {
                            "amount": 0,
                            "rate": 0,
                            "rate_percentage": "0%",
                            "type": "city"
                        },
                        {
                            "amount": 0.03,
                            "rate": 0.0025,
                            "rate_percentage": "0.25%",
                            "type": "county"
                        },
                        {
                            "amount": 0.25,
                            "rate": 0.0225,
                            "rate_percentage": "2.25%",
                            "type": "district"
                        }
                    ]
                }
            }
        ],
        "subtotal": {
            "raw": 12,
            "formatted": "12.00",
            "formatted_with_symbol": "$12.00",
            "formatted_with_code": "12.00 USD"
        },
        "discount": [],
        "shipping": {
            "available_options": [
                {
                    "id": "ship_bO6J5a8NyoEjpK",
                    "description": "tes",
                    "price": {
                        "raw": 2.33,
                        "formatted": "2.33",
                        "formatted_with_symbol": "$2.33",
                        "formatted_with_code": "2.33 USD"
                    },
                    "countries": [
                        "US"
                    ]
                },
                {
                    "id": "ship_31q0o3e21lDdjR",
                    "description": "USPS",
                    "price": {
                        "raw": 0.99,
                        "formatted": "0.99",
                        "formatted_with_symbol": "$0.99",
                        "formatted_with_code": "0.99 USD"
                    },
                    "countries": [
                        "US"
                    ]
                },
                {
                    "id": "ship_dKvg9l6vl1bB76",
                    "description": "Domestic",
                    "price": {
                        "raw": 0,
                        "formatted": "0.00",
                        "formatted_with_symbol": "$0.00",
                        "formatted_with_code": "0.00 USD"
                    },
                    "countries": [
                        "US"
                    ]
                }
            ],
            "price": {
                "raw": 0,
                "formatted": "0.00",
                "formatted_with_symbol": "$0.00",
                "formatted_with_code": "0.00 USD"
            }
        },
        "tax": {
            "amount": {
                "raw": 1.05,
                "formatted": "1.05",
                "formatted_with_symbol": "$1.05",
                "formatted_with_code": "1.05 USD"
            },
            "included_in_price": false,
            "breakdown": [
                {
                    "amount": 0.75,
                    "rate": 0.0625,
                    "rate_percentage": "6.25%",
                    "type": "state"
                },
                {
                    "amount": 0,
                    "rate": 0,
                    "rate_percentage": "0%",
                    "type": "city"
                },
                {
                    "amount": 0.03,
                    "rate": 0.0025,
                    "rate_percentage": "0.25%",
                    "type": "county"
                },
                {
                    "amount": 0.27,
                    "rate": 0.0225,
                    "rate_percentage": "2.25%",
                    "type": "district"
                }
            ],
            "zone": {
                "country": "US",
                "region": "CA",
                "postal_zip_code": "94103",
                "ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
            }
        },
        "total": {
            "raw": 12,
            "formatted": "12.00",
            "formatted_with_symbol": "$12.00",
            "formatted_with_code": "12.00 USD"
        },
        "total_with_tax": {
            "raw": 13.05,
            "formatted": "13.05",
            "formatted_with_symbol": "$13.05",
            "formatted_with_code": "13.05 USD"
        },
        "pay_what_you_want": {
            "enabled": false,
            "minimum": null,
            "customer_set_price": null
        }
    }
}

Request

GET /v1/checkouts/{checkout_token_id}/check/giftcard

URL Parameters

Parameter Status Description
checkout_token_id required The checkout token

Query Parameters

Parameter Status Description
code required The giftcard code to use

Response Parameters

Parameter Type Description
valid boolean Whether the gift card code was valid and the gift card has been added to the live object
code string The gift card code that was used
credit number The remaining credit on the gift card
live object The live object. See "get the live object"

Get client-side validation rules

Requires authentication

This helper generates client-side validation rules which can be passed directly into most JavaScript validation libraries. Make sure the form input names match the names in the response.

Examples:

Request

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/helper/validation" \
    -H "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';

Commerce.checkout.helperValidation(checkoutTokenId).then(response => console.log(response.rules));
const url = new URL(
    "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/helper/validation"
);

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/helper/validation'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Response (200)

{
    "rules": {
        "customer[email]": {
            "email": true,
            "required": true
        },
        "shipping[name]": {
            "required": true
        },
        "shipping[street]": {
            "required": true
        },
        "shipping[town_city]": {
            "required": true
        },
        "shipping[county_state]": {
            "required": true
        },
        "shipping[postal_zip_code]": {
            "required": true
        },
        "shipping[country]": {
            "required": true
        },
        "fulfillment[shipping_method]": {
            "required": true
        },
        "line_items[item_7RyWOwmK5nEa2V][quantity]": {
            "digits": true
        },
        "line_items[item_7RyWOwmK5nEa2V][variants][vrnt_Kvg9l6Apq51bB7]": {
            "required": true
        },
        "line_items[item_7RyWOwmK5nEa2V][variants][vrnt_kpnNwAyBrwmXB3]": {
            "required": true
        },
        "line_items[item_1ypbroE658n4ea][quantity]": {
            "digits": true
        },
        "extrafields[extr_7RyWOwmK5nEa2V]": {
            "required": true
        }
    }
}

Request

GET /v1/checkouts/{checkout_token_id}/helper/validation

URL Parameters

Parameter Status Description
checkout_token_id required The checkout token

Response Parameters

Parameter Type Description
rules object An object keyed by field name, with values that correspond to validation rules that apply to that field

Get available shipping methods

Requires authentication

Returns a list of available shipping methods for the provided checkout token.

This endpoint will also return a 404 response if no shipping methods are available for the provided country.

Request

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/helper/shipping_options?country=US&region=CA" \
    -H "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';
const country = 'US';
const region = 'CA';

Commerce.checkout.getShippingOptions(checkoutTokenId, {
  country: country,
  region: region,
}).then(options => console.log(options));
const url = new URL(
    "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/helper/shipping_options"
);

let params = {
    "country": "US",
    "region": "CA",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/helper/shipping_options'
params = {
  'country': 'US',
  'region': 'CA',
}
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()

Response (200)

[
    {
        "id": "ship_bO6J5a8NyoEjpK",
        "description": "tes",
        "price": {
            "raw": 2.33,
            "formatted": "2.33",
            "formatted_with_symbol": "$2.33",
            "formatted_with_code": "2.33 USD"
        },
        "countries": [
            "US"
        ]
    },
    {
        "id": "ship_31q0o3e21lDdjR",
        "description": "USPS",
        "price": {
            "raw": 0.99,
            "formatted": "0.99",
            "formatted_with_symbol": "$0.99",
            "formatted_with_code": "0.99 USD"
        },
        "countries": [
            "US"
        ]
    },
    {
        "id": "ship_dKvg9l6vl1bB76",
        "description": "Domestic",
        "price": {
            "raw": 0,
            "formatted": "0.00",
            "formatted_with_symbol": "$0.00",
            "formatted_with_code": "0.00 USD"
        },
        "countries": [
            "US"
        ]
    }
]

Request

GET /v1/checkouts/{checkout_token_id}/helper/shipping_options

URL Parameters

Parameter Status Description
checkout_token_id required The checkout token

Query Parameters

Parameter Status Description
country required The shipping country of the customer (a valid ISO 3166-1 alpha-2 country code)
region optional optional Required if regional shipping rates are enabled. Must be a valid short code for the region, e.g. CA for California or QB for Quebec. See helper "List all subdivisions for a country"

Response Parameters

Parameter Type Description
id string The ID of the shipping method
description string A description of the shipping method
price Price The cost of the shipping method
country.* string Countries (a valid ISO 3166-1 alpha-2 country code) that this shipping method is valid for

Set tax zone

Requires authentication

Sets the tax zone for the provided checkout token's order, either automatically from a provided IP address, or by the geographic data provided in the request arguments.

Request

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/helper/set_tax_zone?country=US&region=CA&postal_zip_code=94107" \
    -H "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';
const country = 'US';
const region = 'CA';
const postCode = '94107'

Commerce.checkout.setTaxZone(checkoutTokenId, {
  country: country,
  region: region,
  postal_zip_code: postCode,
}).then(response => console.log(response.valid, response.live));
const url = new URL(
    "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/helper/set_tax_zone"
);

let params = {
    "country": "US",
    "region": "CA",
    "postal_zip_code": "94107",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/helper/set_tax_zone'
params = {
  'country': 'US',
  'region': 'CA',
  'postal_zip_code': '94107',
}
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()

Response (200)

{
    "valid": true,
    "tax_region": {
        "country": "US",
        "region": "CA",
        "postal_zip_code": "94103",
        "ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
    },
    "live": {
        "merchant_id": 2,
        "currency": {
            "code": "USD",
            "symbol": "$"
        },
        "line_items": [
            {
                "id": "item_7RyWOwmK5nEa2V",
                "product_id": "prod_4VPvL5zRQ5AQkX",
                "product_name": "Cart Debug Digital + Physical",
                "quantity": 1,
                "price": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "line_total": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "variants": [],
                "tax": {
                    "is_taxable": true,
                    "taxable_amount": 1,
                    "amount": 0.08,
                    "breakdown": [
                        {
                            "amount": 0.06,
                            "rate": 0.0625,
                            "rate_percentage": "6.25%",
                            "type": "state"
                        },
                        {
                            "amount": 0,
                            "rate": 0,
                            "rate_percentage": "0%",
                            "type": "city"
                        },
                        {
                            "amount": 0,
                            "rate": 0.0025,
                            "rate_percentage": "0.25%",
                            "type": "county"
                        },
                        {
                            "amount": 0.02,
                            "rate": 0.0225,
                            "rate_percentage": "2.25%",
                            "type": "district"
                        }
                    ]
                }
            },
            {
                "id": "item_1ypbroE658n4ea",
                "product_id": "prod_2yA6nldRBoEWbz",
                "product_name": "Cart Debug W/ Shipping",
                "quantity": 1,
                "price": {
                    "raw": 11,
                    "formatted": "11.00",
                    "formatted_with_symbol": "$11.00",
                    "formatted_with_code": "11.00 USD"
                },
                "line_total": {
                    "raw": 11,
                    "formatted": "11.00",
                    "formatted_with_symbol": "$11.00",
                    "formatted_with_code": "11.00 USD"
                },
                "variants": [],
                "tax": {
                    "is_taxable": true,
                    "taxable_amount": 11,
                    "amount": 0.97,
                    "breakdown": [
                        {
                            "amount": 0.69,
                            "rate": 0.0625,
                            "rate_percentage": "6.25%",
                            "type": "state"
                        },
                        {
                            "amount": 0,
                            "rate": 0,
                            "rate_percentage": "0%",
                            "type": "city"
                        },
                        {
                            "amount": 0.03,
                            "rate": 0.0025,
                            "rate_percentage": "0.25%",
                            "type": "county"
                        },
                        {
                            "amount": 0.25,
                            "rate": 0.0225,
                            "rate_percentage": "2.25%",
                            "type": "district"
                        }
                    ]
                }
            }
        ],
        "subtotal": {
            "raw": 12,
            "formatted": "12.00",
            "formatted_with_symbol": "$12.00",
            "formatted_with_code": "12.00 USD"
        },
        "discount": [],
        "shipping": {
            "available_options": [
                {
                    "id": "ship_bO6J5a8NyoEjpK",
                    "description": "tes",
                    "price": {
                        "raw": 2.33,
                        "formatted": "2.33",
                        "formatted_with_symbol": "$2.33",
                        "formatted_with_code": "2.33 USD"
                    },
                    "countries": [
                        "US"
                    ]
                },
                {
                    "id": "ship_31q0o3e21lDdjR",
                    "description": "USPS",
                    "price": {
                        "raw": 0.99,
                        "formatted": "0.99",
                        "formatted_with_symbol": "$0.99",
                        "formatted_with_code": "0.99 USD"
                    },
                    "countries": [
                        "US"
                    ]
                },
                {
                    "id": "ship_dKvg9l6vl1bB76",
                    "description": "Domestic",
                    "price": {
                        "raw": 0,
                        "formatted": "0.00",
                        "formatted_with_symbol": "$0.00",
                        "formatted_with_code": "0.00 USD"
                    },
                    "countries": [
                        "US"
                    ]
                }
            ],
            "price": {
                "raw": 0,
                "formatted": "0.00",
                "formatted_with_symbol": "$0.00",
                "formatted_with_code": "0.00 USD"
            }
        },
        "tax": {
            "amount": {
                "raw": 1.05,
                "formatted": "1.05",
                "formatted_with_symbol": "$1.05",
                "formatted_with_code": "1.05 USD"
            },
            "included_in_price": false,
            "breakdown": [
                {
                    "amount": 0.75,
                    "rate": 0.0625,
                    "rate_percentage": "6.25%",
                    "type": "state"
                },
                {
                    "amount": 0,
                    "rate": 0,
                    "rate_percentage": "0%",
                    "type": "city"
                },
                {
                    "amount": 0.03,
                    "rate": 0.0025,
                    "rate_percentage": "0.25%",
                    "type": "county"
                },
                {
                    "amount": 0.27,
                    "rate": 0.0225,
                    "rate_percentage": "2.25%",
                    "type": "district"
                }
            ],
            "zone": {
                "country": "US",
                "region": "CA",
                "postal_zip_code": "94103",
                "ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
            }
        },
        "total": {
            "raw": 12,
            "formatted": "12.00",
            "formatted_with_symbol": "$12.00",
            "formatted_with_code": "12.00 USD"
        },
        "total_with_tax": {
            "raw": 13.05,
            "formatted": "13.05",
            "formatted_with_symbol": "$13.05",
            "formatted_with_code": "13.05 USD"
        },
        "pay_what_you_want": {
            "enabled": false,
            "minimum": null,
            "customer_set_price": null
        }
    }
}

Request

GET /v1/checkouts/{checkout_token_id}/helper/set_tax_zone

URL Parameters

Parameter Status Description
checkout_token_id required The checkout token

Query Parameters

Parameter Status Description
ip_address optional optional Required if only using IP address to set the tax location. This will set the tax location to the estimated geographic location from this IP address.
country optional optional Required if not using IP address to set tax location. Must be a valid ISO 3166-1 alpha-2 country code (e.g. GB - United Kingdom).
region optional optional Required if Canada (CA) or USA (US). Must be a valid short code for the region, e.g. CA - California, or QB - Quebec.
postal_zip_code optional optional Required if merchant has Auto US Sales Tax turned on.

Response Parameters

Parameter Type Description
valid boolean Whether the provided tax zone was valid and has been applied to the live object
tax_region.country string The ISO 3166-2 code for the customers country
tax_region.region string The customer provided (or geo-located) region for the customer
tax_region.postal_zip_code string The customer provided (or geo-located) postal/ZIP code for the customer
tax_region.ip_address string The IP address used when the tax information has been calculcated from the IP address
live object The live object. See "get the live object"

List all countries

Requires authentication

Returns a list of all countries registered in the platform. See "List available shipping countries" for an equivalent list of countries that can be shipped to for your account.

Request

curl -X GET \
    -G "https://api.chec.io/v1/services/locale/countries" \
    -H "X-Authorization: {token}"
Commerce.services.localeListCountries().then(response => console.log(response.countries));
const url = new URL(
    "https://api.chec.io/v1/services/locale/countries"
);

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/services/locale/countries'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Response (200)

{
    "countries": {
        "AF": "Afghanistan",
        "AL": "Albania",
        "DZ": "Algeria",
        "AS": "American Samoa",
        "AD": "Andorra",
        "AO": "Angola",
        "AI": "Anguilla",
        "AQ": "Antarctica",
        "AG": "Antigua & Barbuda",
        "AR": "Argentina",
        "AM": "Armenia",
        "AW": "Aruba",
        "AU": "Australia",
        "AT": "Austria",
        "AZ": "Azerbaijan",
        "BS": "Bahamas",
        "BH": "Bahrain",
        "BD": "Bangladesh",
        "BB": "Barbados",
        "..": ".."
    },
    "html": "<option value=\"AF\">Afghanistan</option><option value=\"AL\">Albania</option><option>...</option>, <option>...</option>, <option>...</option>"
}

Request

GET /v1/services/locale/countries

Response Parameters

Parameter Type Description
countries object An object of all countries where keys are ISO 3166-1 alpha-2 country codes and values are full names of the countries
html string A string of all countries compiled into HTML option tags where the values are ISO 3166-1 alpha-2 country codes

List all subdivisions for a country

Requires authentication

Given a valid country code, returns a list of all subdivisions (states, provinces, or regions) for that country. See "List available shipping subdivions for country" for an equivalent list of subdivisions that can be shipped to for your account.

Request

curl -X GET \
    -G "https://api.chec.io/v1/services/locale/US/subdivisions" \
    -H "X-Authorization: {token}"
const country = 'US';

Commerce.services.localeListSubdivisions(country).then(response => console.log(response.subdivisions));
const url = new URL(
    "https://api.chec.io/v1/services/locale/US/subdivisions"
);

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/services/locale/US/subdivisions'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Response (200)

{
    "subdivisions": {
        "AL": "Alabama",
        "AK": "Alaska",
        "AZ": "Arizona",
        "AR": "Arkansas",
        "CA": "California",
        "CO": "Colorado",
        "CT": "Connecticut",
        "DE": "Delaware",
        "FL": "Florida",
        "..": "..."
    },
    "html": "<option value=\"AL\">Alabama</option><option value=\"AK\">Alaska</option><option value=\"AZ\">Arizona</option><option value=\"AR\">Arkansas</option><option>...</option>, <option>...</option>, <option>...</option>"
}

Request

GET /v1/services/locale/{country_code}/subdivisions

URL Parameters

Parameter Status Description
country_code required Must be a valid ISO 3166-1 alpha-2 country code (e.g. GB - United Kingdom)

Response Parameters

Parameter Type Description
countries object An object of all countries where keys are ISO 3166-2 subdivision codes and values are full names of the subdivisions
html string A string of all subdivisions compiled into HTML option tags where the values are ISO 3166-2 subdivision codes

List available shipping countries

Requires authentication

Returns only the countries which can be shipped to for the current checkout.

Request

curl -X GET \
    -G "https://api.chec.io/v1/services/locale/chkt_L5z3kmQpdpkGlA/countries" \
    -H "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
    "https://api.chec.io/v1/services/locale/chkt_L5z3kmQpdpkGlA/countries"
);

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/services/locale/chkt_L5z3kmQpdpkGlA/countries'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Response (200)

{
    "countries": {
        "US": "United States"
    },
    "html": "<option value=\"US\">United States</option>"
}

Request

GET /v1/services/locale/{checkout_token_id}/countries

URL Parameters

Parameter Status Description
checkout_token_id required The checkout token

Response Parameters

Parameter Type Description
countries object An object of all countries where keys are ISO 3166-1 alpha-2 country codes and values are full names of the countries
html string A string of all countries compiled into HTML option tags where the values are ISO 3166-1 alpha-2 country codes

List available shipping subdivisions for country

Requires authentication

Returns only the subdivisions (states, provinces, or regions) in a country which can be shipped to for the current checkout.

Request

curl -X GET \
    -G "https://api.chec.io/v1/services/locale/chkt_L5z3kmQpdpkGlA/countries/US/subdivisions" \
    -H "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
    "https://api.chec.io/v1/services/locale/chkt_L5z3kmQpdpkGlA/countries/US/subdivisions"
);

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/services/locale/chkt_L5z3kmQpdpkGlA/countries/US/subdivisions'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Response (200)

{
    "subdivisions": {
        "US-AL": "Alabama",
        "US-AK": "Alaska",
        "US-AS": "American Samoa",
        "US-AZ": "Arizona",
        "US-AR": "Arkansas",
        "US-CA": "California",
        "US-CO": "Colorado"
    },
    "html": "<option value=\"US-AL\">Alabama</option><option value=\"US-AK\">Alaska</option><option value=\"US-AS\">American Samoa</option><option value=\"US-AZ\">Arizona</option><option value=\"US-AR\">Arkansas</option><option value=\"US-CA\">California</option><option value=\"US-CO\">Colorado</option>"
}

Request

GET /v1/services/locale/{checkout_token_id}/countries/{country_code}/subdivisions

URL Parameters

Parameter Status Description
checkout_token_id required The checkout token
country_code required Must be a valid ISO 3166-1 alpha-2 country code (e.g. GB - United Kingdom)

Response Parameters

Parameter Type Description
countries object An object of all countries where keys are ISO 3166-2 subdivision codes and values are full names of the subdivisions
html string A string of all subdivisions compiled into HTML option tags where the values are ISO 3166-2 subdivision codes

Customers

Issue and send login token

Requires authentication

This endpoint accepts an email argument which is used to resolve a customer in your account and send them a one-click login email. The email will contain a link (based off of the base_url argument) which contains a short-lived login token.

When the user opens the token link, the token will be exchanged for a JSON web token which is scoped to that particular customer, and has permission to access that customer's orders, addresses, etc.

Tokens are valid for 30 minutes from when they are issued. Issuing subsequent tokens will automatically revoke previously issued tokens.

Request

curl -X POST \
    "https://api.chec.io/v1/customers/email-token" \
    -H "X-Authorization: {token}" \
    -H "Content-Type: application/json" \
    -d '{"email":"leslie.lawless@example.com","base_url":"modi"}'

// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
    "https://api.chec.io/v1/customers/email-token"
);

let headers = {
    "X-Authorization": "{token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "leslie.lawless@example.com",
    "base_url": "modi"
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/customers/email-token'
payload = {
    "email": "leslie.lawless@example.com",
    "base_url": "modi"
}
headers = {
  'X-Authorization': '{token}',
  'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Response (201)

{
    "success": true
}

Request

POST /v1/customers/email-token

Body Parameters

Parameter Type Status Description
email required optional The email address for the customer
base_url required optional The base URL to attach the token to. Use {token} as a placeholder for the token,

Exchange login token for JWT

Requires authentication

Obtain a JSON web token scoped to the customer the provided token belongs to. The returned JWT will be valid for 24 hours, and may be used to authorize API calls to the "Customers" API endpoints, such as "get orders", etc.

Request

curl -X POST \
    "https://api.chec.io/v1/customers/exchange-token" \
    -H "X-Authorization: {token}" \
    -H "Content-Type: application/json" \
    -d '{"token":"1ae420a5-2f43-426f-8a61-516eabb56d33"}'

// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
    "https://api.chec.io/v1/customers/exchange-token"
);

let headers = {
    "X-Authorization": "{token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "token": "1ae420a5-2f43-426f-8a61-516eabb56d33"
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/customers/exchange-token'
payload = {
    "token": "1ae420a5-2f43-426f-8a61-516eabb56d33"
}
headers = {
  'X-Authorization': '{token}',
  'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Response (200)

{
    "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}

Request

POST /v1/customers/exchange-token

Body Parameters

Parameter Type Status Description
token string required Login token for a customer

List orders for customer

Requires authentication

Returns a list of orders that belong to the provided customer ID. The response from this API is the same as "List orders".

Request

curl -X GET \
    -G "https://api.chec.io/v1/customers/cstmr_f89398fs489g/orders" \
    -H "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
    "https://api.chec.io/v1/customers/cstmr_f89398fs489g/orders"
);

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/customers/cstmr_f89398fs489g/orders'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Response (200)

{
    "data": [
        {
            "version": "v1",
            "sandbox": true,
            "id": "ord_p7ZAMo1xwNJ4xX",
            "checkout_token_id": "chkt_Lwj1jnaN6W9pl3",
            "cart_id": "cart_XmwD43GnjbAXwr",
            "customer_reference": "TSTNC-21",
            "created": 1479510592,
            "last_updated": 1479510592,
            "status_payment": "paid",
            "status_fulfillment": "not_fulfilled",
            "currency": {
                "code": "USD",
                "symbol": "$"
            },
            "order_value": {
                "raw": 100,
                "formatted": "100.00",
                "formatted_with_symbol": "$100.00",
                "formatted_with_code": "100.00 USD"
            },
            "customer": {
                "email": "hello@chec.io"
            },
            "extrafields": [
                {
                    "id": "extr_7RyWOwmK5nEa2V",
                    "name": "Test",
                    "value": "Test",
                    "required": true
                },
                {
                    "id": "extr_1ypbroE658n4ea",
                    "name": "Website",
                    "value": "commercejs.com",
                    "required": false
                }
            ],
            "shipping": {
                "name": "John Doe",
                "street": "123 Fake St",
                "town_city": "San Francisco",
                "county_state": "CA",
                "postal_zip_code": "94103",
                "country": "US"
            },
            "billing": null,
            "order": {
                "line_items": [
                    {
                        "id": "item_7RyWOwmK5nEa2V",
                        "product_id": "prod_4VPvL5zRQ5AQkX",
                        "product_name": "Cart Debug Digital + Physical",
                        "quantity": 1,
                        "price": {
                            "raw": 1,
                            "formatted": "1.00",
                            "formatted_with_symbol": "$1.00",
                            "formatted_with_code": "1.00 USD"
                        },
                        "line_total": {
                            "raw": 31,
                            "formatted": "31.00",
                            "formatted_with_symbol": "$31.00",
                            "formatted_with_code": "31.00 USD"
                        },
                        "variants": [
                            {
                                "variant_id": "vrnt_kpnNwAyBrwmXB3",
                                "option_id": "optn_PAYrQlWDbwnbR4",
                                "variant_name": "Variant #2",
                                "option_name": "Option 2",
                                "price": {
                                    "raw": 20,
                                    "formatted": "20.00",
                                    "formatted_with_symbol": "20.00",
                                    "formatted_with_code": "20.00 "
                                }
                            },
                            {
                                "variant_id": "vrnt_Kvg9l6Apq51bB7",
                                "option_id": "optn_r31q0o3E8lDdjR",
                                "variant_name": "Variant #1",
                                "option_name": "Option 2",
                                "price": {
                                    "raw": 10,
                                    "formatted": "10.00",
                                    "formatted_with_symbol": "10.00",
                                    "formatted_with_code": "10.00 "
                                }
                            }
                        ],
                        "is_taxable": true,
                        "taxable_amount": {
                            "raw": 31,
                            "formatted": "31.00",
                            "formatted_with_symbol": "$31.00",
                            "formatted_with_code": "31.00 USD"
                        },
                        "tax_rate": 0.0875,
                        "tax_rate_percentage": "8.75%",
                        "tax_amount": {
                            "raw": 2.72,
                            "formatted": "2.72",
                            "formatted_with_symbol": "$2.72",
                            "formatted_with_code": "2.72 USD"
                        },
                        "tax_lines": [
                            {
                                "amount": {
                                    "raw": 1.94,
                                    "formatted": "1.94",
                                    "formatted_with_symbol": "$1.94",
                                    "formatted_with_code": "1.94 USD"
                                },
                                "rate": 0.0625,
                                "rate_percentage": "6.25%",
                                "type": "state"
                            },
                            {
                                "amount": {
                                    "raw": 0,
                                    "formatted": "0.00",
                                    "formatted_with_symbol": "$0.00",
                                    "formatted_with_code": "0.00 USD"
                                },
                                "rate": 0,
                                "rate_percentage": "0%",
                                "type": "city"
                            },
                            {
                                "amount": {
                                    "raw": 0.08,
                                    "formatted": "0.08",
                                    "formatted_with_symbol": "$0.08",
                                    "formatted_with_code": "0.08 USD"
                                },
                                "rate": 0.0025,
                                "rate_percentage": "0.25%",
                                "type": "county"
                            },
                            {
                                "amount": {
                                    "raw": 0.7,
                                    "formatted": "0.70",
                                    "formatted_with_symbol": "$0.70",
                                    "formatted_with_code": "0.70 USD"
                                },
                                "rate": 0.0225,
                                "rate_percentage": "2.25%",
                                "type": "district"
                            }
                        ]
                    },
                    {
                        "id": "item_1ypbroE658n4ea",
                        "product_id": "prod_2yA6nldRBoEWbz",
                        "product_name": "Cart Debug W/ Shipping",
                        "quantity": 1,
                        "price": {
                            "raw": 11,
                            "formatted": "11.00",
                            "formatted_with_symbol": "$11.00",
                            "formatted_with_code": "11.00 USD"
                        },
                        "line_total": {
                            "raw": 11,
                            "formatted": "11.00",
                            "formatted_with_symbol": "$11.00",
                            "formatted_with_code": "11.00 USD"
                        },
                        "variants": [],
                        "is_taxable": true,
                        "taxable_amount": {
                            "raw": 11,
                            "formatted": "11.00",
                            "formatted_with_symbol": "$11.00",
                            "formatted_with_code": "11.00 USD"
                        },
                        "tax_rate": 0.0875,
                        "tax_rate_percentage": "8.75%",
                        "tax_amount": {
                            "raw": 0.97,
                            "formatted": "0.97",
                            "formatted_with_symbol": "$0.97",
                            "formatted_with_code": "0.97 USD"
                        },
                        "tax_lines": [
                            {
                                "amount": {
                                    "raw": 0.69,
                                    "formatted": "0.69",
                                    "formatted_with_symbol": "$0.69",
                                    "formatted_with_code": "0.69 USD"
                                },
                                "rate": 0.0625,
                                "rate_percentage": "6.25%",
                                "type": "state"
                            },
                            {
                                "amount": {
                                    "raw": 0,
                                    "formatted": "0.00",
                                    "formatted_with_symbol": "$0.00",
                                    "formatted_with_code": "0.00 USD"
                                },
                                "rate": 0,
                                "rate_percentage": "0%",
                                "type": "city"
                            },
                            {
                                "amount": {
                                    "raw": 0.03,
                                    "formatted": "0.03",
                                    "formatted_with_symbol": "$0.03",
                                    "formatted_with_code": "0.03 USD"
                                },
                                "rate": 0.0025,
                                "rate_percentage": "0.25%",
                                "type": "county"
                            },
                            {
                                "amount": {
                                    "raw": 0.25,
                                    "formatted": "0.25",
                                    "formatted_with_symbol": "$0.25",
                                    "formatted_with_code": "0.25 USD"
                                },
                                "rate": 0.0225,
                                "rate_percentage": "2.25%",
                                "type": "district"
                            }
                        ]
                    },
                    {
                        "id": "item_dKvg9l6vl1bB76",
                        "product_id": "prod_Ekd6Ll2KYwV2mj",
                        "product_name": "Cart Debug",
                        "quantity": 1,
                        "price": {
                            "raw": 12,
                            "formatted": "12.00",
                            "formatted_with_symbol": "$12.00",
                            "formatted_with_code": "12.00 USD"
                        },
                        "line_total": {
                            "raw": 12,
                            "formatted": "12.00",
                            "formatted_with_symbol": "$12.00",
                            "formatted_with_code": "12.00 USD"
                        },
                        "variants": [],
                        "is_taxable": false,
                        "taxable_amount": {
                            "raw": 0,
                            "formatted": "0.00",
                            "formatted_with_symbol": "$0.00",
                            "formatted_with_code": "0.00 USD"
                        },
                        "tax_rate": null,
                        "tax_rate_percentage": null,
                        "tax_amount": {
                            "raw": 0,
                            "formatted": "0.00",
                            "formatted_with_symbol": "$0.00",
                            "formatted_with_code": "0.00 USD"
                        },
                        "tax_lines": null
                    }
                ],
                "subtotal": {
                    "raw": 54,
                    "formatted": "54.00",
                    "formatted_with_symbol": "$54.00",
                    "formatted_with_code": "54.00 USD"
                },
                "discount": [],
                "shipping": {
                    "id": "ship_31q0o3e21lDdjR",
                    "description": "USPS",
                    "price": {
                        "raw": 0.99,
                        "formatted": "0.99",
                        "formatted_with_symbol": "$0.99",
                        "formatted_with_code": "0.99 USD"
                    }
                },
                "tax": {
                    "amount": {
                        "raw": 3.69,
                        "formatted": "3.69",
                        "formatted_with_symbol": "$3.69",
                        "formatted_with_code": "3.69 USD"
                    },
                    "included_in_price": false,
                    "breakdown": [
                        {
                            "amount": {
                                "raw": 2.63,
                                "formatted": "2.63",
                                "formatted_with_symbol": "$2.63",
                                "formatted_with_code": "2.63 USD"
                            },
                            "rate": 0.0625,
                            "rate_percentage": "6.25%",
                            "type": "state"
                        },
                        {
                            "amount": {
                                "raw": 0,
                                "formatted": "0.00",
                                "formatted_with_symbol": "$0.00",
                                "formatted_with_code": "0.00 USD"
                            },
                            "rate": 0,
                            "rate_percentage": "0%",
                            "type": "city"
                        },
                        {
                            "amount": {
                                "raw": 0.11,
                                "formatted": "0.11",
                                "formatted_with_symbol": "$0.11",
                                "formatted_with_code": "0.11 USD"
                            },
                            "rate": 0.0025,
                            "rate_percentage": "0.25%",
                            "type": "county"
                        },
                        {
                            "amount": {
                                "raw": 0.95,
                                "formatted": "0.95",
                                "formatted_with_symbol": "$0.95",
                                "formatted_with_code": "0.95 USD"
                            },
                            "rate": 0.0225,
                            "rate_percentage": "2.25%",
                            "type": "district"
                        }
                    ],
                    "zone": {
                        "country": "US",
                        "region": "CA",
                        "postal_zip_code": "94103",
                        "ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
                    }
                },
                "total": {
                    "raw": 54.99,
                    "formatted": "54.99",
                    "formatted_with_symbol": "$54.99",
                    "formatted_with_code": "54.99 USD"
                },
                "total_with_tax": {
                    "raw": 58.68,
                    "formatted": "58.68",
                    "formatted_with_symbol": "$58.68",
                    "formatted_with_code": "58.68 USD"
                },
                "pay_what_you_want": {
                    "enabled": true,
                    "minimum": {
                        "raw": 58.68,
                        "formatted": "58.68",
                        "formatted_with_symbol": "$58.68",
                        "formatted_with_code": "58.68 USD"
                    },
                    "customer_set_price": {
                        "raw": 100,
                        "formatted": "100.00",
                        "formatted_with_symbol": "$100.00",
                        "formatted_with_code": "100.00 USD"
                    }
                }
            },
            "tax": {
                "provider": "chec",
                "provider_type": "native",
                "amount": {
                    "raw": 0,
                    "formatted": "0.00",
                    "formatted_with_symbol": "$0.00",
                    "formatted_with_code": "0.00 USD"
                },
                "included_in_price": false,
                "breakdown": [
                    {
                        "amount": {
                            "raw": 2.63,
                            "formatted": "2.63",
                            "formatted_with_symbol": "$2.63",
                            "formatted_with_code": "2.63 USD"
                        },
                        "rate": 0.0625,
                        "rate_percentage": "6.25%",
                        "type": "state"
                    },
                    {
                        "amount": {
                            "raw": 0,
                            "formatted": "0.00",
                            "formatted_with_symbol": "$0.00",
                            "formatted_with_code": "0.00 USD"
                        },
                        "rate": 0,
                        "rate_percentage": "0%",
                        "type": "city"
                    },
                    {
                        "amount": {
                            "raw": 0.11,
                            "formatted": "0.11",
                            "formatted_with_symbol": "$0.11",
                            "formatted_with_code": "0.11 USD"
                        },
                        "rate": 0.0025,
                        "rate_percentage": "0.25%",
                        "type": "county"
                    },
                    {
                        "amount": {
                            "raw": 0.95,
                            "formatted": "0.95",
                            "formatted_with_symbol": "$0.95",
                            "formatted_with_code": "0.95 USD"
                        },
                        "rate": 0.0225,
                        "rate_percentage": "2.25%",
                        "type": "district"
                    }
                ],
                "zone": {
                    "country": "US",
                    "region": "CA",
                    "postal_zip_code": "94103",
                    "ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
                }
            },
            "payments": [
                {
                    "id": "pymnt_20icw2ZVLRq4",
                    "gateway_transaction_id": "ch_19HLUQDm0vyxCdYanLOHURDE",
                    "created": 1479510590,
                    "type": "card",
                    "kind": "sale",
                    "gateway": "stripe",
                    "reference": 4242,
                    "amount": {
                        "raw": 100,
                        "formatted": "100.00",
                        "formatted_with_symbol": "$100.00",
                        "formatted_with_code": "100.00 USD"
                    },
                    "currency": {
                        "code": "USD",
                        "symbol": "$"
                    },
                    "is_refunded": false,
                    "refund_date": null,
                    "payment_source": {
                        "brand": "Visa",
                        "country": "US",
                        "billing_zip_postal_code": "12345",
                        "tax_billing_country": "US"
                    }
                }
            ],
            "refunds": [],
            "fulfillment": {
                "shipping": {
                    "id": "ful_j0YnEoq65e7P61",
                    "description": "USPS",
                    "price": {
                        "raw": 0.99,
                        "formatted": "0.99",
                        "formatted_with_symbol": "$0.99",
                        "formatted_with_code": "0.99 USD"
                    },
                    "shipping_method_id": "ship_31q0o3e21lDdjR",
                    "provider": "chec",
                    "provider_type": "native_shipping",
                    "shipped_on": null,
                    "carrier": null,
                    "tracking_number": null,
                    "tracking_url": null
                },
                "digital": [
                    {
                        "provider": "chec",
                        "provider_type": "native_digital",
                        "line_item_id": "item_7RyWOwmK5nEa2V",
                        "product_id": "prod_4VPvL5zRQ5AQkX",
                        "product_name": "Cart Debug Digital + Physical",
                        "packages": [
                            {
                                "id": "ful_Ekd6Ll2zlV2mjK",
                                "name": "commerce-js-example.html",
                                "access_link": "http://api.chec.dev/fulfill/ord_p7ZAMo1xwNJ4xX/ful_Ekd6Ll2zlV2mjK",
                                "ext": "HTML",
                                "size": "10.44 KB",
                                "size_in_bytes": "10694"
                            }
                        ],
                        "lifespan": {
                            "expires": false,
                            "expiry_date": null,
                            "duration": null,
                            "period": null,
                            "download_limit": "unlimited",
                            "human": "Download links do not expire, and can be accessed unlimited time(s)"
                        },
                        "is_expired": false,
                        "is_access_revoked": false,
                        "remaining_attempts": null
                    }
                ]
            },
            "conditionals": {
                "collected_fullname": false,
                "collected_shipping_address": true,
                "collected_billing_address": false,
                "collected_extrafields": true,
                "collected_tax": true,
                "collected_eu_vat_moss_evidence": false,
                "has_physical_fulfillent": true,
                "has_digital_fulfillment": true,
                "has_extend_fulfillment": false,
                "has_webhook_fulfillment": false,
                "has_extend_apps": false,
                "has_pay_what_you_want": true,
                "has_discounts": false,
                "has_subscription_items": true,
                "is_free": false,
                "is_fulfilled": false,
                "is_refunded": false
            },
            "fraud": {
                "provider": "siftscience",
                "response": {
                    "score": 0.10667953577126,
                    "reasons": [
                        {
                            "name": "Estimated email address age",
                            "value": "0.03 minutes"
                        },
                        {
                            "name": "Number of users with the same cookie",
                            "value": "2",
                            "details": {
                                "users": "devan.koshal@gmail.com"
                            }
                        },
                        {
                            "name": "Number of users with the same device",
                            "value": "2",
                            "details": {
                                "users": "devan.koshal@gmail.com"
                            }
                        },
                        {
                            "name": "Payment method stripe funding",
                            "value": "credit"
                        }
                    ],
                    "user_id": "hello@chec.io"
                }
            },
            "client_details": {
                "ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb",
                "country_code": "US",
                "country_name": "United States",
                "region_code": "CA",
                "region_name": "California",
                "city": "San Francisco",
                "postal_zip_code": "94103"
            },
            "metadata": []
        }
    ],
    "meta": {
        "pagination": {
            "total": 21,
            "count": 1,
            "per_page": 1,
            "current_page": 1,
            "total_pages": 21,
            "links": {
                "next": "http://api.chec.dev/v1/orders?limit=1&page=2"
            }
        }
    }
}

Request

GET /v1/customers/{customer_id}/orders

URL Parameters

Parameter Status Description
customer_id required The customer ID

Get order for customer

Requires authentication

Returns a single order by its ID which belongs to the customer ID provided. The response from this API is the same as "Retrieve order".

Request

curl -X GET \
    -G "https://api.chec.io/v1/customers/cstmr_f89398fs489g/orders/ord_Kvg9l6zvnl1bB7" \
    -H "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
    "https://api.chec.io/v1/customers/cstmr_f89398fs489g/orders/ord_Kvg9l6zvnl1bB7"
);

let headers = {
    "X-Authorization": "{token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));
import requests
import json

url = 'https://api.chec.io/v1/customers/cstmr_f89398fs489g/orders/ord_Kvg9l6zvnl1bB7'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Response (200)

{
    "version": "v1",
    "sandbox": true,
    "id": "ord_p7ZAMo1xwNJ4xX",
    "checkout_token_id": "chkt_Lwj1jnaN6W9pl3",
    "cart_id": "cart_XmwD43GnjbAXwr",
    "customer_reference": "TSTNC-21",
    "created": 1479510592,
    "last_updated": 1479510592,
    "status_payment": "paid",
    "status_fulfillment": "not_fulfilled",
    "currency": {
        "code": "USD",
        "symbol": "$"
    },
    "order_value": {
        "raw": 100,
        "formatted": "100.00",
        "formatted_with_symbol": "$100.00",
        "formatted_with_code": "100.00 USD"
    },
    "customer": {
        "email": "hello@chec.io"
    },
    "extrafields": [
        {
            "id": "extr_7RyWOwmK5nEa2V",
            "name": "Test",
            "value": "Test",
            "required": true
        },
        {
            "id": "extr_1ypbroE658n4ea",
            "name": "Website",
            "value": "commercejs.com",
            "required": false
        }
    ],
    "shipping": {
        "name": "John Doe",
        "street": "1161 Mission St",
        "town_city": "San Francisco",
        "county_state": "CA",
        "postal_zip_code": "94103",
        "country": "US"
    },
    "billing": null,
    "order": {
        "line_items": [
            {
                "id": "item_7RyWOwmK5nEa2V",
                "product_id": "prod_4VPvL5zRQ5AQkX",
                "product_name": "The best shoes",
                "quantity": 1,
                "price": {
                    "raw": 1,
                    "formatted": "1.00",
                    "formatted_with_symbol": "$1.00",
                    "formatted_with_code": "1.00 USD"
                },
                "line_total": {
                    "raw": 31,
                    "formatted": "31.00",
                    "formatted_with_symbol": "$31.00",
                    "formatted_with_code": "31.00 USD"
                },
                "variants": [
                    {
                        "variant_id": "vrnt_kpnNwAyBrwmXB3",
                        "option_id": "optn_PAYrQlWDbwnbR4",
                        "variant_name": "Variant #2",
                        "option_name": "Option 2",
                        "price": {
                            "raw": 20,
                            "formatted": "20.00",
                            "formatted_with_symbol": "20.00",
                            "formatted_with_code": "20.00 "
                        }
                    },
                    {
                        "variant_id": "vrnt_Kvg9l6Apq51bB7",
                        "option_id": "optn_r31q0o3E8lDdjR",
                        "variant_name": "Variant #1",
                        "option_name": "Option 2",
                        "price": {
                            "raw": 10,
                            "formatted": "10.00",
                            "formatted_with_symbol": "10.00",
                            "formatted_with_code": "10.00 "
                        }
                    }
                ],
                "is_taxable": true,
                "taxable_amount": {
                    "raw": 31,
                    "formatted": "31.00",
                    "formatted_with_symbol": "$31.00",
                    "formatted_with_code": "31.00 USD"
                },
                "tax_rate": 0.0875,
                "tax_rate_percentage": "8.75%",
                "tax_amount": {
                    "raw": 2.72,
                    "formatted": "2.72",
                    "formatted_with_symbol": "$2.72",
                    "formatted_with_code": "2.72 USD"
                },
                "tax_lines": [
                    {
                        "amount": {
                            "raw": 1.94,
                            "formatted": "1.94",
                            "formatted_with_symbol": "$1.94",
                            "formatted_with_code": "1.94 USD"
                        },
                        "rate": 0.0625,
                        "rate_percentage": "6.25%",
                        "type": "state"
                    },
                    {
                        "amount": {
                            "raw": 0,
                            "formatted": "0.00",
                            "formatted_with_symbol": "$0.00",
                            "formatted_with_code": "0.00 USD"
                        },
                        "rate": 0,
                        "rate_percentage": "0%",
                        "type": "city"
                    },
                    {
                        "amount": {
                            "raw": 0.08,
                            "formatted": "0.08",
                            "formatted_with_symbol": "$0.08",
                            "formatted_with_code": "0.08 USD"
                        },
                        "rate": 0.0025,
                        "rate_percentage": "0.25%",
                        "type": "county"
                    },
                    {
                        "amount": {
                            "raw": 0.7,
                            "formatted": "0.70",
                            "formatted_with_symbol": "$0.70",
                            "formatted_with_code": "0.70 USD"
                        },
                        "rate": 0.0225,
                        "rate_percentage": "2.25%",
                        "type": "district"
                    }
                ]
            },
            {
                "id": "item_1ypbroE658n4ea",
                "product_id": "prod_2yA6nldRBoEWbz",
                "product_name": "Cart Debug W/ Shipping",
                "quantity": 1,
                "price": {
                    "raw": 11,
                    "formatted": "11.00",
                    "formatted_with_symbol": "$11.00",
                    "formatted_with_code": "11.00 USD"
                },
                "line_total": {
                    "raw": 11,
                    "formatted": "11.00",
                    "formatted_with_symbol": "$11.00",
                    "formatted_with_code": "11.00 USD"
                },
                "variants": [],
                "is_taxable": true,
                "taxable_amount": {
                    "raw": 11,
                    "formatted": "11.00",
                    "formatted_with_symbol": "$11.00",
                    "formatted_with_code": "11.00 USD"
                },
                "tax_rate": 0.0875,
                "tax_rate_percentage": "8.75%",
                "tax_amount": {
                    "raw": 0.97,
                    "formatted": "0.97",
                    "formatted_with_symbol": "$0.97",
                    "formatted_with_code": "0.97 USD"
                },
                "tax_lines": [
                    {
                        "amount": {
                            "raw": 0.69,
                            "formatted": "0.69",
                            "formatted_with_symbol": "$0.69",
                            "formatted_with_code": "0.69 USD"
                        },
                        "rate": 0.0625,
                        "rate_percentage": "6.25%",
                        "type": "state"
                    },
                    {
                        "amount": {
                            "raw": 0,
                            "formatted": "0.00",
                            "formatted_with_symbol": "$0.00",
                            "formatted_with_code": "0.00 USD"
                        },
                        "rate": 0,
                        "rate_percentage": "0%",
                        "type": "city"
                    },
                    {
                        "amount": {
                            "raw": 0.03,
                            "formatted": "0.03",
                            "formatted_with_symbol": "$0.03",
                            "formatted_with_code": "0.03 USD"
                        },
                        "rate": 0.0025,
                        "rate_percentage": "0.25%",
                        "type": "county"
                    },
                    {
                        "amount": {
                            "raw": 0.25,
                            "formatted": "0.25",
                            "formatted_with_symbol": "$0.25",
                            "formatted_with_code": "0.25 USD"
                        },
                        "rate": 0.0225,
                        "rate_percentage": "2.25%",
                        "type": "district"
                    }
                ]
            },
            {
                "id": "item_dKvg9l6vl1bB76",
                "product_id": "prod_Ekd6Ll2KYwV2mj",
                "product_name": "Cart Debug",
                "quantity": 1,
                "price": {
                    "raw": 12,
                    "formatted": "12.00",
                    "formatted_with_symbol": "$12.00",
                    "formatted_with_code": "12.00 USD"
                },
                "line_total": {
                    "raw": 12,
                    "formatted": "12.00",
                    "formatted_with_symbol": "$12.00",
                    "formatted_with_code": "12.00 USD"
                },
                "variants": [],
                "is_taxable": false,
                "taxable_amount": {
                    "raw":<