NAV Navbar
bash Commerce.js javascript python

Introduction

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.

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. Note that examples provided using our Commerce.js SDK are utilising the latest version - available on NPM: @chec/commerce.js.

Authentication

$ curl https://api.chec.io/v1/products \
-H "X-Authorization: sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27"
import CommerceSDK from '@chec/commerce.js';

const Commerce = new CommerceSDK('pk_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.

Assets

List assets

Lists all assets for the current merchant.

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/assets" \
    -H "X-Authorization: {token}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
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()

Example response (200):

{
    "data": [
        {
            "id": "ast_1ypbroE658n4ea",
            "url": "https:\/\/assets.chec-cdn.com\/merchants\/1\/uploads\/893wts9t8hg|epic-ebook.pdf",
            "merchant_id": 5,
            "is_image": false,
            "data": {
                "ext": "PDF",
                "name": "epic-ebook.pdf",
                "size": 240000
            },
            "meta": {
                "Season": "Winter 2019"
            },
            "created_at": 1556800496
        },
        {
            "id": "ast_1ypbroE658n4ea",
            "url": "https:\/\/assets.chec-cdn.com\/merchants\/1\/uploads\/893wts9t8hg|epic-ebook.pdf",
            "merchant_id": 5,
            "is_image": false,
            "data": {
                "ext": "PDF",
                "name": "epic-ebook.pdf",
                "size": 240000
            },
            "meta": {
                "Season": "Winter 2019"
            },
            "created_at": 1556800496
        }
    ],
    "meta": {
        "pagination": {
            "total": 2,
            "count": 2,
            "per_page": 2,
            "current_page": 1,
            "total_pages": 1,
            "links": {}
        }
    }
}

HTTP 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

Get asset

Retrieves an asset by its ID.

Example request:

// Commerce.js currently only supports public key endpoints (for usage in a browser)
curl -X GET \
    -G "https://api.chec.io/v1/assets/ast_B7ZQobNDa4AgNn" \
    -H "X-Authorization: {token}"
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()

Example response (200):

{
    "id": "ast_1ypbroE658n4ea",
    "url": "https:\/\/assets.chec-cdn.com\/merchants\/1\/uploads\/893wts9t8hg|epic-ebook.pdf",
    "merchant_id": 5,
    "is_image": false,
    "data": {
        "ext": "PDF",
        "name": "epic-ebook.pdf",
        "size": 240000
    },
    "meta": {
        "Season": "Winter 2019"
    },
    "created_at": 1556800496
}

HTTP Request

GET v1/assets/{asset_id}

URL Parameters

Parameter Status Description
asset_id required The asset ID to retrieve

Create new asset

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, MP4, M4V, MOV, WMV, AVI, MPG, OGV, 3GP/3G2, ZIP (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.

Example request:

// Commerce.js currently only supports public key endpoints (for usage in a browser)
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"}'

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"
}

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"
}
headers = {
  'X-Authorization': '{token}',
  'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Example response (201):

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

HTTP 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

Delete asset

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

Example request:

curl -X DELETE \
    "https://api.chec.io/v1/assets/ast_VNplJa1EaYwL60" \
    -H "X-Authorization: {token}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
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()

Example response (200):

{
    "deleted": true
}

HTTP Request

DELETE v1/assets/{asset_id}

URL Parameters

Parameter Status Description
asset_id required The asset ID to delete

Carts

Create a cart

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

Example 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()

Example 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": []
}

HTTP Request

GET v1/carts

Retrieve a cart

If successful, this will return the cart object.

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP" \
    -H "X-Authorization: {token}"
Commerce.cart.retrieve('cart_2Jwr9yJAeN4VlP').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()

Example response (200):

{
    "id": "",
    "created": 0,
    "last_updated": 0,
    "expires": 0,
    "total_items": 0,
    "total_unique_items": 0,
    "subtotal": {
        "raw": 0,
        "formatted": "0.00",
        "formatted_with_symbol": "0.00",
        "formatted_with_code": "0.00 "
    },
    "currency": [],
    "discount_code": [],
    "hosted_checkout_url": null,
    "line_items": []
}

HTTP Request

GET v1/carts/{cart_id}

URL Parameters

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

Get cart contents

Returns the contents of the cart.

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP/items" \
    -H "X-Authorization: {token}"
Commerce.cart.contents().then(items => console.log(items));
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: "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/items'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Example response (200):

[
    {
        "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": []
    }
]

HTTP Request

GET v1/carts/{cart_id}/items

URL Parameters

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

Add item to cart

Example 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}'
Commerce.cart.add('prod_R4OANwRqklvYL8', 5).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()

Example 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"
                        }
                    }
                ]
            }
        ]
    }
}

HTTP 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 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.

Update item in cart

Updates the quantity or variant ID for the line item ID in the cart.

Example 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}'
Commerce.cart.update('item_7RyWOwmK5nEa2V', { quantity: 5 }).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()

Example 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"
                        }
                    }
                ]
            }
        ]
    }
}

HTTP 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

Removes a cart entirely.

Example request:

curl -X DELETE \
    "https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP" \
    -H "X-Authorization: {token}"
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()

Example response (200):

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

HTTP Request

DELETE v1/carts/{cart_id}

URL Parameters

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

Empty cart

Clears the contents of the cart.

Example request:

curl -X DELETE \
    "https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP/items" \
    -H "X-Authorization: {token}"
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()

Example 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": []
    }
}

HTTP 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

Removes the specified line item from the cart.

Example request:

curl -X DELETE \
    "https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP/items/item_7RyWOwmK5nEa2V" \
    -H "X-Authorization: {token}"
Commerce.cart.remove('item_7RyWOwmK5nEa2V').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()

Example 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": []
            }
        ]
    }
}

HTTP 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

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

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/categories" \
    -H "X-Authorization: {token}"
Commerce.categories.list().then(categories => console.log(categories));
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()

Example response (200):

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

HTTP Request

GET v1/categories

Retrieve category

Gets a detailed dataset for the provided category ID.

Example request:

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

// By slug
Commerce.categories.retrieve('a-category', { 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()

Example response (200):

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

HTTP 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

Checkout

Generate token

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.

Example request:

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

let params = {
    "identifier_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 = {
  'identifier_type': 'permalink'
}
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()

Example 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_preorder": false,
                "is_quantity_limited": false,
                "is_sold_out": false,
                "has_digital_delivery": true,
                "has_physical_delivery": true,
                "has_images": false,
                "has_video": false,
                "has_rich_embed": 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,
                "preorder": false,
                "quantity_limited": false,
                "sold_out": false
            },
            "has": {
                "digital_delivery": true,
                "physical_delivery": true,
                "images": false,
                "video": false,
                "rich_embed": 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_preorder": false,
                "is_quantity_limited": false,
                "is_sold_out": false,
                "has_digital_delivery": true,
                "has_physical_delivery": true,
                "has_images": false,
                "has_video": false,
                "has_rich_embed": 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,
                "preorder": false,
                "quantity_limited": false,
                "sold_out": false
            },
            "has": {
                "digital_delivery": true,
                "physical_delivery": true,
                "images": false,
                "video": false,
                "rich_embed": 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": "dave@example.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
        }
    }
}

HTTP 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
identifier_type optional The type of identifier. Types: product_id, cart, permalink (default)

Capture order

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 receipt 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.

Example 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":{"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.cart.capture({
  "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": {
      "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"
}).then(response => console.log(response));
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": {
        "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": {
        "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()

Example 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
        }
    }
}

Example response (402):

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

Example response (404):

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

Example response (422):

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

HTTP 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.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
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"

Get existing token

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".

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/tokens/chkt_L5z3kmQpdpkGlA" \
    -H "X-Authorization: {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));
Commerce.checkout.getToken('chkt_L5z3kmQpdpkGlA').then(token => console.log(token));
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()

Example 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_preorder": false,
                "is_quantity_limited": false,
                "is_sold_out": false,
                "has_digital_delivery": true,
                "has_physical_delivery": true,
                "has_images": false,
                "has_video": false,
                "has_rich_embed": 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,
                "preorder": false,
                "quantity_limited": false,
                "sold_out": false
            },
            "has": {
                "digital_delivery": true,
                "physical_delivery": true,
                "images": false,
                "video": false,
                "rich_embed": 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_preorder": false,
                "is_quantity_limited": false,
                "is_sold_out": false,
                "has_digital_delivery": true,
                "has_physical_delivery": true,
                "has_images": false,
                "has_video": false,
                "has_rich_embed": 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,
                "preorder": false,
                "quantity_limited": false,
                "sold_out": false
            },
            "has": {
                "digital_delivery": true,
                "physical_delivery": true,
                "images": false,
                "video": false,
                "rich_embed": 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": "dave@example.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
        }
    }
}

HTTP 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

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.

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/live" \
    -H "X-Authorization: {token}"
Commerce.checkout.getLive('chkt_L5z3kmQpdpkGlA').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()

Example 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
    }
}

HTTP 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

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.

Example 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}"
Commerce.checkout.checkPayWhatYouWant('chkt_L5z3kmQpdpkGlA', {
  customer_set_price: '100.00',
}).then(cart => console.log(cart));
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()

Example 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"
            }
        }
    }
}

HTTP 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

Check variant

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

Example 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}"
Commerce.checkout.checkVariant('chkt_L5z3kmQpdpkGlA', 'item_7RyWOwmK5nEa2V', {
  variant_id: 'vrnt_Kvg9l6Apq51bB7',
  option_id: 'optn_3BkyN5YDRo0b69',
}).then(response => console.log(response));
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()

Example 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
        }
    }
}

HTTP 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

Check requested quantity

Validates that the requested quantity is available for the provided line item ID.

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/item_7RyWOwmK5nEa2V/quantity?amount=5" \
    -H "X-Authorization: {token}"
Commerce.checkout.checkQuantity('chkt_L5z3kmQpdpkGlA', 'item_7RyWOwmK5nEa2V', {
  amount: 5,
}).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()

Example 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
        }
    }
}

HTTP 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

Check discount code

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

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/discount?code=ABC123ZYX" \
    -H "X-Authorization: {token}"
Commerce.checkout.checkDiscount('chkt_L5z3kmQpdpkGlA', {
  code: 'ABC123ZYX',
}).then(response => console.log(response));
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()

Example 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
        }
    }
}

HTTP 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

Check shipping method

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

Example 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}"
Commerce.checkout.checkShippingOption('chkt_L5z3kmQpdpkGlA', {
  shipping_option_id: 'ship_31q0o3e21lDdjR',
  country: 'US',
  region: 'CA',
}).then(response => console.log(response));
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()

Example 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
        }
    }
}

HTTP 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"

Check if order is free

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

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/is_free" \
    -H "X-Authorization: {token}"
Commerce.checkout.isFree('chkt_L5z3kmQpdpkGlA').then(response => console.log(response));
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()

Example 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"
            }
        }
    }
}

HTTP Request

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

URL Parameters

Parameter Status Description
checkout_token_id required The checkout token

Check status of PayPal payment

This endpoint was designed to help you check if a PayPal payment was successful or canceled. Call this after the customer closes the PayPal page or popup.

Example request:

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

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/paypal/payment'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Example response (200):

{
    "token": "chkt_L5z3kmQpdpkGlA",
    "gateway": "paypal",
    "payment_received": true
}

Example response (404):

{
    "error": {
        "type": "not_found",
        "message": "Unable to locate PayPal payment request for this token."
    },
    "status_code": 404
}

HTTP Request

GET v1/checkouts/{checkout_token_id}/check/paypal/payment

URL Parameters

Parameter Status Description
checkout_token_id required The checkout token

Check if PayPal order captured

This endpoint was designed to let you know if Chec has processed the order, as it is necessary to wait for PayPal’s IPN to notify Chec after capturing an order.

Example request:

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

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/paypal/captured'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Example response (200):

{
    "token": "chkt_rQlWAYKypbPXon",
    "gateway": "paypal",
    "order_captured": false
}

Example response (404):

{
    "error": {
        "type": "not_found",
        "message": "Unable to locate PayPal payment request for this token."
    },
    "status_code": 404
}

HTTP Request

GET v1/checkouts/{checkout_token_id}/check/paypal/captured

URL Parameters

Parameter Status Description
checkout_token_id required The checkout token

Get buyer's location from IP

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.

Example 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}"
// Chec/Commerce.js will automatically use the clients IP if none is provided
Commerce.checkout.getLocationFromIP('chkt_L5z3kmQpdpkGlA').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()

Example 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"
}

HTTP 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

Check giftcard

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

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/giftcard?code=ABC-123-ZYX" \
    -H "X-Authorization: {token}"
Commerce.checkout.checkGiftcard('chkt_L5z3kmQpdpkGlA', {
  code: 'ABC-123-ZYX',
}).then(response => console.log(response));
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()

Example 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
        }
    }
}

HTTP 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

Get client-side validation rules

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:

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/helper/validation" \
    -H "X-Authorization: {token}"
Commerce.checkout.helperValidation('chkt_L5z3kmQpdpkGlA').then(response => console.log(response));
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()

Example 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
        }
    }
}

HTTP Request

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

URL Parameters

Parameter Status Description
checkout_token_id required The checkout token

Get available shipping methods

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.

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/helper/shipping_options?country=US&region=CA" \
    -H "X-Authorization: {token}"
Commerce.checkout.getShippingOptions('chkt_L5z3kmQpdpkGlA', {
  country: 'US',
  region: 'CA',
}).then(response => console.log(response));
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()

Example 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"
        ]
    }
]

HTTP 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"

Set tax zone

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.

Example 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}"
Commerce.checkout.setTaxZone('chkt_L5z3kmQpdpkGlA', {
  country: 'US',
  region: 'CA',
  postal_zip_code: '94107',
}).then(response => console.log(response));
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()

Example 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
        }
    }
}

HTTP 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.

List all countries

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.

Example 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));
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()

Example 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>"
}

HTTP Request

GET v1/services/locale/countries

List available shipping countries

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

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/services/locale/chkt_L5z3kmQpdpkGlA/countries" \
    -H "X-Authorization: {token}"
Commerce.services.localeListShippingCountries('chkt_L5z3kmQpdpkGlA').then(response => console.log(response));
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()

Example response (200):

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

HTTP Request

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

URL Parameters

Parameter Status Description
checkout_token_id required The checkout token

List available shipping subdivisions for country

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

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/services/locale/chkt_L5z3kmQpdpkGlA/countries/US/subdivisions" \
    -H "X-Authorization: {token}"
Commerce.services.localeListShippingSubdivisions('chkt_L5z3kmQpdpkGlA', 'US').then(response => console.log(response));
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()

Example 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>"
}

HTTP 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)

List all subdivisions for a country

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.

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/services/locale/US/subdivisions" \
    -H "X-Authorization: {token}"
Commerce.services.localeListSubdivisions('US').then(response => console.log(response));
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()

Example 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>"
}

HTTP 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)

Developer

List Logs

Lists the merchant's developer logs. By default, the response contains a full set of log data. Adding the format argument can reduce the verbosity of the output.

This endpoint will return two response headers which can be used to subscribe to real time log notifications via Pusher: X-Notification-Key - the Pusher app public key, and X-Notification-Token - a unique token which identifies your application logs in the channel name. This should be kept secret.

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/developer/logs?last=10&format=full" \
    -H "X-Authorization: {token}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
    "https://api.chec.io/v1/developer/logs"
);

let params = {
    "last": "10",
    "format": "full",
};
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/developer/logs'
params = {
  'last': '10',
  'format': 'full'
}
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()

Example response (200):

[
    {
        "log_id": "rqst_15lAi2b9tPD479823169",
        "time": 1579823169,
        "version": "v1",
        "key_used": "public",
        "sandbox": false,
        "token_id": "developer",
        "url": "\/v1\/developer\/logs",
        "secure": true,
        "method": "GET",
        "ip_address": "123.45.67.89",
        "status_code": 200,
        "request": {
            "limit": 20
        },
        "response": {
            "success": true
        }
    },
    {
        "log_id": "rqst_15LQZ1Tc9G8i79823169",
        "time": 1579823169,
        "version": "v1",
        "key_used": "public",
        "sandbox": false,
        "token_id": "developer",
        "url": "\/v1\/developer\/logs",
        "secure": true,
        "method": "GET",
        "ip_address": "123.45.67.89",
        "status_code": 200,
        "request": {
            "limit": 20
        },
        "response": {
            "success": true
        }
    }
]

HTTP Request

GET v1/developer/logs

Query Parameters

Parameter Status Description
last optional The number of latest logs to return (default: 20)
format optional Desired output format. Options: full: full log data (default), compact: excluding request and response data, summary: minimal information for use in CLI or dashboards.

Get log by ID

Returns a specific developer log entry by the provided ID. By default, a full set of data will be returned. Adding the format argument can reduce the verbosity of the output.

This endpoint will return two response headers which can be used to subscribe to real time log notifications via Pusher: X-Notification-Key - the Pusher app public key, and X-Notification-Token - a unique token which identifies your application logs in the channel name. This should be kept secret.

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/developer/logs/rqst_r98h894f98ssdh?format=full" \
    -H "X-Authorization: {token}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
    "https://api.chec.io/v1/developer/logs/rqst_r98h894f98ssdh"
);

let params = {
    "format": "full",
};
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/developer/logs/rqst_r98h894f98ssdh'
params = {
  'format': 'full'
}
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()

Example response (200):

{
    "log_id": "rqst_15GxF9T5QhbZ79823169",
    "time": 1579823169,
    "version": "v1",
    "key_used": "public",
    "sandbox": false,
    "token_id": "developer",
    "url": "\/v1\/developer\/logs",
    "secure": true,
    "method": "GET",
    "ip_address": "123.45.67.89",
    "status_code": 200,
    "request": {
        "limit": 20
    },
    "response": {
        "success": true
    }
}

HTTP Request

GET v1/developer/logs/{id}

URL Parameters

Parameter Status Description
id required The log's ID

Query Parameters

Parameter Status Description
format optional Desired output format. Options: full: full log data (default), compact: excluding request and response data, summary: minimal information for use in CLI or dashboards.

Discounts

Retrieve discount

Returns the detailed information for a discount code

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/discounts/RHKZKU71WG" \
    -H "X-Authorization: {token}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
    "https://api.chec.io/v1/discounts/RHKZKU71WG"
);

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/discounts/RHKZKU71WG'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Example response (200):

{
    "id": "code_1ypbroE658n4ea",
    "created": null,
    "code": "EXPIRED",
    "type": "fixed",
    "value": 10,
    "expires_on": 1579651200,
    "limit_quantity": false,
    "quantity": 0,
    "description": null,
    "meta": {
        "campaign": "partners-promo-2022"
    }
}

HTTP Request

GET v1/discounts/{discount_id}

URL Parameters

Parameter Status Description
discount_id required The discount ID to retrieve

Create discount

Example request:

curl -X POST \
    "https://api.chec.io/v1/discounts" \
    -H "X-Authorization: {token}" \
    -H "Content-Type: application/json" \
    -d '{"code":"RHKZKU71WG","type":"fixed","value":"49.95","limit_quantity":1,"quantity":10,"expires":0}'

// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
    "https://api.chec.io/v1/discounts"
);

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

let body = {
    "code": "RHKZKU71WG",
    "type": "fixed",
    "value": "49.95",
    "limit_quantity": 1,
    "quantity": 10,
    "expires": 0
}

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/discounts'
payload = {
    "code": "RHKZKU71WG",
    "type": "fixed",
    "value": "49.95",
    "limit_quantity": 1,
    "quantity": 10,
    "expires": 0
}
headers = {
  'X-Authorization': '{token}',
  'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Example response (200):

{
    "id": "code_1ypbroE658n4ea",
    "created": null,
    "code": "EXPIRED",
    "type": "fixed",
    "value": 10,
    "expires_on": 1579651200,
    "limit_quantity": false,
    "quantity": 0,
    "description": null,
    "meta": {
        "campaign": "partners-promo-2022"
    }
}

HTTP Request

POST v1/discounts

Body Parameters

Parameter Type Status Description
code string optional optional The discount code, will be auto generated if not provided
type string optional optional Either percentage or fixed (default: fixed)
value string required If type is percentage, then a percentage out of 100 that this discount will reduce an order by, otherwise the fixed value for the discount
description string optional optional A description for this discount code
limit_quantity integer optional optional 0 or 1 to indicate whether there should be a limited number this discount code available for use:
quantity integer optional optional If limit_quantity is 1, the number of times this discount code can be used
expires integer optional optional 0 or 1 to indicate whether the discount code should expire
expires_on integer optional optional If expires is 1, the unix timestamp for when the discount code will expire
meta string optional optional An array of metadata to store on the discount code

Remove discount

Deletes a discount code from the system

Example request:

curl -X DELETE \
    "https://api.chec.io/v1/discounts/RHKZKU71WG" \
    -H "X-Authorization: {token}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
    "https://api.chec.io/v1/discounts/RHKZKU71WG"
);

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/discounts/RHKZKU71WG'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()

Example response (200):

{
    "id": "RHKZKU71WG",
    "deleted": true
}

HTTP Request

DELETE v1/discounts/{discount_id}

URL Parameters

Parameter Status Description
discount_id required The discount ID to remove

Giftcards

Retrieve gift card

Fetches the details for a gift card, including balance and metadata.

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/giftcards/gft_2yA6nld4lEWbz7?type=id" \
    -H "X-Authorization: {token}"
const url = new URL(
    "https://api.chec.io/v1/giftcards/gft_2yA6nld4lEWbz7"
);

let params = {
    "type": "id",
};
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/giftcards/gft_2yA6nld4lEWbz7'
params = {
  'type': 'id'
}
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()

Example response (200):

{
    "id": "gft_1ypbroE658n4ea",
    "code": "ABC123 9JS3 M2ND A12D",
    "balance": {
        "raw": 50,
        "formatted": "50.00",
        "formatted_with_symbol": "$50.00",
        "formatted_with_code": "50.00 USD"
    },
    "initial_value": {
        "raw": 50,
        "formatted": "50.00",
        "formatted_with_symbol": "$50.00",
        "formatted_with_code": "50.00 USD"
    },
    "note": "Merry Christmas",
    "created": 1556800200,
    "last_updated": 1556801100
}

HTTP Request

GET v1/giftcards/{id}

URL Parameters

Parameter Status Description
id required The gift card ID

Query Parameters

Parameter Status Description
type optional Either id or code (default: id)

Redeem gift card

Redeems a gift card by deducting the provided value from the gift card. You may optionally provide a note and metadata array to be added to the redemption.

Example request:

curl -X POST \
    "https://api.chec.io/v1/giftcards/27URV9 OY3X NFIW KCYV28/redeem" \
    -H "X-Authorization: {token}" \
    -H "Content-Type: application/json" \
    -d '{"amount":"25.00","note":"Merry Christmas"}'

// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
    "https://api.chec.io/v1/giftcards/27URV9 OY3X NFIW KCYV28/redeem"
);

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

let body = {
    "amount": "25.00",
    "note": "Merry Christmas"
}

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/giftcards/27URV9 OY3X NFIW KCYV28/redeem'
payload = {
    "amount": "25.00",
    "note": "Merry Christmas"
}
headers = {
  'X-Authorization': '{token}',
  'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Example response (200):

{
    "id": "gft_1ypbroE658n4ea",
    "code": "ABC123 9JS3 M2ND A12D",
    "balance": {
        "raw": 50,
        "formatted": "50.00",
        "formatted_with_symbol": "$50.00",
        "formatted_with_code": "50.00 USD"
    },
    "initial_value": {
        "raw": 50,
        "formatted": "50.00",
        "formatted_with_symbol": "$50.00",
        "formatted_with_code": "50.00 USD"
    },
    "note": "Merry Christmas",
    "created": 1556800200,
    "last_updated": 1556801100
}

HTTP Request

POST v1/giftcards/{code}/redeem

URL Parameters

Parameter Status Description
code required Gift card code to redeem

Body Parameters

Parameter Type Status Description
amount string required The monetary amount to redeem from the gift card
note string optional An optional note to add to the redemption
meta string optional An array of metadata to add to the redemption

Create gift card

Create a new gift card.

Example request:

curl -X POST \
    "https://api.chec.io/v1/giftcards" \
    -H "X-Authorization: {token}" \
    -H "Content-Type: application/json" \
    -d '{"code":"27URV9 OY3X NFIW KCYV28","initial_value":"74.95","note":"Merry Christmas!"}'

// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
    "https://api.chec.io/v1/giftcards"
);

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

let body = {
    "code": "27URV9 OY3X NFIW KCYV28",
    "initial_value": "74.95",
    "note": "Merry Christmas!"
}

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/giftcards'
payload = {
    "code": "27URV9 OY3X NFIW KCYV28",
    "initial_value": "74.95",
    "note": "Merry Christmas!"
}
headers = {
  'X-Authorization': '{token}',
  'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Example response (201):

{
    "id": "gft_1ypbroE658n4ea",
    "code": "ABC123 9JS3 M2ND A12D",
    "balance": {
        "raw": 50,
        "formatted": "50.00",
        "formatted_with_symbol": "$50.00",
        "formatted_with_code": "50.00 USD"
    },
    "initial_value": {
        "raw": 50,
        "formatted": "50.00",
        "formatted_with_symbol": "$50.00",
        "formatted_with_code": "50.00 USD"
    },
    "note": "Merry Christmas",
    "created": 1556800200,
    "last_updated": 1556801100
}

HTTP Request

POST v1/giftcards

Body Parameters

Parameter Type Status Description
code string optional If not provided, one will be automatically generated
initial_value string required Initial balance to add
note string optional An optional note to add to the gift card

Merchants

Get merchant details

Returns information for your merchant account.

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/merchants/" \
    -H "X-Authorization: {token}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
    "https://api.chec.io/v1/merchants/"
);

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/merchants/'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Example response (200):

{
    "id": 1,
    "business_name": "An example store",
    "business_description": "",
    "status": "active",
    "timezone": null,
    "country": "US",
    "currency": {
        "symbol": "",
        "code": ""
    },
    "support_email": "test+store+123@example.com",
    "logo": null,
    "logo_shape": null,
    "cover": null,
    "analytics": {
        "google": {
            "settings": {
                "tracking_id": null,
                "linked_domains": null
            }
        }
    },
    "has": {
        "logo": false,
        "cover": false,
        "analytics": false,
        "business_description": false
    }
}

HTTP Request

GET v1/merchants/{merchant_id?}

Orders

List orders

Returns a list of orders for your merchant's account. You can optionally provide pagination filters, and a free-text query filter to narrow down to specific search results.

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/orders?limit=10" \
    -H "X-Authorization: {token}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
    "https://api.chec.io/v1/orders"
);

let params = {
    "limit": "10",
};
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/orders'
params = {
  'limit': '10'
}
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()

Example 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_preorder_items": true,
                "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": "dave@example.com"
                            }
                        },
                        {
                            "name": "Number of users with the same device",
                            "value": "2",
                            "details": {
                                "users": "dave@example.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"
            }
        }
    }
}

HTTP Request

GET v1/orders

Query Parameters

Parameter Status Description
limit optional A limit on the number of orders to be returned. Limit can range between 1 and 100 items (default: 25).
page optional The "page" of orders you want to return.
query optional A search filter, applies to a subset of the order's data fields.

Retrieve order

Returns a specific order from your merchant account.

Example request:

curl -X GET \
    -G "https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX" \
    -H "X-Authorization: {token}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
    "https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX"
);

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/orders/ord_p7ZAMo1xwNJ4xX'
headers = {
  'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Example 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": 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": <