Introduction
API libraries: Currently we have JavaScript & PHP SDKs available
API endpoint:
https://api.chec.io/v1
Welcome to Commerce.js
Commerce.js is a full-stack eCommerce API built for designers and developers. We provide helper functions for each core endpoint to cater for common checks you’d normally have to create manually, for example “is this variant available for this order” or “what’s the list of provinces in Canada or regions in New Zealand?”.
We use these same APIs to generate our own hosted checkouts and product displays for Chec. We’re a team of full-stack designers & engineers which gives us the unique ability to think as both the designer, the front end developer, and the engineer. This philosophy is reflected in the design & structure of our APIs.
All of our API’s are designed to work either alone or with each other. Our API’s are organized around REST and are designed to have predictable, resource-oriented URLs that use HTTP response codes to indicate API errors. To make it a little easier for developers to use our APIs to update things, we allow PUT requests to perform partial data updates so you don't have to send an entire data payload every time you want to change a title.
Our Commerce.js JavaScript SDK is designed to work along side our server-side SDKs, making the API limited to public key scoped calls. Commerce.js utilizes your public API key which can be used to retrieve non sensitive data, or capture orders.
Authentication
$ curl https://api.chec.io/v1/products \
-H "X-Authorization: sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27"
You authenticate by providing your secret or public API key. You can manage your API keys from your dashboard.
All API requests using live API keys must be made over HTTPS. Calls made over plain HTTP will fail. You must authenticate for all requests. All API requests using sandbox API keys can be made over HTTP or HTTPS.
The public API key can only be used on the products, cart, and checkout resources. You will be unable to access orders, and other sensitive information using this key for security reasons. You must use your private API key (and use server side code) for these requests. It is up to you to decide if you should use your private API key or public API key.
API keys are sent using the X-Authorization
header.
We may switch to OAuth authentication in the future, depending on the feedback we receive from developers & designers.
Responses & errors
HTTP status code summary
200 - OK Everything worked as expected. 400 - Bad Request The request was unacceptable, often due to missing a required parameter. 401 - Unauthorized No valid API key provided, or live request made over HTTP. 422 - Validation Validation error. Data submitted was missing something, or in the wrong format. 402 - Request Failed The parameters were valid but the request failed or returned false (i.e. quantity not available). 404 - Not Found The requested resource doesn't exist. Other 4XX, 500, 502,
503, 504 - Server ErrorsSomething 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.
Types
This documentation includes details about the responses from APIs, including descriptions and types for each key in a
response. Most types are standard native JavaScript types (like boolean
or integer
) but some types are standardised
objects that are detailed here:
Price
Prices returned by the API are objects with the following structure:
Parameter | Type | Description | Example |
---|---|---|---|
raw |
number | The raw price as a decimal number | 125.6 |
formatted |
string | The raw price formatted as a string | "125.60" |
formatted_with_symbol |
string | The formatted price with the relevant currency symbol attached | "$125.60" |
formatted_with_code |
string | The formatted price with the currency code appended | "125.60 USD" |
Versioning
The current API version is 2022-07-21.
In our efforts to make a developer friendly API, we sometimes have to make backwards incompatible changes. When we make these changes, we introduce a new version of the API that corresponds to the date the new version becomes available. The version of the API that you use is determined by a setting on your account - this can be edited from the "developer" section in your settings.
You may request a specific version of the API on a single request by providing the Chec-Version
header with your
requested API version. The version of the API that was used for your request is available in the response headers as
Chec-Version
Below is a list of changes that are considered breaking, and the API version that these changes first appeared. This changelog serves as a list of available versions and as a migration guide to newer versions of the API. Every effort is made to make new features available for older versions of the API, but in cases where this is not possible, the minimum API version for a feature is listed with the documentation for that feature.
2022-07-21
By default,
assets
,attributes
,extra_fields
,related_products
andvariant_groups
are no longer returned on the list products. You can include them by using theinclude
parameg:?include=attributes,extra_fields,related_products,variant_groups
All Cart APIs now return cart objects in their responses. "Delete cart" returns an empty response.
The
analytics
settings have been removed from checkout objects. Please use the "get merchant" API to retrieve this information instead.The "check if free" checkout helper API is deprecated and will be removed in future. It also now returns the updated checkout token. Use the checkout totals or conditionals to determine if a checkout is free.
The "check discount code" checkout helper API now returns the updated checkout object. Invalid discount codes will now return a 422 error, rather than a 200 with
valid: false
in the response. Thevalid
,type
,code
,value
, andamount_saved
response attributes have been removed.The "check giftcard" checkout helper API now returns the updated checkout object. Invalid gift cards now return a 422 error, rather than a 200 with
valid: false
in the response. Additionally, thecode
andcredit
attributes have been removed from the response.The "check pay what you want" checkout helper API now returns the updated checkout object. Invalid PWYW prices will now return a 422 error, rather than a 200 with
valid: false
in the response.The "check quantity" checkout helper API now returns the updated checkout object. Invalid quantity will now return a 422 error, rather than a 200 with
available: false
in the response.requested_quantity
has also been removed from the response.The "check shipping method" checkout helper API now returns the updated checkout object. The
id
,description
, andprice
attributes have been removed from the response.The "check variant" checkout helper API now returns the updated checkout object. Invalid variants, or unavailable inventory, will now return a 422 error, rather than a 200 with
available: false
in the response.The "get live" helper API has been deprecated. Use the "get checkout" API instead.
The
gateways
object in checkout responses are now an optional include. Add?include=gateways
to checkout token API requests to continue including it. It will still be returned by default when creating a checkout token.The "check variant" checkout helper API now accepts a list of variant option IDs, where it previously only accepted one at a time. It no longer returns the specified variant group and option IDs, name, or price in the response body. Get this information from the line item.
The
shipping.available_options
object has been removed from checkout responses, useshipping_methods
instead.The
countries
andregions
keys have been removed from shipping methods returned in checkout responses. Use the "get available shipping methods" helper API instead.The "live" object has been removed from checkout responses. The data it contained is now available at the top level of the checkout object. The
merchant_id
attribute has been removed, use a separate call to fetch merchant information instead. Theadjustments
list is now calledadjustments.breakdown
.The
merchant
section of checkout responses has been removed, please use the "get merchant" API instead.The
products
key has been removed from checkout objects. Use the products API instead.The "set tax zone" checkout helper API now returns the updated checkout object. The
valid
andtax_region
response attributes have been removed.
2021-10-06
The
log_id
attribute in log responses has been renamed toid
, andtime
renamed tocreated
.
2021-09-29
The
media
attribute has been removed from "add to cart" responses. Use theimage
object instead.The
media
attribute has been removed from line item objects in a cart. Use theimage
object instead.The
media
attribute has been removed from "update item in" responses. Use theimage
object instead.The
media
attribute has been removed from products, useimage
orassets
instead. Additionally, thehas_video
andhas_rich_embed
conditionals have been removed since they were always false.The
media
attribute has been removed from related product objects, useimage
orassets
instead.
2021-09-22
The
fraud
keys have been removed from order objects, and the "protect" API on checkouts has been removed. No replacement is provided for this API, however existing fraud protection information will be returned when available for existing orders if using older API versions.
2021-07-28
The
business_name
,business_description
, andhas.business_description
properties in merchant responses have been renamed toname
,description
, andhas.description
respectively.The "list available shipping subdivisions" API no longer returns region codes that are prefixed with the country code, e.g.
US-CA
. They are now just the region code, e.g.CA
.
2021-07-21
The
analytics.google.settings.linked_domains
property in merchant objects is now always an array, where it previously might have been null, a string, or an array of strings.
2021-07-14
The
logo
andcover
attributes on a Merchant object have been removed, please useimages.logo
andimages.cover
instead, which return Asset objects.The
valid
property on discounts applied to a checkout token has been removed. Discounts are always valid if they are on a checkout token.The
metadata
property on new physical fulfillments has been renamed tometa
.The "create physical fulfillment" API now returns a 201 status code on success, previously 200.
2021-06-23
The
gateways
response in checkout tokens has changed to a list of gateways, where it previously returned an available count and list of accepted cards.
2021-06-09
The
GET /v1/merchants
API now returns a list of merchants, where it previously returned a single merchant.
2021-06-02
The "list logs" API response is now nested inside a
data
key to be in line with other paginated API endpoints.The "list logs" API argument
last
has been renamed tolimit
to be in line with other paginated API endpoints.
2021-05-19
Merchant details now provide a named timezone and the current UTC offset
2021-05-05
The "get available shipping methods" helper API now returns a successful response with an empty list when no methods are available, where it previously threw an error.
The
is.free
conditional has been removed from the product response.
2021-04-28
The
name
attribute on order line items has been removed, useproduct_name
instead.The
rate
andrate_percentage
attributes are no longer included in order tax breakdowns, please use the equivalent tax breakdowns in the order's line items.The previously empty
total_outstanding
attribute has been removed from the order object.The
order.tax
attribute has been removed from order objects. Please usetax
instead.Tax attributes for line items in an order object have been moved from top level to under the
tax
attribute. As well as this, thetaxable_amount
andamount
values now return the line item price when the item is not taxable, where they previously would return null.The
variant_id
andvariant_name
keys in an order's line item selected options/variants have been renamed togroup_id
andgroup_name
.The
variants
key on order line items has been renamed toselected_options
.The
variants
array, and childvariant_id
andvariant_name
keys in physical fulfillment line item responses have been renamed toselected_options
,group_id
, andgroup_name
respectively.
2021-04-13
The
quantity
andis.quantity_limited
attributes have been removed from variant option objects. They are redundant and not internally in use. Backwards compatibility will polyfill the structure with empty data.
2021-03-31
The
variant
request argument in "add to cart" and "update item in cart" API calls has been renamed tooptions
The
variant_id
request argument in the "check variant" helper API has been renamed togroup_id
to more accurately represent a variant group
2021-03-17
The
extrafields
argument in checkout capture requests has been renamed toextra_fields
.The
extrafields
key in checkout objects has been renamed toextra_fields
, as has the matching conditionalcollects.extrafields
->collects.extra_fields
.Extra fields that belong to products have had their IDs changed, avoid using hard coded extra field IDs in future
Extra fields collected during checkout capture calls have had their IDs changed
Extra fields that belong to products previously would change IDs whenever extra fields were modified, they are now persistent, yet have changed one last time
The
extrafields
key in order objects has been renamed toextra_fields
, as has the matching conditionalcollects.extrafields
->collects.extra_fields
.The
extrafields
key in product objects has been renamed toextra_fields
, as has the matching conditionalcollects.extrafields
->collects.extra_fields
.
2021-03-10
The
type
attribute has been removed from checkout line item objectsThe
quantity
field on product responses has been renamed toinventory.available
, and thequantity_limited
conditional has been renamed toinventory_managed
Creating and updating a product now accepts both
inventory.managed
as a boolean, andinventory.available
as an integer, where this was previously calledquantity
2021-03-03
Line item selected options
variant_id
andvariant_name
attributes have been renamed togroup_id
andgroup_name
Line item
variants
attribute has been renamed toselected_options
, while a newvariant
object has been added for a specific resolved variant, if availablevrnt_
variant ID prefixes in checkout requests should now bevgrp_
variant group prefixesThe "check variant" helper now accepts a variant ID, and the existing
variant_id
argument has been renamed togroup_id
for a variant group's IDThe
variants
key in order line items and fulfillment line items has been renamed toselected_options
, and thevariant_id
andvariant_name
attributes within it have been renamed togroup_id
andgroup_name
to represent variant groups.The
variants
key for line items in order shipments has been renamed toselected_options
, as well as thevariant_id
andvariant_name
columns within renamed togroup_id
andgroup_name
.variant_name
andvariant_id
under thevariants
(orselected_options
) list for an order's fulfillment items have been renamed togroup_name
andgroup_id
respectivelycategory_slug
andcategory_id
filter arguments on "list product" requests are now arrays of category slugs or IDsThe
variant
request attribute on the "create product" and "update product" API has been renamed tovariant_groups
.variants
have been renamed tovariant_groups
in Product object responses
2020-11-18
Cart response "last_updated" property has been renamed to "updated".
Gift card response "last_updated" property has been renamed to "updated".
IDs prefixes for digital downloads are now always "dwnld", previously was either "dwnld" or "ful"
Product response "last_updated" property has been renamed to "updated".
2020-09-23
The
data
key on assets has been removed and the attributes are now part of the response directlyThe order object
conditionals
no longer returns future tense keys from the live object e.g.collects_fullname
. Use past tense instead, e.g.collected_fullname
.Line items on the checkout token response has been replaced with products to more accurately reflect the purpose of the attribute.
All error responses across the checkout have been made consistent with the rest of the API
2020-08-26
Some validation responses when capturing a checkout have been updated to be consistent with other validation errors. If you rely on API error messages, the message structure has been updated.
2020-08-12
Merchant ID is no longer returned in responses for assets
Live objects no longer contain the
future_charges
key. Usetransactions
instead.Legacy payment objects now return
amount
as a money object rather than a float. Use transactions in future.Receipt objects no longer contain the
future_charges
key. Usetransactions
instead.Order objects no longer contain the
future_payments
key. Usetransactions
instead.Order object
payments
,refunds
andpending_payments
are now replaced by new multitransactions
objectThe alternate way of retrieving products by specifying
product_id
as atype
has been removed. Usetype=id
instead.
2020-07-29
Live object: the discount
product_id
is now an array ofproduct_ids
, allowing multiple products per discountLive object: the discount
product_id
is now an array ofproduct_ids
, allowing multiple products per discount
2020-07-01
Order object
metadata
field is now calledmeta
to be in line with other objects.
2020-06-17
Discount object: the discounts
product_id
is now an array ofproduct_ids
, allowing more than one product per discount
The initial version of the API is 2020-02-01
.
Assets
List assets
Lists all assets for the current merchant.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/assets" \
--header "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"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.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://cdn.chec.io/testing.jpg",
"description": null,
"is_image": true,
"filename": "bar",
"file_size": null,
"file_extension": null,
"image_dimensions": [],
"meta": [],
"created_at": 1658849857,
"updated_at": 1658849857
},
{
"id": "ast_1ypbroE658n4ea",
"url": "https://cdn.chec.io/testing.jpg",
"description": null,
"is_image": true,
"filename": "bar",
"file_size": null,
"file_extension": null,
"image_dimensions": [],
"meta": [],
"created_at": 1658849857,
"updated_at": 1658849857
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 2,
"current_page": 1,
"total_pages": 1,
"links": {}
}
}
}
Request
GET v1/assets
Query parameters
Name | Status | Description |
---|---|---|
limit |
optional | The number of items to return per page (default: 15) |
page |
optional | The page number to return |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The asset ID |
url |
string | The asset URL that you may use to serve the asset |
description |
string | A description of the asset |
is_image |
boolean | Whether the asset is an image |
filename |
string | The original filename that the file was uploaded with |
file_extension |
string | The file extension for the asset |
file_size |
integer | The file size in bytes |
image_dimensions.width |
integer | The width in pixels (if the asset is an image) |
image_dimensions.height |
integer | The height in pixels (if the asset is an image) |
meta |
object | A given array or keyed object with metadata |
created_at |
integer | A unix timestamp when the asset was originally uploaded |
Get asset
Retrieves an asset by its ID.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/assets/ast_B7ZQobNDa4AgNn" \
--header "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_B7ZQobNDa4AgNn"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.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://cdn.chec.io/testing.jpg",
"description": null,
"is_image": true,
"filename": "bar",
"file_size": null,
"file_extension": null,
"image_dimensions": [],
"meta": [],
"created_at": 1658849857,
"updated_at": 1658849857
}
Request
GET v1/assets/{asset_id}
URL parameters
Name | Status | Description |
---|---|---|
asset_id |
required | The asset ID to retrieve |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The asset ID |
url |
string | The asset URL that you may use to serve the asset |
description |
string | A description of the asset |
is_image |
boolean | Whether the asset is an image |
filename |
string | The original filename that the file was uploaded with |
file_extension |
string | The file extension for the asset |
file_size |
integer | The file size in bytes |
image_dimensions.width |
integer | The width in pixels (if the asset is an image) |
image_dimensions.height |
integer | The height in pixels (if the asset is an image) |
meta |
object | A given array or keyed object with metadata |
created_at |
integer | A unix timestamp when the asset was originally uploaded |
Create new asset
Creates a new asset. You may provide either a base 64 encoded contents
argument with the asset's file content,
or a url
argument with a remote URL for us to download your asset from. Additional metadata may be provided
under the data
key.
If both the contents
and url
arguments are provided, contents
will be used.
Uploaded assets must be one of the following types:
- Images: JPG, PNG, GIF, ICO
- Fulfillments: image options, PDF, DOC(X), PPT(X), ODT, XLS(X), MP3, M4A, OGG, WAV, FLAC, MP4, M4V, MOV, WMV, AVI, MPG, OGV, 3GP/3G2, ZIP/RAR (archive)
When uploading an asset, the maximum accepted filesize using the contents
method is 2mb, while the maximum
for the url
method is 10mb. If you are uploading an asset for digital delivery and experiencing issues
with your file size via the contents
method, you may consider the url
method instead.
If you would like to associate a product image with a product (for example), you may use the "Products > Add asset to product" API.
Example request:
curl --request POST \
"https://api.chec.io/v1/assets" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"filename\": \"my-photo.jpg\",
\"contents\": \"VGVzdGluZw==\",
\"url\": \"https:\\/\\/mywebsite.com\\/my\\/image.jpg\",
\"private\": true
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/assets"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/assets'
payload = {
"filename": "my-photo.jpg",
"contents": "VGVzdGluZw==",
"url": "https:\/\/mywebsite.com\/my\/image.jpg",
"private": true
}
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"
}
Request
POST v1/assets
Body parameters
Name | Type | Status | Description |
---|---|---|---|
filename |
string | required | The asset filename |
contents |
string | optional | Base 64 encoded file contents. Required if |
url |
string | optional | A remote asset URL. Required if |
image_dimensions.width |
integer | optional | Optional: provide the image width. If not provided it will be determined automatically. |
image_dimensions.height |
integer | optional | Optional: provide the image height. If not provided it will be determined automatically. |
meta |
string[] | optional | An optional array of metadata to store on the asset |
private |
boolean | optional | Whether this asset should be private on the CDN. Defaults to public |
Update asset
Update the details of an asset. This includes updating the "pending" flag to indicated uploads have been completed using the "presigned" method.
Example request:
curl --request PUT \
"https://api.chec.io/v1/assets/{asset_id}" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"pending\": false
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/assets/{asset_id}"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/assets/{asset_id}'
payload = {
"pending": false
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"id": "ast_VNplJa1EaYwL60",
"url": "https://assets.chec-cdn.com/merchant/123/assets/SH542KJlsd7h2Hdu-my-photo.jpg"
}
Request
PUT v1/assets/{asset_id}
Body parameters
Name | Type | Status | Description |
---|---|---|---|
pending |
boolean | required | Set as true when the upload is complete |
Delete asset
Deletes an asset from the system, and from the Chec CDN. This action is not reversible.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/assets/ast_VNplJa1EaYwL60" \
--header "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"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.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 (204):
{}
Request
DELETE v1/assets/{asset_id}
URL parameters
Name | Status | Description |
---|---|---|
asset_id |
required | The asset ID to delete |
Attributes
List attributes
Returns a list of all available attributes.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/attributes" \
--header "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/attributes"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/attributes'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"data": [
{
"id": "attr_1ypbroE658n4ea",
"name": "Size",
"description": null,
"type": "options",
"required": false,
"is_public": true,
"is_multiselect": true,
"default_value": [
"medium"
],
"meta": null,
"created": 1658849855,
"updated": 1658849855,
"options": [
{
"id": "atop_1ypbroE658n4ea",
"value": "small",
"label": "S"
},
{
"id": "atop_dKvg9l6vl1bB76",
"value": "medium",
"label": "M"
},
{
"id": "atop_GNqKE50NwdgBLV",
"value": "large",
"label": "L"
}
]
},
{
"id": "attr_1ypbroE658n4ea",
"name": "Size",
"description": null,
"type": "options",
"required": false,
"is_public": true,
"is_multiselect": true,
"default_value": [
"medium"
],
"meta": null,
"created": 1658849855,
"updated": 1658849855,
"options": [
{
"id": "atop_1ypbroE658n4ea",
"value": "small",
"label": "S"
},
{
"id": "atop_dKvg9l6vl1bB76",
"value": "medium",
"label": "M"
},
{
"id": "atop_GNqKE50NwdgBLV",
"value": "large",
"label": "L"
}
]
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 2,
"current_page": 1,
"total_pages": 1,
"links": {}
}
}
}
Request
GET v1/attributes
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The attribute's ID Example: attr_R4OANwRqklvYL8 |
name |
string | Name for the attribute Example: Tasting notes |
description |
string | An internal description for the attribute Example: Supplied by Leslie Lawless at the local winery |
type |
string | The type of the attribute. One of "short_text", "long_text", "options", "number", "checkbox", "date", "radio". Example: "short_text" |
required |
boolean | Whether a value must be entered when this attribute is attached to other objects like products (default: false) Example: false |
is_public |
boolean | Whether the attribute is returned in public key API calls (default: true) Example: false |
is_multiselect |
boolean | For attributes with multiple value options, this determines whether multiple values will be accepted (default: false) Example: false |
default_value |
string | An optional default value for the attribute No-example |
meta |
string[] | Optional metadata attached to the attribute No-example |
created |
integer | A unix timestamp for when the attribute was created No-example |
updated |
integer | A unix timestamp for when the attribute was last updated No-example |
options.*.id |
string | The option's ID Example: atop_R4OANwRqklvYL8 |
options.*.value |
string | Value for the option Example: med |
options.*.label |
string | Label for the option Example: Medium |
Get attribute
Retrieve an attribute by its ID.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/attributes/attr_K1YDR2qy29Qem6" \
--header "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/attributes/attr_K1YDR2qy29Qem6"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/attributes/attr_K1YDR2qy29Qem6'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"id": "attr_1ypbroE658n4ea",
"name": "Size",
"description": null,
"type": "options",
"required": false,
"is_public": true,
"is_multiselect": true,
"default_value": [
"medium"
],
"meta": null,
"created": 1658849855,
"updated": 1658849855,
"options": [
{
"id": "atop_1ypbroE658n4ea",
"value": "small",
"label": "S"
},
{
"id": "atop_dKvg9l6vl1bB76",
"value": "medium",
"label": "M"
},
{
"id": "atop_GNqKE50NwdgBLV",
"value": "large",
"label": "L"
}
]
}
Request
GET v1/attributes/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | The attribute ID |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The attribute's ID Example: attr_R4OANwRqklvYL8 |
name |
string | Name for the attribute Example: Tasting notes |
description |
string | An internal description for the attribute Example: Supplied by Leslie Lawless at the local winery |
type |
string | The type of the attribute. One of "short_text", "long_text", "options", "number", "checkbox", "date", "radio". Example: "short_text" |
required |
boolean | Whether a value must be entered when this attribute is attached to other objects like products (default: false) Example: false |
is_public |
boolean | Whether the attribute is returned in public key API calls (default: true) Example: false |
is_multiselect |
boolean | For attributes with multiple value options, this determines whether multiple values will be accepted (default: false) Example: false |
default_value |
string | An optional default value for the attribute No-example |
meta |
string[] | Optional metadata attached to the attribute No-example |
created |
integer | A unix timestamp for when the attribute was created No-example |
updated |
integer | A unix timestamp for when the attribute was last updated No-example |
options.*.id |
string | The option's ID Example: atop_R4OANwRqklvYL8 |
options.*.value |
string | Value for the option Example: med |
options.*.label |
string | Label for the option Example: Medium |
Create attribute
Create a new attribute, and attach to the current merchant.
Example request:
curl --request POST \
"https://api.chec.io/v1/attributes" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"name\": \"Tasting notes\",
\"description\": \"Used to track marketing terms for the beer from the brewer, e.g. \'notes of cardamom\'\",
\"type\": \"\\\"short_text\\\"\",
\"required\": false,
\"is_public\": true,
\"is_multiselect\": false
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/attributes"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/attributes'
payload = {
"name": "Tasting notes",
"description": "Used to track marketing terms for the beer from the brewer, e.g. 'notes of cardamom'",
"type": "\"short_text\"",
"required": false,
"is_public": true,
"is_multiselect": false
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (201):
{
"id": "attr_1ypbroE658n4ea",
"name": "Tasting notes",
"description": "Used to track marketing terms for the beer from the brewer, e.g. 'notes of cardamom'",
"type": "text",
"required": false,
"is_public": true,
"is_multiselect": false,
"default_value": null,
"options": null,
"meta": null,
"created": 1633737075,
"updated": 1633737075
}
Request
POST v1/attributes
Body parameters
Name | Type | Status | Description |
---|---|---|---|
name |
string | required | Name for the attribute |
description |
string | required | An example description for internal use |
type |
string | required | The type of the attribute. One of "short_text", "long_text", "options", "number", "checkbox", "date", "radio". |
required |
boolean | optional | Whether a value must be entered when this attribute is attached to other objects like products (default: false) |
is_public |
boolean | optional | Whether the attribute should be included in public API key calls, e.g. to "list products" |
is_multiselect |
boolean | optional | If the |
options.*.value |
An | optional | array of options for the attribute's possible values, used when |
options.*.label |
The | optional | attribute option's label |
default_value |
string|int|boolean | optional | An optional default value for the attribute |
meta |
object | optional | Optional metadata attached to the attribute |
Update attribute
Update an existing attribute. The request arguments are the same as for the "create attribute" API, however
the name
and type
fields are not required.
Example request:
curl --request PUT \
"https://api.chec.io/v1/attributes/attr_K1YDR2qy29Qem6" \
--header "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/attributes/attr_K1YDR2qy29Qem6"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/attributes/attr_K1YDR2qy29Qem6'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('PUT', url, headers=headers)
response.json()
Example response (200):
{
"id": "attr_1ypbroE658n4ea",
"name": "Tasting notes",
"description": "Used to track marketing terms for the beer from the brewer, e.g. 'notes of cardamom'",
"type": "text",
"required": false,
"is_public": true,
"is_multiselect": false,
"default_value": "It's delicious, fruity, and full of flavour!",
"options": null,
"meta": null,
"created": 1633737075,
"updated": 1633737142
}
Request
PUT v1/attributes/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | The attribute ID |
Delete attribute
Delete an attribute by its ID.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/attributes/attr_K1YDR2qy29Qem6" \
--header "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/attributes/attr_K1YDR2qy29Qem6"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/attributes/attr_K1YDR2qy29Qem6'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/attributes/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | The attribute ID |
Carts
Create a cart
Initializes a new cart, and returns the new cart object.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/carts" \
--header "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"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.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_Vw7APRQyLkKKO5",
"created": 1633651586,
"updated": 1633651754,
"expires": 1636243754,
"total_items": 1,
"total_unique_items": 1,
"subtotal": {
"raw": 15,
"formatted": "15.00",
"formatted_with_symbol": "$15.00",
"formatted_with_code": "15.00 USD"
},
"hosted_checkout_url": "https://checkout.chec.io/cart/cart_Vw7APRQyLkKKO5",
"line_items": [
{
"id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_RyWOwmDOWlnEa2",
"name": "Test product",
"product_name": "Test product",
"sku": null,
"permalink": "KYwEZj",
"quantity": 1,
"price": {
"raw": 15,
"formatted": "15.00",
"formatted_with_symbol": "$15.00",
"formatted_with_code": "15.00 USD"
},
"line_total": {
"raw": 15,
"formatted": "15.00",
"formatted_with_symbol": "$15.00",
"formatted_with_code": "15.00 USD"
},
"is_valid": true,
"product_meta": [],
"selected_options": [],
"variant": null,
"image": null
}
],
"currency": {
"code": "USD",
"symbol": "$"
},
"discount": [],
"meta": null
}
Request
GET v1/carts
Get cart
Returns the cart object with the provided ID.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP" \
--header "X-Authorization: {token}"
const cartId = 'cart_2Jwr9yJAeN4VlP';
Commerce.cart.retrieve(cartId).then(cart => console.log(cart));
const url = new URL(
"https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.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": "cart_Vw7APRQyLkKKO5",
"created": 1633651586,
"updated": 1633651754,
"expires": 1636243754,
"total_items": 1,
"total_unique_items": 1,
"subtotal": {
"raw": 15,
"formatted": "15.00",
"formatted_with_symbol": "$15.00",
"formatted_with_code": "15.00 USD"
},
"hosted_checkout_url": "https://checkout.chec.io/cart/cart_Vw7APRQyLkKKO5",
"line_items": [
{
"id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_RyWOwmDOWlnEa2",
"name": "Test product",
"product_name": "Test product",
"sku": null,
"permalink": "KYwEZj",
"quantity": 1,
"price": {
"raw": 15,
"formatted": "15.00",
"formatted_with_symbol": "$15.00",
"formatted_with_code": "15.00 USD"
},
"line_total": {
"raw": 15,
"formatted": "15.00",
"formatted_with_symbol": "$15.00",
"formatted_with_code": "15.00 USD"
},
"is_valid": true,
"product_meta": [],
"selected_options": [],
"variant": null,
"image": null
}
],
"currency": {
"code": "USD",
"symbol": "$"
},
"discount": [],
"meta": null
}
Request
GET v1/carts/{cart_id}
URL parameters
Name | Status | Description |
---|---|---|
cart_id |
required | ID of the cart you wish to retrieve |
Add item to cart
Adds a line item (product) to the cart. The quantity will be increased if the product is already in the cart.
Example request:
curl --request POST \
"https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"id\": \"prod_R4OANwRqklvYL8\",
\"quantity\": 5
}"
const productId = 'prod_R4OANwRqklvYL8';
const quantity = 5;
// Uses the cart that was previously created or retrieved
Commerce.cart.add(productId, quantity).then(json => console.log(json));
const url = new URL(
"https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.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):
{
"id": "cart_Vw7APRQyLkKKO5",
"created": 1633651586,
"updated": 1633651754,
"expires": 1636243754,
"total_items": 1,
"total_unique_items": 1,
"subtotal": {
"raw": 15,
"formatted": "15.00",
"formatted_with_symbol": "$15.00",
"formatted_with_code": "15.00 USD"
},
"hosted_checkout_url": "https://checkout.chec.io/cart/cart_Vw7APRQyLkKKO5",
"line_items": [
{
"id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_RyWOwmDOWlnEa2",
"name": "Test product",
"product_name": "Test product",
"sku": null,
"permalink": "KYwEZj",
"quantity": 1,
"price": {
"raw": 15,
"formatted": "15.00",
"formatted_with_symbol": "$15.00",
"formatted_with_code": "15.00 USD"
},
"line_total": {
"raw": 15,
"formatted": "15.00",
"formatted_with_symbol": "$15.00",
"formatted_with_code": "15.00 USD"
},
"is_valid": true,
"product_meta": [],
"selected_options": [],
"variant": null,
"image": null
}
],
"currency": {
"code": "USD",
"symbol": "$"
},
"discount": [],
"meta": null
}
Request
POST v1/carts/{cart_id}
URL parameters
Name | Status | Description |
---|---|---|
cart_id |
required | ID of the cart you'd like to use |
Body parameters
Name | 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) |
options |
object | optional | The specific variant group and variant options to use. The keys should be your variant group ID, and the values should be your variant option IDs. |
variant_id |
string | optional | A specific variant ID to use. If provided, the relevant options will be determined from the variant and applied to the line item in your cart. |
Update cart
Allows parts of the cart object to be updated, with the updated cart returned in the response
Example request:
curl --request PUT \
"https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"discount_code\": \"WINTER-2021-SALE\"
}"
const lineItemId = 'item_7RyWOwmK5nEa2V';
const newQuantity = 3;
// Uses the cart that was previously created or retrieved
Commerce.cart.update(lineItemId, { quantity: newQuantity }).then(json => console.log(json));
const url = new URL(
"https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP'
payload = {
"discount_code": "WINTER-2021-SALE"
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"id": "cart_Vw7APRQyLkKKO5",
"created": 1633651586,
"updated": 1633651754,
"expires": 1636243754,
"total_items": 1,
"total_unique_items": 1,
"subtotal": {
"raw": 15,
"formatted": "15.00",
"formatted_with_symbol": "$15.00",
"formatted_with_code": "15.00 USD"
},
"hosted_checkout_url": "https://checkout.chec.io/cart/cart_Vw7APRQyLkKKO5",
"line_items": [
{
"id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_RyWOwmDOWlnEa2",
"name": "Test product",
"product_name": "Test product",
"sku": null,
"permalink": "KYwEZj",
"quantity": 1,
"price": {
"raw": 15,
"formatted": "15.00",
"formatted_with_symbol": "$15.00",
"formatted_with_code": "15.00 USD"
},
"line_total": {
"raw": 15,
"formatted": "15.00",
"formatted_with_symbol": "$15.00",
"formatted_with_code": "15.00 USD"
},
"is_valid": true,
"product_meta": [],
"selected_options": [],
"variant": null,
"image": null
}
],
"currency": {
"code": "USD",
"symbol": "$"
},
"discount": [],
"meta": null
}
Request
PUT v1/carts/{cart_id}
URL parameters
Name | Status | Description |
---|---|---|
cart_id |
required | ID of the cart you wish to update |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
discount_code |
string | optional | A discount code to apply to the cart, or null to clear |
meta |
object | optional | Optional metadata to attach to the cart, which will be transferred to the checkout meta and eventually the order meta |
Update item in cart
Updates the quantity or variant ID for the line item ID in the cart. If a quantity of zero is provided, the line item will be removed from the cart.
Example request:
curl --request PUT \
"https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP/items/item_7RyWOwmK5nEa2V" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"quantity\": 5
}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP/items/item_7RyWOwmK5nEa2V"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.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):
{
"id": "cart_Vw7APRQyLkKKO5",
"created": 1633651586,
"updated": 1633651754,
"expires": 1636243754,
"total_items": 1,
"total_unique_items": 1,
"subtotal": {
"raw": 15,
"formatted": "15.00",
"formatted_with_symbol": "$15.00",
"formatted_with_code": "15.00 USD"
},
"hosted_checkout_url": "https://checkout.chec.io/cart/cart_Vw7APRQyLkKKO5",
"line_items": [
{
"id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_RyWOwmDOWlnEa2",
"name": "Test product",
"product_name": "Test product",
"sku": null,
"permalink": "KYwEZj",
"quantity": 1,
"price": {
"raw": 15,
"formatted": "15.00",
"formatted_with_symbol": "$15.00",
"formatted_with_code": "15.00 USD"
},
"line_total": {
"raw": 15,
"formatted": "15.00",
"formatted_with_symbol": "$15.00",
"formatted_with_code": "15.00 USD"
},
"is_valid": true,
"product_meta": [],
"selected_options": [],
"variant": null,
"image": null
}
],
"currency": {
"code": "USD",
"symbol": "$"
},
"discount": [],
"meta": null
}
Request
PUT v1/carts/{cart_id}/items/{line_item_id}
URL parameters
Name | 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
Name | Type | Status | Description |
---|---|---|---|
quantity |
integer | optional | The new line item quantity to use |
options |
object | optional | The specific variant group and variant options to use. The keys should be your variant group ID, and the values should be your variant option IDs. |
variant_id |
string | optional | A specific variant ID to use. If provided, the relevant options will be determined from the variant and applied to the line item in your cart. |
Delete cart
Removes a cart entirely.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP" \
--header "X-Authorization: {token}"
// Uses the cart that was previously created or retrieved
Commerce.cart.delete().then(json => console.log(json));
const url = new URL(
"https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.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 (204):
{}
Request
DELETE v1/carts/{cart_id}
URL parameters
Name | Status | Description |
---|---|---|
cart_id |
required | ID of the cart you wish to delete |
Empty cart
Clears the contents of the cart.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP/items" \
--header "X-Authorization: {token}"
// Uses the cart that was previously created or retrieved
Commerce.cart.empty().then(json => console.log(json));
const url = new URL(
"https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP/items"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.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):
{
"id": "cart_Vw7APRQyLkKKO5",
"created": 1633651586,
"updated": 1633651754,
"expires": 1636243754,
"total_items": 0,
"total_unique_items": 0,
"subtotal": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"hosted_checkout_url": "https://checkout.chec.io/cart/cart_Vw7APRQyLkKKO5",
"line_items": [],
"currency": {
"code": "USD",
"symbol": "$"
},
"discount": [],
"meta": null
}
Request
DELETE v1/carts/{cart_id}/items
URL parameters
Name | 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 --request DELETE \
"https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP/items/item_7RyWOwmK5nEa2V" \
--header "X-Authorization: {token}"
const lineItemId = 'item_7RyWOwmK5nEa2V';
// Uses the cart that was previously created or retrieved
Commerce.cart.remove(lineItemId).then(json => console.log(json));
const url = new URL(
"https://api.chec.io/v1/carts/cart_2Jwr9yJAeN4VlP/items/item_7RyWOwmK5nEa2V"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.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):
{
"id": "cart_Vw7APRQyLkKKO5",
"created": 1633651586,
"updated": 1633651754,
"expires": 1636243754,
"total_items": 0,
"total_unique_items": 0,
"subtotal": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"hosted_checkout_url": "https://checkout.chec.io/cart/cart_Vw7APRQyLkKKO5",
"line_items": [],
"currency": {
"code": "USD",
"symbol": "$"
},
"discount": [],
"meta": null
}
Request
DELETE v1/carts/{cart_id}/items/{line_item_id}
URL parameters
Name | 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 --request GET \
--get "https://api.chec.io/v1/categories?depth=2" \
--header "X-Authorization: {token}"
Commerce.categories.list().then(categories => console.log(categories.data));
const url = new URL(
"https://api.chec.io/v1/categories"
);
const params = {
"depth": "2",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/categories'
params = {
'depth': '2',
}
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()
Example response (200):
{
"data": [
{
"id": "cat_1ypbroE658n4ea",
"parent_id": null,
"slug": "shoes",
"name": "Shoes and Footwear",
"description": "Get great deals on shoes",
"products": 0,
"created": 1658849858,
"updated": 1658849858,
"meta": {
"season": "summer"
},
"assets": []
},
{
"id": "cat_1ypbroE658n4ea",
"parent_id": null,
"slug": "shoes",
"name": "Shoes and Footwear",
"description": "Get great deals on shoes",
"products": 0,
"created": 1658849858,
"updated": 1658849858,
"meta": {
"season": "summer"
},
"assets": []
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 2,
"current_page": 1,
"total_pages": 1,
"links": {}
}
}
}
Request
GET v1/categories
Query parameters
Name | Status | Description |
---|---|---|
depth |
optional | The number of children to return, between 0 and 3. Default: 3 |
parent_id |
optional | Specify a parent category ID to filter by, returning only children of this category |
include |
optional | Optionally specify "breadcrumbs" to include parent breadcrumb hierarchy up to the top level |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The category ID |
parent_id |
string | The ID of the parent category if this category is a child of another. |
slug |
string | A given "slug" for the category. Should be URL safe. |
name |
string | A given name for the category |
description |
string | A given description for the category |
products |
integer | The number of products in this category |
created |
integer | A unix timestamp for when the category was created |
updated |
integer | A unix timestamp for when the category was last updated |
meta |
A custom object that can be set on a category |
|
assets.*.id |
string | The asset ID |
assets.*.url |
string | The asset URL that you may use to serve the asset |
assets.*.description |
string | A description of the asset |
assets.*.is_image |
boolean | Whether the asset is an image |
assets.*.filename |
string | The original filename that the file was uploaded with |
assets.*.file_extension |
string | The file extension for the asset |
assets.*.file_size |
integer | The file size in bytes |
assets.*.image_dimensions.width |
integer | The width in pixels (if the asset is an image) |
assets.*.image_dimensions.height |
integer | The height in pixels (if the asset is an image) |
assets.*.meta |
object | A given array or keyed object with metadata |
assets.*.created_at |
integer | A unix timestamp when the asset was originally uploaded |
children.*.id |
string | The child category ID |
children.*.slug |
string | A "slug" for the child category |
children.*.name |
string | A name for the child category |
breadcrumbs.*.id |
string | The breadcrumb category ID |
breadcrumbs.*.slug |
string | A "slug" for the breadcrumb category |
breadcrumbs.*.name |
string | A name for the breadcrumb category |
Retrieve category
Gets a detailed dataset for the provided category ID.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/categories/cat_7RqEv5xKOoZz4j?type=slug&depth=2" \
--header "X-Authorization: {token}"
// Fetch a category by ID
const categoryId = 'cat_7RqEv5xKOoZz4j';
Commerce.categories.retrieve(categoryId)
.then(category => console.log(category));
// Fetch a category by slug
const categorySlug = 'shoes'
Commerce.categories.retrieve(categorySlug, { type: 'slug' })
.then(category => console.log(category));
const url = new URL(
"https://api.chec.io/v1/categories/cat_7RqEv5xKOoZz4j"
);
const params = {
"type": "slug",
"depth": "2",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/categories/cat_7RqEv5xKOoZz4j'
params = {
'type': 'slug',
'depth': '2',
}
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()
Example response (200):
{
"id": "cat_1ypbroE658n4ea",
"parent_id": null,
"slug": "shoes",
"name": "Shoes and Footwear",
"description": "Get great deals on shoes",
"products": 0,
"created": 1658849858,
"updated": 1658849858,
"meta": {
"season": "summer"
},
"assets": []
}
Request
GET v1/categories/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | Category ID to retrieve |
Query parameters
Name | Status | Description |
---|---|---|
type |
optional | Filter by |
depth |
optional | The number of children to return, between 0 and 3. Default: 3 |
include |
optional | Optionally specify "breadcrumbs" to include parent breadcrumb hierarchy up to the top level |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The category ID |
parent_id |
string | The ID of the parent category if this category is a child of another. |
slug |
string | A given "slug" for the category. Should be URL safe. |
name |
string | A given name for the category |
description |
string | A given description for the category |
products |
integer | The number of products in this category |
created |
integer | A unix timestamp for when the category was created |
updated |
integer | A unix timestamp for when the category was last updated |
meta |
A custom object that can be set on a category |
|
assets.*.id |
string | The asset ID |
assets.*.url |
string | The asset URL that you may use to serve the asset |
assets.*.description |
string | A description of the asset |
assets.*.is_image |
boolean | Whether the asset is an image |
assets.*.filename |
string | The original filename that the file was uploaded with |
assets.*.file_extension |
string | The file extension for the asset |
assets.*.file_size |
integer | The file size in bytes |
assets.*.image_dimensions.width |
integer | The width in pixels (if the asset is an image) |
assets.*.image_dimensions.height |
integer | The height in pixels (if the asset is an image) |
assets.*.meta |
object | A given array or keyed object with metadata |
assets.*.created_at |
integer | A unix timestamp when the asset was originally uploaded |
children.*.id |
string | The child category ID |
children.*.slug |
string | A "slug" for the child category |
children.*.name |
string | A name for the child category |
breadcrumbs.*.id |
string | The breadcrumb category ID |
breadcrumbs.*.slug |
string | A "slug" for the breadcrumb category |
breadcrumbs.*.name |
string | A name for the breadcrumb category |
Create category
Create a new category with the provided slug, name, and description. You may also specify a list of asset IDs to attach to the category.
Example request:
curl --request POST \
"https://api.chec.io/v1/categories" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"slug\": \"running-shoes\",
\"name\": \"Running shoes\",
\"description\": \"Running shoes are essential to support the arches of the foot.\"
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/categories"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/categories'
payload = {
"slug": "running-shoes",
"name": "Running shoes",
"description": "Running shoes are essential to support the arches of the foot."
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (201):
{
"id": "cat_7RqEv5xKOoZz4j",
"slug": "running-shoes",
"name": "Running shoes",
"description": "Running shoes are essential to support the arches of the foot.",
"created": 1568409246,
"updated": 1568409246,
"meta": {
"season": "winter"
},
"assets": [],
"children": []
}
Request
POST v1/categories
Body parameters
Name | Type | Status | Description |
---|---|---|---|
slug |
string | required | Category slug, URL segment, or permalink |
name |
string | required | Category name |
description |
string | optional | Category description |
assets.* |
string | optional | An optional list of asset IDs to associate with this category |
children.* |
string | optional | An optional list of child category IDs to associate with this category |
parent_id |
string | optional | An optional parent category ID to set |
meta |
object | optional | Optional metadata to store on the category |
Update category
Update the category with the provided slug, name, and description. You may also specify a list of asset IDs to attach to the category.
Example request:
curl --request PUT \
"https://api.chec.io/v1/categories/cat_7RqEv5xKOoZz4j" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"slug\": \"hiking-boots\",
\"name\": \"Hiking boots\",
\"description\": \"Hiking boots are essential to support the structural integrity of your feet.\"
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/categories/cat_7RqEv5xKOoZz4j"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/categories/cat_7RqEv5xKOoZz4j'
payload = {
"slug": "hiking-boots",
"name": "Hiking boots",
"description": "Hiking boots are essential to support the structural integrity of your feet."
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"id": "cat_7RqEv5xKOoZz4j",
"slug": "hiking-boots",
"name": "Hiking boots",
"description": "Hiking boots are essential to support the structural integrity of your feet.",
"created": 1585792315,
"updated": 1628207642,
"meta": [],
"assets": [],
"children": []
}
Request
PUT v1/categories/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | Category ID to update |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
slug |
string | required | Category slug, URL segment, or permalink |
name |
string | required | Category name |
description |
string | optional | Category description |
assets.* |
string | optional | An optional list of asset IDs to associate with this category |
children.* |
string | optional | An optional list of child category IDs to associate with this category |
parent_id |
string | optional | An optional parent category ID to set |
meta |
object | optional | Optional metadata to store on the category |
Delete category
Deletes a category.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/categories/cat_7RqEv5xKOoZz4j" \
--header "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/categories/cat_7RqEv5xKOoZz4j"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/categories/cat_7RqEv5xKOoZz4j'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/categories/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | Category ID to delete |
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 --request GET \
--get "https://api.chec.io/v1/checkouts/YfFoyi?type=permalink" \
--header "X-Authorization: {token}"
// Generate a token from a product permalink
const productPermalink = 'YfFoyi';
Commerce.checkout.generateTokenFrom('permalink', productPermalink)
.then(response => console.log(response.id));
// Generate a token from a product ID
const productId = 'prod_R4OANwRqklvYL8';
Commerce.checkout.generateTokenFrom('product_id', productId)
.then(response => console.log(response.id));
// Generate a token from the cart that was previously created or retrieved
Commerce.checkout.generateTokenFrom('cart', Commerce.cart.id())
.then(response => console.log(response.id));
const url = new URL(
"https://api.chec.io/v1/checkouts/YfFoyi"
);
const params = {
"type": "permalink",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/checkouts/YfFoyi'
params = {
'type': 'permalink',
}
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()
Example response (201):
{
"id": "chkt_ql9pzRX339zW45",
"cart_id": "cart_6oLZ1vkBDM38Ol",
"created": 1631119919,
"expires": 1631724719,
"conditionals": {
"collects_fullname": false,
"collects_shipping_address": true,
"collects_billing_address": false,
"has_physical_delivery": true,
"has_digital_delivery": false,
"has_pay_what_you_want": false,
"has_available_discounts": false,
"collects_extra_fields": false,
"is_cart_free": false
},
"collects": {
"fullname": false,
"shipping_address": true,
"billing_address": false,
"extra_fields": false
},
"has": {
"physical_delivery": true,
"digital_delivery": false,
"pay_what_you_want": false,
"available_discounts": false
},
"is": {
"cart_free": false
},
"products": [
{
"id": "prod_bWZ3l89mMOwkpE",
"created": 1630519799,
"updated": 1630519996,
"active": true,
"permalink": "76HgYX",
"name": "Oxford loafers",
"description": "<p>Classic oxford loafers</p>",
"price": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"inventory": {
"managed": false,
"available": 0
},
"media": {
"type": "image",
"source": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"asset_id": "ast_L1vOoZdax4lRa8"
},
"sku": null,
"sort_order": 0,
"seo": {
"title": null,
"description": null
},
"thank_you_url": null,
"meta": null,
"conditionals": {
"is_active": true,
"is_tax_exempt": false,
"is_pay_what_you_want": false,
"is_inventory_managed": false,
"is_sold_out": false,
"has_digital_delivery": false,
"has_physical_delivery": true,
"has_images": true,
"has_video": false,
"has_rich_embed": false,
"collects_fullname": false,
"collects_shipping_address": true,
"collects_billing_address": false,
"collects_extra_fields": false
},
"is": {
"active": true,
"tax_exempt": false,
"pay_what_you_want": false,
"inventory_managed": false,
"sold_out": false
},
"has": {
"digital_delivery": false,
"physical_delivery": true,
"images": true,
"video": false,
"rich_embed": false
},
"collects": {
"fullname": false,
"shipping_address": true,
"billing_address": false,
"extra_fields": false
},
"checkout_url": {
"checkout": "https://checkout.chec.io/76HgYX?checkout=true",
"display": "https://checkout.chec.io/76HgYX"
},
"extra_fields": [],
"variant_groups": [
{
"id": "vgrp_bO6J5a6PLlEjpK",
"name": "Material",
"meta": null,
"created": 1630519859,
"updated": 1630519859,
"options": [
{
"id": "optn_Op1YoVmEywXLv9",
"name": "Leather",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"assets": [],
"meta": null,
"created": 1630519859,
"updated": 1630519996
}
]
}
],
"categories": [],
"assets": [
{
"id": "ast_L1vOoZdax4lRa8",
"url": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"description": null,
"is_image": true,
"filename": "loafers.jpg",
"file_size": 922443,
"file_extension": "jpg",
"image_dimensions": {
"width": 2853,
"height": 2834
},
"meta": [],
"created_at": 1630519989,
"updated_at": 1630519992
}
],
"related_products": []
}
],
"merchant": {
"id": 32748,
"name": "New merchant",
"description": "",
"status": "active",
"country": "US",
"currency": {
"symbol": "$",
"code": "USD"
},
"support_email": "[email protected]",
"logo_shape": null,
"intercom": true,
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"has": {
"logo": false,
"cover": false,
"analytics": false,
"description": false
},
"images": {
"logo": null,
"cover": null
}
},
"extra_fields": [],
"gateways": [
{
"id": "gway_OoZaNX1NBba4wR",
"code": "test_gateway",
"sandbox": true,
"config": []
},
{
"id": "gway_mwDZVm8VRv3W5r",
"code": "stripe",
"sandbox": false,
"config": {
"publishable_key": "pk_test_51Hm1waEtPU7XlX8YyuSwjGBTKgtROP6iLIBtQB5h4EVqY0z4mmc7x6tVXI98QuvxZ4r81iPWHovoQ3G44ShLebGK00dEHvV8lS"
}
}
],
"shipping_methods": [
{
"id": "ship_RyWOwmrX6onEa2",
"description": "Domestic",
"provider": "chec",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"countries": [
"US"
],
"regions": {
"US": [
"AL",
"AK",
"AS",
"AZ",
"AR",
"CA",
"CO",
"CT",
"DE",
"DC",
"FL",
"GA",
"GU",
"HI",
"ID",
"IL",
"IN",
"IA",
"KS",
"KY",
"LA",
"ME",
"MD",
"MA",
"MI",
"MN",
"MS",
"MO",
"MT",
"NE",
"NV",
"NH",
"NJ",
"NM",
"NY",
"NC",
"ND",
"MP",
"OH",
"OK",
"OR",
"PA",
"PR",
"RI",
"SC",
"SD",
"TN",
"TX",
"UM",
"UT",
"VT",
"VI",
"VA",
"WA",
"WV",
"WI",
"WY"
]
}
}
],
"live": {
"merchant_id": 32748,
"currency": {
"code": "USD",
"symbol": "$"
},
"subtotal": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"tax": {
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"breakdown": [],
"included_in_price": false,
"zone": [],
"provider": "chec"
},
"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"
},
"adjustments": {
"taxable": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"untaxable": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"total": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
}
},
"giftcard": [],
"total_due": {
"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
},
"line_items": [
{
"id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_bWZ3l89mMOwkpE",
"name": "Oxford loafers",
"product_name": "Oxford loafers",
"media": {
"type": "image",
"source": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"asset_id": "ast_L1vOoZdax4lRa8"
},
"sku": null,
"permalink": "76HgYX",
"quantity": 1,
"price": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"line_total": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"is_valid": true,
"product_meta": [],
"tax": {
"is_taxable": false,
"taxable_amount": null,
"amount": null,
"breakdown": null
},
"selected_options": [],
"variant": null
}
],
"discount": [],
"shipping": {
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"available_options": [
{
"id": "ship_RyWOwmrX6onEa2",
"description": "Domestic",
"provider": "chec",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"countries": [
"US"
],
"regions": {
"US": [
"AL",
"AK",
"AS",
"AZ",
"AR",
"CA",
"CO",
"CT",
"DE",
"DC",
"FL",
"GA",
"GU",
"HI",
"ID",
"IL",
"IN",
"IA",
"KS",
"KY",
"LA",
"ME",
"MD",
"MA",
"MI",
"MN",
"MS",
"MO",
"MT",
"NE",
"NV",
"NH",
"NJ",
"NM",
"NY",
"NC",
"ND",
"MP",
"OH",
"OK",
"OR",
"PA",
"PR",
"RI",
"SC",
"SD",
"TN",
"TX",
"UM",
"UT",
"VT",
"VI",
"VA",
"WA",
"WV",
"WI",
"WY"
]
}
}
]
}
},
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"adjustments": [],
"meta": null
}
Request
GET v1/checkouts/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | The ID of the product or cart, or the permalink of the product |
Query parameters
Name | Status | Description |
---|---|---|
type |
optional | The type of identifier. Types: |
Response
Response fields
Name | Type | Description |
---|---|---|
currency.code |
string | The currency code (ISO 4217) of the currency in the live object |
currency.symbol |
string | The currency symbol used in the live object |
line_items.*.id |
string | The ID of the line item in the live object Example: item_7RyWOwmK5nEa2V |
line_items.*.product_id |
string | The ID of the product for the line item Example: prod_4VPvL5zRQ5AQkX |
line_items.*.product_name |
string | The product name in the line item Example: New Season T-Shirt |
line_items.*.quantity |
integer | The quantity of this line item in the live object Example: 2 |
line_items.*.price |
Price | The base price for one of this line item |
line_items.*.line_total |
Price | the total price for this line item, including the selected variant options |
line_items.*.variants.*.variant_id |
string | Variant ID for the product in the live object |
line_items.*.variants.*.variant_name |
string | Name of variant for the product in the live object |
line_items.*.variants.*.option_id |
string | Variant's option ID for the product in the live object |
line_items.*.variants.*.option_name |
string | Variant's option name for the product in the live object |
line_items.*.variants.*.price |
Price | The price delta for the variant, applied to the base product price |
line_items.*.tax.is_taxable |
boolean | Whether this line item should be included in tax calculations (and is not tax exempt) Example: true |
line_items.*.tax.taxable_amount |
number | The raw value (price) that is taxable for this line item Example: 21.3 |
line_items.*.tax.tax_amount |
number | The raw calculated tax for this line item Example: 1.7 |
line_items.*.tax.breakdown.*.amount |
number | The raw calculated tax for this type of tax Example: 0.9 |
line_items.*.tax.breakdown.*.rate |
number | A decimal that represents the rate of this tax Example: 0.15 |
line_items.*.tax.breakdown.*.rate_percentage |
string | The decimal rate formatted as a percentage Example: "15%" |
line_items.*.tax.breakdown.*.type |
string | A name given to this part of the total tax Example: VAT |
subtotal |
Price | The subtotal of the live object, summing all of the line items |
shipping.id |
string | The ID for the shipping method chosen for the live object |
shipping.description |
string | The stored description for this shipping method |
shipping.price |
Price | The price for the chosen shipping method for the live object |
shipping.available_options |
string[] | A list of available shipping options for this live object. See "get available shipping methods" |
total |
Price | The total of the live object, excluding tax |
total_with_tax |
Price | The total of the live object, including tax |
giftcard.id |
string | The giftcard ID that has been redeemed on the live object |
giftcard.code |
string | The code for the giftcard that has been redeemed on the live object |
giftcard.credit |
Price | The amount of the giftcards balance that will be deducted once an order has been captured from the live object |
total_due |
Price | The total that is required to capture a checkout with this live object |
pay_what_you_want.enabled |
boolean | Whether a customer set "pay what you want" price is enabled for this live object |
pay_what_you_want.minimum |
Price | The minimum value a customer may choose for "pay what you want" |
pay_what_you_want.customer_set_price |
Price | The current price the customer has chosen for this live object |
Capture order
Captures an order and payment by converting a checkout token and necessary data into an order object, and charging all related transactions.
This API can also be used to as a "create order" API for data imports/migrations, or programmatic order creation. Please get in touch if you have custom data migration requirements.
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.
- Line item’s quantity:
line_items[{line_item_id}][quantity]
- Line item’s variant:
line_items[{line_item_id}][variants][{variant_id}] = “{option_id}”
When capturing the order, provide the extra_fields
object with each extra field ID as the key and the value you want to use.
- Extra fields object:
extra_fields: { [extraFieldId]: 'your custom field value' }
Response
If successful, the new order object is returned.
If you're using PayPal, a 200 response will be returned containing information required for you to redirect your customers off-site to continue with their transaction.
For payment gateways that support Strong Customer Authentication (e.g. Stripe), when further actions are required to confirm a payment, a 402 Payment Required response will be returned containing the necessary information to confirm the transaction.
Example request:
curl --request POST \
"https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"discount_code\": \"20off\",
\"pay_what_you_want\": \"149.99\",
\"customer_reference\": \"ABC-123-ZYX\"
}"
Commerce.checkout.capture('chkt_959gvxcZ6lnJ7', {
line_items: {
// Key is the line item ID for our test product
item_7RyWOwmK5nEa2V: {
quantity: 1,
variants: {
// Key is the variant ID for "Color", value is the option ID for "Blue"
vrnt_bO6J5apWnVoEjp: 'optn_Op1YoVppylXLv9',
// Key is the variant ID for "Size", value is the option ID for "Small"
vrnt_4WJvlKpg7pwbYV: 'optn_zkK6oL99G5Xn0Q',
}
}
},
customer: {
firstname: 'John',
lastname: 'Doe',
email: '[email protected]',
},
shipping: {
name: 'John Doe',
street: '123 Fake St',
town_city: 'San Francisco',
county_state: 'CA',
postal_zip_code: '94103',
country: 'US',
},
fulfillment: {
// The shipping method ID for "USPS Ground" (for example)
// You can use commerce.checkout.getShippingOptions() to get a list
shipping_method: 'ship_1ypbroE658n4ea',
},
payment: {
// Test Gateway is enabled by default, and is used when you submit orders with
// your sandbox API key
gateway: 'test_gateway',
card: {
number: '4242 4242 4242 4242',
expiry_month: '01',
expiry_year: '2023',
cvc: '123',
postal_zip_code: '94103',
},
},
})
.then(response => {
console.log('Great, your checkout was captured successfully! Checkout the response object for receipt info.');
})
.catch(error => console.error(error));
const url = new URL(
"https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA'
payload = {
"discount_code": "20off",
"pay_what_you_want": "149.99",
"customer_reference": "ABC-123-ZYX"
}
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": "[email protected]"
},
"extra_fields": [
{
"id": "extr_bgvRjwOBl4mNLO",
"name": "Phone number",
"type": "number",
"required": false,
"value": null
}
],
"shipping": {
"name": "John Doe",
"street": "1161 Mission St",
"town_city": "San Francisco",
"county_state": "CA",
"postal_zip_code": "94103",
"country": "US"
},
"billing": [],
"order": {
"line_items": [
{
"id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_4VPvL5zRQ5AQkX",
"product_name": "Oxford Loafers",
"quantity": 1,
"price": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"line_total": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"variants": [
{
"variant_id": "vrnt_kpnNwAyBrwmXB3",
"option_id": "optn_PAYrQlWDbwnbR4",
"variant_name": "material",
"option_name": "leather",
"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,
"provider": "chec",
"provider_type": "native",
"breakdown": [],
"zone": {
"country": "US",
"region": "CA",
"postal_zip_code": "94107",
"ip_address": null
}
}
}
],
"subtotal": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"discount": [],
"shipping": {
"id": "ship_31q0o3e21lDdjR",
"description": "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,
"provider": "chec",
"provider_type": "native",
"breakdown": [],
"zone": {
"country": "US",
"region": "CA",
"postal_zip_code": "94107",
"ip_address": null
}
},
"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
}
},
"transactions": [
{
"id": "trns_NQG375vjr5rMOg",
"type": "charge",
"status": "complete",
"status_reason": "complete",
"charge_date": 1630503985,
"gateway": "stripe",
"gateway_name": "Stripe",
"gateway_transaction_id": "1630503985",
"gateway_reference": "4242",
"notes": "",
"amount": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"payment_source_type": "card",
"payment_source": {
"brand": "visa",
"country": "US",
"billing_zip_postal_code": "94107"
},
"created": 1630503985,
"updated": 1630503985,
"dunning": {
"is_dunning": false,
"failed_attempts": 0,
"last_failed_attempt": null,
"next_attempt": null
}
}
],
"fulfillment": {
"physical": {
"items": [
{
"id": "ful_Ekd6Ll2Qz5V2mj",
"shipping_method_id": "ship_LbO6J5aLoEjpKG",
"line_item_id": "item_J0egY5eMb53QnA",
"product_id": "prod_J0egY5eRl3QnA4",
"shipping_description": "Regular",
"provider": "chec",
"provider_type": "native_shipping",
"product_name": "Oxford Loafers",
"status": "not_fulfilled",
"quantity": {
"total": 1,
"fulfilled": 0,
"remaining": 1
},
"quantity_fulfilled": 0,
"quantity_remaining": 1,
"last_updated": 1630503985,
"linked_shipments": [],
"variants": [
{
"variant_id": "vgrp_aDWy4oG4K56Jx2",
"variant_name": "material",
"option_id": "optn_r31q0o398lDdjR",
"option_name": "leather"
}
]
}
],
"shipments": []
},
"digital": {
"downloads": []
}
},
"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": false,
"collects_extra_fields": true,
"is_cart_free": false
},
"merchant": {
"id": 2,
"name": "Test, Inc.",
"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": "[email protected]",
"logo_shape": "squared",
"statement_descriptor": null,
"has": {
"logo": true,
"cover": true,
"description": true
},
"images": {
"logo": {
"id": "ast_NXELwj19Qpl3A4",
"url": "https://cdn.chec.io/merchants/2/local/images/icon/8b8709949f5eb64b6f9bea722954253d89d599bc56ffb8d5e6773|Commercejs_logo.png",
"description": null,
"is_image": true,
"filename": "Commercejs_logo.png",
"file_size": 30320,
"file_extension": "png",
"image_dimensions": {
"width": 550,
"height": 368
},
"meta": [],
"created_at": 1631554267,
"updated_at": 1631554270
},
"cover": {
"id": "ast_B7ZQobNDa4AgNn",
"url": "https://cdn.chec.io/merchants/2/local/images/cover/18bb006778c1b3efe0b46a063b34ce664a49f5dc5700c83ec7293|Chec.Twitter.Header.png",
"description": null,
"is_image": true,
"filename": "Chec.Twitter.Header.png",
"file_size": 30320,
"file_extension": "png",
"image_dimensions": {
"width": 550,
"height": 368
},
"meta": [],
"created_at": 1631554267,
"updated_at": 1631554270
}
}
},
"meta": null
}
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 with ID \"chkt_L5z3kmQpdpkGlA\" not found."
},
"status_code": 404
}
Example response (422):
{
"error": {
"status_code": 422,
"message": "The given data was invalid.",
"type": "unprocessable_entity",
"errors": {
"line_items.item_gRMqQOoe2xy70v.quantity": [
"Requested quantity is not available."
],
"payment.gateway": [
"The payment.gateway field is required."
]
}
}
}
Request
POST v1/checkouts/{checkout_token_id}
URL parameters
Name | Status | Description |
---|---|---|
checkout_token_id |
required | The checkout token |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
line_items.item_7RyWOwmK5nEa2V.variant_id |
string | optional | The requested variant ID for this line item |
line_items.item_7RyWOwmK5nEa2V.quantity |
integer | optional | The requested quantity for this line item |
line_items.item_7RyWOwmK5nEa2V.variants.vgrp_p6dP5g0M4ln7kA |
string | required | The option ID (value) chosen for the variant group (key). Required for each variant group, unless a specific variant ID is used. |
discount_code |
string | optional | A discount code requested |
extra_fields.extr_Kvg9l6zvnl1bB7 |
string | optional | The collected data for the extra field |
extra_fields.extr_bWZ3l8zLNokpEQ |
string | optional | The collected data for the extra field |
customer.id |
string | optional | A Customer ID to associate the order with. If none is provided, a customer will be associated or created from the email address. |
customer.firstname |
string | optional | Customer's first name, if required |
customer.lastname |
string | optional | Customer's last name, if required |
customer.email |
string | required | Customer's email address. Not required when providing |
customer.phone |
string | optional | Customer's phone number |
customer.meta |
object | optional | Optional metadata to store on new customers. This field is ignored for existing customers. |
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) |
shipping.delivery_instructions |
string | optional | Optional delivery instructions for the shipping address |
fulfillment.shipping_method |
string | optional | The |
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. |
payment.card.number |
string | optional | For Chec's test gateway only, provide the test credit card number |
payment.card.token |
string | optional | For Stripe (Token API), the card token generated |
payment.card.nonce |
integer | optional | For Square (Square Payment Form), The nonce provided by the form SDK |
payment.square.token |
string | optional | For Square (Web Payments SDK), the card token generated |
payment.square.verification_token |
string | optional | For Square, the SCA token provided when using " |
payment.stripe.payment_method_id |
string | optional | For Stripe (Payment Intents API), the Payment Method ID to create a Payment Intent with. When this is provided, a 402 Payment Required response will be given containing a Payment Intent secret for use in Stripe.js |
payment.stripe.payment_intent_id |
string | optional | For Stripe (Payment Intents API), the Payment Intent ID to be charged |
payment.stripe.customer_id |
string | optional | For Stripe (Payment Intents API only), specify a Stripe customer ID to attach the Payment Intent to |
payment.stripe.setup_future_usage |
string | optional | For Stripe (Payment Intents API), for new cards, you may inform Stripe how you intend to use the card in the future. See https://stripe.com/docs/payments/payment-intents#future-usage for more information |
payment.razorpay.payment_id |
string | optional | The payment ID returned by Razorpay (if using Razorpay) |
payment.omise.token |
string | optional | For Omise, the token generated for a card |
payment.omise.source |
string | optional | For Omise, the source generated for a payment method |
payment.paypal.action |
string | optional | For PayPal, either "capture" or "authorize" |
payment.paypal.payment_id |
string | optional | For PayPal, the payment ID |
payment.paypal.payer_id |
string | optional | For PayPal, the payer ID |
payment.manual.id |
string | optional | For manual payments, the ID of the manual payment method |
pay_what_you_want |
string | optional | The amount to pay, if using "pay what you want" |
customer_reference |
string | optional | The order's customer reference, must be unique. If left blank, one will be automatically generated. |
meta |
object | optional | An arbitrary metadata object to store on the order. If provided, this will override any previously stored meta data on the checkout token |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The order ID |
sandbox |
boolean | Whether this order is a "sandbox" order |
checkout_token_id |
string | The ID for the checkout that was used to make the order |
cart_id |
string | The cart ID that was used to make the order |
customer_reference |
string | The customer friendly reference for this order, generated by Chec |
created |
integer | The unix timestamp for when the order was created/captured |
status |
string | The status of the order. One of "pending", "open", "cancelled" |
status_payment |
string | Indicates the payment status of the order. One of "paid", "not_paid", "partially_paid", "refunded", or "authorized" |
status_fulfillment |
string | Indicates the fulfillment status of the order. One of "fulfilled", "not_fulfilled", "partially_fulfilled", or "returned" |
currency.code |
string | The currency code (ISO 4217) of the currency in the order |
currency.symbol |
string | The currency symbol used in the order |
order_value |
Price | The total price of the order |
redirect |
string | The URL for the order's redirect confirmation page, or false |
customer.email |
string | The email address that the customer provided for the order |
customer.firstname |
string | The first name that the customer provided for the order. Only present if one was provided |
customer.lastname |
string | The last name that the customer provided for the order. Only present if one was provided |
extra_fields.*.id |
string | The extra field ID Example: extr_7RyWOwmK5nEa2V |
extra_fields.*.name |
string | A given name for the extra field ID - usually used as a field label Example: Your website |
extra_fields.*.type |
string | A type for the extra field. Currently only "text" is supported for products Example: "text" |
extra_fields.*.required |
boolean | Whether this extra field is required Example: false |
extra_fields.*.value |
string | The value provided by the customer for this field |
conditionals.collected_fullname |
boolean | Whether this order was required to collect the customers full name |
conditionals.collected_shipping_address |
boolean | Whether this order was required to collect the customers shipping address |
conditionals.collected_billing_address |
boolean | Whether this order was required to collect the customers billing address |
conditionals.collected_extra_fields |
boolean | Whether this order was required to collect some configured extra fields |
conditionals.collected_tax |
boolean | Whether this order was required to collect tax |
conditionals.collected_eu_vat_moss_evidence |
boolean | Whether this order was required to collect EU VAT moss evidence |
conditionals.has_physical_fulfillment |
boolean | Whether this order has a physical fulfillment |
conditionals.has_digital_fulfillment |
boolean | Whether this order has a digital fulfillment |
conditionals.has_pay_what_you_want |
boolean | Whether this order has a customer set price using the "pay what you want" feature |
conditionals.has_discounts |
boolean | Whether discounts were redeemed on this order |
conditionals.is_free |
boolean | Whether this order is free |
conditionals.is_fulfilled |
boolean | Whether this order has been completely fulfilled |
collected.fullname |
boolean | Whether this order was required to collect the customers full name |
collected.shipping_address |
boolean | Whether this order was required to collect the customers shipping address |
collected.billing_address |
boolean | Whether this order was required to collect the customers billing address |
collected.extra_fields |
boolean | Whether this order was required to collect some configured extra fields |
collected.tax |
boolean | Whether this order was required to collect tax |
collected.eu_vat_moss_evidence |
boolean | Whether this order was required to collect EU VAT moss evidence |
has.physical_fulfillment |
boolean | Whether this order has a physical fulfillment |
has.digital_fulfillment |
boolean | Whether this order has a digital fulfillment |
has.pay_what_you_want |
boolean | Whether this order has a customer set price using the "pay what you want" feature |
has.discounts |
boolean | Whether discounts were redeemed on this order |
is.free |
boolean | Whether this order is free |
is.fulfilled |
boolean | Whether this order has been completely fulfilled |
meta |
object | A custom object that can be set on an order |
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 --request GET \
--get "https://api.chec.io/v1/checkouts/tokens/chkt_L5z3kmQpdpkGlA" \
--header "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';
Commerce.checkout.getToken(checkoutTokenId).then(token => console.log(token));
const url = new URL(
"https://api.chec.io/v1/checkouts/tokens/chkt_L5z3kmQpdpkGlA"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/checkouts/tokens/chkt_L5z3kmQpdpkGlA'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"id": "chkt_ql9pzRX339zW45",
"cart_id": "cart_6oLZ1vkBDM38Ol",
"created": 1631119919,
"expires": 1631724719,
"conditionals": {
"collects_fullname": false,
"collects_shipping_address": true,
"collects_billing_address": false,
"has_physical_delivery": true,
"has_digital_delivery": false,
"has_pay_what_you_want": false,
"has_available_discounts": false,
"collects_extra_fields": false,
"is_cart_free": false
},
"collects": {
"fullname": false,
"shipping_address": true,
"billing_address": false,
"extra_fields": false
},
"has": {
"physical_delivery": true,
"digital_delivery": false,
"pay_what_you_want": false,
"available_discounts": false
},
"is": {
"cart_free": false
},
"products": [
{
"id": "prod_bWZ3l89mMOwkpE",
"created": 1630519799,
"updated": 1630519996,
"active": true,
"permalink": "76HgYX",
"name": "Oxford loafers",
"description": "<p>Classic oxford loafers</p>",
"price": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"inventory": {
"managed": false,
"available": 0
},
"media": {
"type": "image",
"source": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"asset_id": "ast_L1vOoZdax4lRa8"
},
"sku": null,
"sort_order": 0,
"seo": {
"title": null,
"description": null
},
"thank_you_url": null,
"meta": null,
"conditionals": {
"is_active": true,
"is_tax_exempt": false,
"is_pay_what_you_want": false,
"is_inventory_managed": false,
"is_sold_out": false,
"has_digital_delivery": false,
"has_physical_delivery": true,
"has_images": true,
"has_video": false,
"has_rich_embed": false,
"collects_fullname": false,
"collects_shipping_address": true,
"collects_billing_address": false,
"collects_extra_fields": false
},
"is": {
"active": true,
"tax_exempt": false,
"pay_what_you_want": false,
"inventory_managed": false,
"sold_out": false
},
"has": {
"digital_delivery": false,
"physical_delivery": true,
"images": true,
"video": false,
"rich_embed": false
},
"collects": {
"fullname": false,
"shipping_address": true,
"billing_address": false,
"extra_fields": false
},
"checkout_url": {
"checkout": "https://checkout.chec.io/76HgYX?checkout=true",
"display": "https://checkout.chec.io/76HgYX"
},
"extra_fields": [],
"variant_groups": [
{
"id": "vgrp_bO6J5a6PLlEjpK",
"name": "Material",
"meta": null,
"created": 1630519859,
"updated": 1630519859,
"options": [
{
"id": "optn_Op1YoVmEywXLv9",
"name": "Leather",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"assets": [],
"meta": null,
"created": 1630519859,
"updated": 1630519996
}
]
}
],
"categories": [],
"assets": [
{
"id": "ast_L1vOoZdax4lRa8",
"url": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"description": null,
"is_image": true,
"filename": "loafers.jpg",
"file_size": 922443,
"file_extension": "jpg",
"image_dimensions": {
"width": 2853,
"height": 2834
},
"meta": [],
"created_at": 1630519989,
"updated_at": 1630519992
}
],
"related_products": []
}
],
"merchant": {
"id": 32748,
"name": "New merchant",
"description": "",
"status": "active",
"country": "US",
"currency": {
"symbol": "$",
"code": "USD"
},
"support_email": "[email protected]",
"logo_shape": null,
"intercom": true,
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"has": {
"logo": false,
"cover": false,
"analytics": false,
"description": false
},
"images": {
"logo": null,
"cover": null
}
},
"extra_fields": [],
"gateways": [
{
"id": "gway_OoZaNX1NBba4wR",
"code": "test_gateway",
"sandbox": true,
"config": []
},
{
"id": "gway_mwDZVm8VRv3W5r",
"code": "stripe",
"sandbox": false,
"config": {
"publishable_key": "pk_test_51Hm1waEtPU7XlX8YyuSwjGBTKgtROP6iLIBtQB5h4EVqY0z4mmc7x6tVXI98QuvxZ4r81iPWHovoQ3G44ShLebGK00dEHvV8lS"
}
}
],
"shipping_methods": [
{
"id": "ship_RyWOwmrX6onEa2",
"description": "Domestic",
"provider": "chec",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"countries": [
"US"
],
"regions": {
"US": [
"AL",
"AK",
"AS",
"AZ",
"AR",
"CA",
"CO",
"CT",
"DE",
"DC",
"FL",
"GA",
"GU",
"HI",
"ID",
"IL",
"IN",
"IA",
"KS",
"KY",
"LA",
"ME",
"MD",
"MA",
"MI",
"MN",
"MS",
"MO",
"MT",
"NE",
"NV",
"NH",
"NJ",
"NM",
"NY",
"NC",
"ND",
"MP",
"OH",
"OK",
"OR",
"PA",
"PR",
"RI",
"SC",
"SD",
"TN",
"TX",
"UM",
"UT",
"VT",
"VI",
"VA",
"WA",
"WV",
"WI",
"WY"
]
}
}
],
"live": {
"merchant_id": 32748,
"currency": {
"code": "USD",
"symbol": "$"
},
"subtotal": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"tax": {
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"breakdown": [],
"included_in_price": false,
"zone": [],
"provider": "chec"
},
"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"
},
"adjustments": {
"taxable": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"untaxable": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"total": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
}
},
"giftcard": [],
"total_due": {
"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
},
"line_items": [
{
"id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_bWZ3l89mMOwkpE",
"name": "Oxford loafers",
"product_name": "Oxford loafers",
"media": {
"type": "image",
"source": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"asset_id": "ast_L1vOoZdax4lRa8"
},
"sku": null,
"permalink": "76HgYX",
"quantity": 1,
"price": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"line_total": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"is_valid": true,
"product_meta": [],
"tax": {
"is_taxable": false,
"taxable_amount": null,
"amount": null,
"breakdown": null
},
"selected_options": [],
"variant": null
}
],
"discount": [],
"shipping": {
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"available_options": [
{
"id": "ship_RyWOwmrX6onEa2",
"description": "Domestic",
"provider": "chec",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"countries": [
"US"
],
"regions": {
"US": [
"AL",
"AK",
"AS",
"AZ",
"AR",
"CA",
"CO",
"CT",
"DE",
"DC",
"FL",
"GA",
"GU",
"HI",
"ID",
"IL",
"IN",
"IA",
"KS",
"KY",
"LA",
"ME",
"MD",
"MA",
"MI",
"MN",
"MS",
"MO",
"MT",
"NE",
"NV",
"NH",
"NJ",
"NM",
"NY",
"NC",
"ND",
"MP",
"OH",
"OK",
"OR",
"PA",
"PR",
"RI",
"SC",
"SD",
"TN",
"TX",
"UM",
"UT",
"VT",
"VI",
"VA",
"WA",
"WV",
"WI",
"WY"
]
}
}
]
}
},
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"adjustments": [],
"meta": null
}
Request
GET v1/checkouts/tokens/{checkout_token_id}
URL parameters
Name | Status | Description |
---|---|---|
checkout_token_id |
required | The checkout token |
Response
Response fields
Name | Type | Description |
---|---|---|
currency.code |
string | The currency code (ISO 4217) of the currency in the live object |
currency.symbol |
string | The currency symbol used in the live object |
line_items.*.id |
string | The ID of the line item in the live object Example: item_7RyWOwmK5nEa2V |
line_items.*.product_id |
string | The ID of the product for the line item Example: prod_4VPvL5zRQ5AQkX |
line_items.*.product_name |
string | The product name in the line item Example: New Season T-Shirt |
line_items.*.quantity |
integer | The quantity of this line item in the live object Example: 2 |
line_items.*.price |
Price | The base price for one of this line item |
line_items.*.line_total |
Price | the total price for this line item, including the selected variant options |
line_items.*.variants.*.variant_id |
string | Variant ID for the product in the live object |
line_items.*.variants.*.variant_name |
string | Name of variant for the product in the live object |
line_items.*.variants.*.option_id |
string | Variant's option ID for the product in the live object |
line_items.*.variants.*.option_name |
string | Variant's option name for the product in the live object |
line_items.*.variants.*.price |
Price | The price delta for the variant, applied to the base product price |
line_items.*.tax.is_taxable |
boolean | Whether this line item should be included in tax calculations (and is not tax exempt) Example: true |
line_items.*.tax.taxable_amount |
number | The raw value (price) that is taxable for this line item Example: 21.3 |
line_items.*.tax.tax_amount |
number | The raw calculated tax for this line item Example: 1.7 |
line_items.*.tax.breakdown.*.amount |
number | The raw calculated tax for this type of tax Example: 0.9 |
line_items.*.tax.breakdown.*.rate |
number | A decimal that represents the rate of this tax Example: 0.15 |
line_items.*.tax.breakdown.*.rate_percentage |
string | The decimal rate formatted as a percentage Example: "15%" |
line_items.*.tax.breakdown.*.type |
string | A name given to this part of the total tax Example: VAT |
subtotal |
Price | The subtotal of the live object, summing all of the line items |
shipping.id |
string | The ID for the shipping method chosen for the live object |
shipping.description |
string | The stored description for this shipping method |
shipping.price |
Price | The price for the chosen shipping method for the live object |
shipping.available_options |
string[] | A list of available shipping options for this live object. See "get available shipping methods" |
total |
Price | The total of the live object, excluding tax |
total_with_tax |
Price | The total of the live object, including tax |
giftcard.id |
string | The giftcard ID that has been redeemed on the live object |
giftcard.code |
string | The code for the giftcard that has been redeemed on the live object |
giftcard.credit |
Price | The amount of the giftcards balance that will be deducted once an order has been captured from the live object |
total_due |
Price | The total that is required to capture a checkout with this live object |
pay_what_you_want.enabled |
boolean | Whether a customer set "pay what you want" price is enabled for this live object |
pay_what_you_want.minimum |
Price | The minimum value a customer may choose for "pay what you want" |
pay_what_you_want.customer_set_price |
Price | The current price the customer has chosen for this live object |
Update checkout token
This API provides developers the ability to modify parts of a checkout token with custom attributes, such as using custom shipping methods. This API must be used with a secret API key.
Use the shipping_methods
attributes to set custom shipping methods on your token. If you specify an empty
list, existing custom shipping methods on the token will be cleared, and the default shipping methods from the
Chec API will be used again. When custom shipping methods are provided, they will be used in the "check
shipping method" helper API and in the "capture checkout" API. Custom shipping method prices are absolute, so
individual line items will not affect the price any longer.
Use the tax
attributes to set custom tax rates on your token. This may be done either at the token/order level,
or for individual line items. Line item tax lines are also returned in the resulting order's tax lines as well
as the line items themselves, so if you specify both top level and line item level tax lines they will be merged.
When tax lines are aggregated from line items in an order to be displayed on the order, they are grouped by the "type" and the "rate". If you specify two tax lines with the same "type" (e.g. GST) but different rates, they will not be aggregated.
Use the adjustments
attributes to define custom price adjustments on your checkout token. This can be used for
things such as custom discount amounts, fees, surcharges, etc. You must specify a name and value (positive or
negative), and may specify whether it is taxable and custom metadata if necessary. If an adjustment is taxable,
it will be included in tax calculation. If it is not taxable, it will be added after tax has been calculated.
Example request:
curl --request PUT \
"https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA" \
--header "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/checkouts/chkt_L5z3kmQpdpkGlA"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('PUT', url, headers=headers)
response.json()
Example response (200):
{
"id": "chkt_ql9pzRX339zW45",
"cart_id": "cart_6oLZ1vkBDM38Ol",
"created": 1631119919,
"expires": 1631724719,
"conditionals": {
"collects_fullname": false,
"collects_shipping_address": true,
"collects_billing_address": false,
"has_physical_delivery": true,
"has_digital_delivery": false,
"has_pay_what_you_want": false,
"has_available_discounts": false,
"collects_extra_fields": false,
"is_cart_free": false
},
"collects": {
"fullname": false,
"shipping_address": true,
"billing_address": false,
"extra_fields": false
},
"has": {
"physical_delivery": true,
"digital_delivery": false,
"pay_what_you_want": false,
"available_discounts": false
},
"is": {
"cart_free": false
},
"products": [
{
"id": "prod_bWZ3l89mMOwkpE",
"created": 1630519799,
"updated": 1630519996,
"active": true,
"permalink": "76HgYX",
"name": "Oxford loafers",
"description": "<p>Classic oxford loafers</p>",
"price": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"inventory": {
"managed": false,
"available": 0
},
"media": {
"type": "image",
"source": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"asset_id": "ast_L1vOoZdax4lRa8"
},
"sku": null,
"sort_order": 0,
"seo": {
"title": null,
"description": null
},
"thank_you_url": null,
"meta": null,
"conditionals": {
"is_active": true,
"is_tax_exempt": false,
"is_pay_what_you_want": false,
"is_inventory_managed": false,
"is_sold_out": false,
"has_digital_delivery": false,
"has_physical_delivery": true,
"has_images": true,
"has_video": false,
"has_rich_embed": false,
"collects_fullname": false,
"collects_shipping_address": true,
"collects_billing_address": false,
"collects_extra_fields": false
},
"is": {
"active": true,
"tax_exempt": false,
"pay_what_you_want": false,
"inventory_managed": false,
"sold_out": false
},
"has": {
"digital_delivery": false,
"physical_delivery": true,
"images": true,
"video": false,
"rich_embed": false
},
"collects": {
"fullname": false,
"shipping_address": true,
"billing_address": false,
"extra_fields": false
},
"checkout_url": {
"checkout": "https://checkout.chec.io/76HgYX?checkout=true",
"display": "https://checkout.chec.io/76HgYX"
},
"extra_fields": [],
"variant_groups": [
{
"id": "vgrp_bO6J5a6PLlEjpK",
"name": "Material",
"meta": null,
"created": 1630519859,
"updated": 1630519859,
"options": [
{
"id": "optn_Op1YoVmEywXLv9",
"name": "Leather",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"assets": [],
"meta": null,
"created": 1630519859,
"updated": 1630519996
}
]
}
],
"categories": [],
"assets": [
{
"id": "ast_L1vOoZdax4lRa8",
"url": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"description": null,
"is_image": true,
"filename": "loafers.jpg",
"file_size": 922443,
"file_extension": "jpg",
"image_dimensions": {
"width": 2853,
"height": 2834
},
"meta": [],
"created_at": 1630519989,
"updated_at": 1630519992
}
],
"related_products": []
}
],
"merchant": {
"id": 32748,
"name": "New merchant",
"description": "",
"status": "active",
"country": "US",
"currency": {
"symbol": "$",
"code": "USD"
},
"support_email": "[email protected]",
"logo_shape": null,
"intercom": true,
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"has": {
"logo": false,
"cover": false,
"analytics": false,
"description": false
},
"images": {
"logo": null,
"cover": null
}
},
"extra_fields": [],
"gateways": [
{
"id": "gway_OoZaNX1NBba4wR",
"code": "test_gateway",
"sandbox": true,
"config": []
},
{
"id": "gway_mwDZVm8VRv3W5r",
"code": "stripe",
"sandbox": false,
"config": {
"publishable_key": "pk_test_51Hm1waEtPU7XlX8YyuSwjGBTKgtROP6iLIBtQB5h4EVqY0z4mmc7x6tVXI98QuvxZ4r81iPWHovoQ3G44ShLebGK00dEHvV8lS"
}
}
],
"shipping_methods": [
{
"id": "ship_RyWOwmrX6onEa2",
"description": "Domestic",
"provider": "chec",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"countries": [
"US"
],
"regions": {
"US": [
"AL",
"AK",
"AS",
"AZ",
"AR",
"CA",
"CO",
"CT",
"DE",
"DC",
"FL",
"GA",
"GU",
"HI",
"ID",
"IL",
"IN",
"IA",
"KS",
"KY",
"LA",
"ME",
"MD",
"MA",
"MI",
"MN",
"MS",
"MO",
"MT",
"NE",
"NV",
"NH",
"NJ",
"NM",
"NY",
"NC",
"ND",
"MP",
"OH",
"OK",
"OR",
"PA",
"PR",
"RI",
"SC",
"SD",
"TN",
"TX",
"UM",
"UT",
"VT",
"VI",
"VA",
"WA",
"WV",
"WI",
"WY"
]
}
}
],
"live": {
"merchant_id": 32748,
"currency": {
"code": "USD",
"symbol": "$"
},
"subtotal": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"tax": {
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"breakdown": [],
"included_in_price": false,
"zone": [],
"provider": "chec"
},
"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"
},
"adjustments": {
"taxable": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"untaxable": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"total": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
}
},
"giftcard": [],
"total_due": {
"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
},
"line_items": [
{
"id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_bWZ3l89mMOwkpE",
"name": "Oxford loafers",
"product_name": "Oxford loafers",
"media": {
"type": "image",
"source": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"asset_id": "ast_L1vOoZdax4lRa8"
},
"sku": null,
"permalink": "76HgYX",
"quantity": 1,
"price": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"line_total": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"is_valid": true,
"product_meta": [],
"tax": {
"is_taxable": false,
"taxable_amount": null,
"amount": null,
"breakdown": null
},
"selected_options": [],
"variant": null
}
],
"discount": [],
"shipping": {
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"available_options": [
{
"id": "ship_RyWOwmrX6onEa2",
"description": "Domestic",
"provider": "chec",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"countries": [
"US"
],
"regions": {
"US": [
"AL",
"AK",
"AS",
"AZ",
"AR",
"CA",
"CO",
"CT",
"DE",
"DC",
"FL",
"GA",
"GU",
"HI",
"ID",
"IL",
"IN",
"IA",
"KS",
"KY",
"LA",
"ME",
"MD",
"MA",
"MI",
"MN",
"MS",
"MO",
"MT",
"NE",
"NV",
"NH",
"NJ",
"NM",
"NY",
"NC",
"ND",
"MP",
"OH",
"OK",
"OR",
"PA",
"PR",
"RI",
"SC",
"SD",
"TN",
"TX",
"UM",
"UT",
"VT",
"VI",
"VA",
"WA",
"WV",
"WI",
"WY"
]
}
}
]
}
},
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"adjustments": [],
"meta": null
}
Request
PUT v1/checkouts/{checkout_token_id}
URL parameters
Name | Status | Description |
---|---|---|
checkout_token_id |
required | The checkout token |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
shipping_methods.*.id |
string | optional | Specify a custom shipping method ID, or set to null to remove |
shipping_methods.*.description |
string | optional | Specify a custom shipping method name/description |
shipping_methods.*.price |
number | optional | Specify the price for a custom shipping method |
tax.provider |
string | optional | Optionally specify the provider used for custom tax, defaults to "custom" |
tax.included_in_price |
boolean | optional | Optionally override the merchant setting for whether the displayed prices include tax amounts |
tax.zone.country |
string | optional | An ISO-3166 country code for the tax zone |
tax.zone.region |
string | optional | An ISO-3166 region code for the tax zone |
tax.zone.postal_zip_code |
string | optional | A post/ZIP code for the tax zone |
tax.line_items.*.id |
string | optional | A line item ID to set tax for |
tax.line_items.*.breakdown.*.amount |
number | optional | A tax line's amount |
tax.line_items.*.breakdown.*.rate |
number | optional | A tax line's rate |
tax.line_items.*.breakdown.*.type |
string | optional | A tax line's type |
line_items.*.id |
string | optional | A line item ID to customise |
line_items.*.price |
number | optional | Specify a custom price for a line item |
adjustments.*.name |
string | optional | Name for an adjustment to add |
adjustments.*.value |
number | optional | Value of the adjustment to add, can be positive or negative |
adjustments.*.is_taxable |
boolean | optional | Whether the adjustment's value should be included in tax calculation or not (default: true) |
adjustments.*.meta |
string[] | optional | Optional metadata to store on the adjustment |
meta |
object | optional | Optional metadata to attach to the checkout token, which will be transferred to the order once captured |
Response
Response fields
Name | Type | Description |
---|---|---|
currency.code |
string | The currency code (ISO 4217) of the currency in the live object |
currency.symbol |
string | The currency symbol used in the live object |
line_items.*.id |
string | The ID of the line item in the live object Example: item_7RyWOwmK5nEa2V |
line_items.*.product_id |
string | The ID of the product for the line item Example: prod_4VPvL5zRQ5AQkX |
line_items.*.product_name |
string | The product name in the line item Example: New Season T-Shirt |
line_items.*.quantity |
integer | The quantity of this line item in the live object Example: 2 |
line_items.*.price |
Price | The base price for one of this line item |
line_items.*.line_total |
Price | the total price for this line item, including the selected variant options |
line_items.*.variants.*.variant_id |
string | Variant ID for the product in the live object |
line_items.*.variants.*.variant_name |
string | Name of variant for the product in the live object |
line_items.*.variants.*.option_id |
string | Variant's option ID for the product in the live object |
line_items.*.variants.*.option_name |
string | Variant's option name for the product in the live object |
line_items.*.variants.*.price |
Price | The price delta for the variant, applied to the base product price |
line_items.*.tax.is_taxable |
boolean | Whether this line item should be included in tax calculations (and is not tax exempt) Example: true |
line_items.*.tax.taxable_amount |
number | The raw value (price) that is taxable for this line item Example: 21.3 |
line_items.*.tax.tax_amount |
number | The raw calculated tax for this line item Example: 1.7 |
line_items.*.tax.breakdown.*.amount |
number | The raw calculated tax for this type of tax Example: 0.9 |
line_items.*.tax.breakdown.*.rate |
number | A decimal that represents the rate of this tax Example: 0.15 |
line_items.*.tax.breakdown.*.rate_percentage |
string | The decimal rate formatted as a percentage Example: "15%" |
line_items.*.tax.breakdown.*.type |
string | A name given to this part of the total tax Example: VAT |
subtotal |
Price | The subtotal of the live object, summing all of the line items |
shipping.id |
string | The ID for the shipping method chosen for the live object |
shipping.description |
string | The stored description for this shipping method |
shipping.price |
Price | The price for the chosen shipping method for the live object |
shipping.available_options |
string[] | A list of available shipping options for this live object. See "get available shipping methods" |
total |
Price | The total of the live object, excluding tax |
total_with_tax |
Price | The total of the live object, including tax |
giftcard.id |
string | The giftcard ID that has been redeemed on the live object |
giftcard.code |
string | The code for the giftcard that has been redeemed on the live object |
giftcard.credit |
Price | The amount of the giftcards balance that will be deducted once an order has been captured from the live object |
total_due |
Price | The total that is required to capture a checkout with this live object |
pay_what_you_want.enabled |
boolean | Whether a customer set "pay what you want" price is enabled for this live object |
pay_what_you_want.minimum |
Price | The minimum value a customer may choose for "pay what you want" |
pay_what_you_want.customer_set_price |
Price | The current price the customer has chosen for this live object |
Checkout helpers
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 --request GET \
--get "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/pay_what_you_want?customer_set_price=100.00" \
--header "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';
const customerSetPrice = '100.00';
Commerce.checkout.checkPayWhatYouWant(checkoutTokenId, {
customer_set_price: customerSetPrice,
}).then(response => console.log(response.valid, response.live));
const url = new URL(
"https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/pay_what_you_want"
);
const params = {
"customer_set_price": "100.00",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.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):
{
"id": "chkt_ql9pzRX339zW45",
"cart_id": "cart_6oLZ1vkBDM38Ol",
"created": 1631119919,
"expires": 1631724719,
"conditionals": {
"collects_fullname": false,
"collects_shipping_address": true,
"collects_billing_address": false,
"has_physical_delivery": true,
"has_digital_delivery": false,
"has_pay_what_you_want": false,
"has_available_discounts": false,
"collects_extra_fields": false,
"is_cart_free": false
},
"collects": {
"fullname": false,
"shipping_address": true,
"billing_address": false,
"extra_fields": false
},
"has": {
"physical_delivery": true,
"digital_delivery": false,
"pay_what_you_want": false,
"available_discounts": false
},
"is": {
"cart_free": false
},
"products": [
{
"id": "prod_bWZ3l89mMOwkpE",
"created": 1630519799,
"updated": 1630519996,
"active": true,
"permalink": "76HgYX",
"name": "Oxford loafers",
"description": "<p>Classic oxford loafers</p>",
"price": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"inventory": {
"managed": false,
"available": 0
},
"media": {
"type": "image",
"source": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"asset_id": "ast_L1vOoZdax4lRa8"
},
"sku": null,
"sort_order": 0,
"seo": {
"title": null,
"description": null
},
"thank_you_url": null,
"meta": null,
"conditionals": {
"is_active": true,
"is_tax_exempt": false,
"is_pay_what_you_want": false,
"is_inventory_managed": false,
"is_sold_out": false,
"has_digital_delivery": false,
"has_physical_delivery": true,
"has_images": true,
"has_video": false,
"has_rich_embed": false,
"collects_fullname": false,
"collects_shipping_address": true,
"collects_billing_address": false,
"collects_extra_fields": false
},
"is": {
"active": true,
"tax_exempt": false,
"pay_what_you_want": false,
"inventory_managed": false,
"sold_out": false
},
"has": {
"digital_delivery": false,
"physical_delivery": true,
"images": true,
"video": false,
"rich_embed": false
},
"collects": {
"fullname": false,
"shipping_address": true,
"billing_address": false,
"extra_fields": false
},
"checkout_url": {
"checkout": "https://checkout.chec.io/76HgYX?checkout=true",
"display": "https://checkout.chec.io/76HgYX"
},
"extra_fields": [],
"variant_groups": [
{
"id": "vgrp_bO6J5a6PLlEjpK",
"name": "Material",
"meta": null,
"created": 1630519859,
"updated": 1630519859,
"options": [
{
"id": "optn_Op1YoVmEywXLv9",
"name": "Leather",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"assets": [],
"meta": null,
"created": 1630519859,
"updated": 1630519996
}
]
}
],
"categories": [],
"assets": [
{
"id": "ast_L1vOoZdax4lRa8",
"url": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"description": null,
"is_image": true,
"filename": "loafers.jpg",
"file_size": 922443,
"file_extension": "jpg",
"image_dimensions": {
"width": 2853,
"height": 2834
},
"meta": [],
"created_at": 1630519989,
"updated_at": 1630519992
}
],
"related_products": []
}
],
"merchant": {
"id": 32748,
"name": "New merchant",
"description": "",
"status": "active",
"country": "US",
"currency": {
"symbol": "$",
"code": "USD"
},
"support_email": "[email protected]",
"logo_shape": null,
"intercom": true,
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"has": {
"logo": false,
"cover": false,
"analytics": false,
"description": false
},
"images": {
"logo": null,
"cover": null
}
},
"extra_fields": [],
"gateways": [
{
"id": "gway_OoZaNX1NBba4wR",
"code": "test_gateway",
"sandbox": true,
"config": []
},
{
"id": "gway_mwDZVm8VRv3W5r",
"code": "stripe",
"sandbox": false,
"config": {
"publishable_key": "pk_test_51Hm1waEtPU7XlX8YyuSwjGBTKgtROP6iLIBtQB5h4EVqY0z4mmc7x6tVXI98QuvxZ4r81iPWHovoQ3G44ShLebGK00dEHvV8lS"
}
}
],
"shipping_methods": [
{
"id": "ship_RyWOwmrX6onEa2",
"description": "Domestic",
"provider": "chec",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"countries": [
"US"
],
"regions": {
"US": [
"AL",
"AK",
"AS",
"AZ",
"AR",
"CA",
"CO",
"CT",
"DE",
"DC",
"FL",
"GA",
"GU",
"HI",
"ID",
"IL",
"IN",
"IA",
"KS",
"KY",
"LA",
"ME",
"MD",
"MA",
"MI",
"MN",
"MS",
"MO",
"MT",
"NE",
"NV",
"NH",
"NJ",
"NM",
"NY",
"NC",
"ND",
"MP",
"OH",
"OK",
"OR",
"PA",
"PR",
"RI",
"SC",
"SD",
"TN",
"TX",
"UM",
"UT",
"VT",
"VI",
"VA",
"WA",
"WV",
"WI",
"WY"
]
}
}
],
"live": {
"merchant_id": 32748,
"currency": {
"code": "USD",
"symbol": "$"
},
"subtotal": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"tax": {
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"breakdown": [],
"included_in_price": false,
"zone": [],
"provider": "chec"
},
"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"
},
"adjustments": {
"taxable": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"untaxable": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"total": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
}
},
"giftcard": [],
"total_due": {
"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
},
"line_items": [
{
"id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_bWZ3l89mMOwkpE",
"name": "Oxford loafers",
"product_name": "Oxford loafers",
"media": {
"type": "image",
"source": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"asset_id": "ast_L1vOoZdax4lRa8"
},
"sku": null,
"permalink": "76HgYX",
"quantity": 1,
"price": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"line_total": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"is_valid": true,
"product_meta": [],
"tax": {
"is_taxable": false,
"taxable_amount": null,
"amount": null,
"breakdown": null
},
"selected_options": [],
"variant": null
}
],
"discount": [],
"shipping": {
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"available_options": [
{
"id": "ship_RyWOwmrX6onEa2",
"description": "Domestic",
"provider": "chec",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"countries": [
"US"
],
"regions": {
"US": [
"AL",
"AK",
"AS",
"AZ",
"AR",
"CA",
"CO",
"CT",
"DE",
"DC",
"FL",
"GA",
"GU",
"HI",
"ID",
"IL",
"IN",
"IA",
"KS",
"KY",
"LA",
"ME",
"MD",
"MA",
"MI",
"MN",
"MS",
"MO",
"MT",
"NE",
"NV",
"NH",
"NJ",
"NM",
"NY",
"NC",
"ND",
"MP",
"OH",
"OK",
"OR",
"PA",
"PR",
"RI",
"SC",
"SD",
"TN",
"TX",
"UM",
"UT",
"VT",
"VI",
"VA",
"WA",
"WV",
"WI",
"WY"
]
}
}
]
}
},
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"adjustments": [],
"meta": null
}
Request
GET v1/checkouts/{checkout_token_id}/check/pay_what_you_want
URL parameters
Name | Status | Description |
---|---|---|
checkout_token_id |
required | The checkout token |
Query parameters
Name | Status | Description |
---|---|---|
customer_set_price |
required | The customer set price as an integer or float |
Check variant
Validates that the provided variant option IDs (in options.*
) are valid for the provided checkout token and
line item. You may also call this API more than once and provide different options each time to build
up the list until a variant can be resolved from the options, or you may provide a specific variant_id
to
resolve the variant options automatically.
Once a variant has been resolved, its ID will be returned in the response under variant_id
.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/item_7RyWOwmK5nEa2V/variant?variant_id=vrnt_Kvg9l6Apq51bB7" \
--header "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';
const lineItemId = 'item_7RyWOwmK5nEa2V';
const variantId = 'vrnt_Kvg9l6Apq51bB7';
const optionId = 'optn_3BkyN5YDRo0b69';
Commerce.checkout.checkVariant(checkoutTokenId, lineItemId, {
variant_id: variantId,
option_id: optionId,
}).then(response => console.log(response.available));
const url = new URL(
"https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/item_7RyWOwmK5nEa2V/variant"
);
const params = {
"variant_id": "vrnt_Kvg9l6Apq51bB7",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/item_7RyWOwmK5nEa2V/variant'
params = {
'variant_id': 'vrnt_Kvg9l6Apq51bB7',
}
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()
Example response (200):
{
"id": "chkt_ql9pzRX339zW45",
"cart_id": "cart_6oLZ1vkBDM38Ol",
"created": 1631119919,
"expires": 1631724719,
"conditionals": {
"collects_fullname": false,
"collects_shipping_address": true,
"collects_billing_address": false,
"has_physical_delivery": true,
"has_digital_delivery": false,
"has_pay_what_you_want": false,
"has_available_discounts": false,
"collects_extra_fields": false,
"is_cart_free": false
},
"collects": {
"fullname": false,
"shipping_address": true,
"billing_address": false,
"extra_fields": false
},
"has": {
"physical_delivery": true,
"digital_delivery": false,
"pay_what_you_want": false,
"available_discounts": false
},
"is": {
"cart_free": false
},
"products": [
{
"id": "prod_bWZ3l89mMOwkpE",
"created": 1630519799,
"updated": 1630519996,
"active": true,
"permalink": "76HgYX",
"name": "Oxford loafers",
"description": "<p>Classic oxford loafers</p>",
"price": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"inventory": {
"managed": false,
"available": 0
},
"media": {
"type": "image",
"source": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"asset_id": "ast_L1vOoZdax4lRa8"
},
"sku": null,
"sort_order": 0,
"seo": {
"title": null,
"description": null
},
"thank_you_url": null,
"meta": null,
"conditionals": {
"is_active": true,
"is_tax_exempt": false,
"is_pay_what_you_want": false,
"is_inventory_managed": false,
"is_sold_out": false,
"has_digital_delivery": false,
"has_physical_delivery": true,
"has_images": true,
"has_video": false,
"has_rich_embed": false,
"collects_fullname": false,
"collects_shipping_address": true,
"collects_billing_address": false,
"collects_extra_fields": false
},
"is": {
"active": true,
"tax_exempt": false,
"pay_what_you_want": false,
"inventory_managed": false,
"sold_out": false
},
"has": {
"digital_delivery": false,
"physical_delivery": true,
"images": true,
"video": false,
"rich_embed": false
},
"collects": {
"fullname": false,
"shipping_address": true,
"billing_address": false,
"extra_fields": false
},
"checkout_url": {
"checkout": "https://checkout.chec.io/76HgYX?checkout=true",
"display": "https://checkout.chec.io/76HgYX"
},
"extra_fields": [],
"variant_groups": [
{
"id": "vgrp_bO6J5a6PLlEjpK",
"name": "Material",
"meta": null,
"created": 1630519859,
"updated": 1630519859,
"options": [
{
"id": "optn_Op1YoVmEywXLv9",
"name": "Leather",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"assets": [],
"meta": null,
"created": 1630519859,
"updated": 1630519996
}
]
}
],
"categories": [],
"assets": [
{
"id": "ast_L1vOoZdax4lRa8",
"url": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"description": null,
"is_image": true,
"filename": "loafers.jpg",
"file_size": 922443,
"file_extension": "jpg",
"image_dimensions": {
"width": 2853,
"height": 2834
},
"meta": [],
"created_at": 1630519989,
"updated_at": 1630519992
}
],
"related_products": []
}
],
"merchant": {
"id": 32748,
"name": "New merchant",
"description": "",
"status": "active",
"country": "US",
"currency": {
"symbol": "$",
"code": "USD"
},
"support_email": "[email protected]",
"logo_shape": null,
"intercom": true,
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"has": {
"logo": false,
"cover": false,
"analytics": false,
"description": false
},
"images": {
"logo": null,
"cover": null
}
},
"extra_fields": [],
"gateways": [
{
"id": "gway_OoZaNX1NBba4wR",
"code": "test_gateway",
"sandbox": true,
"config": []
},
{
"id": "gway_mwDZVm8VRv3W5r",
"code": "stripe",
"sandbox": false,
"config": {
"publishable_key": "pk_test_51Hm1waEtPU7XlX8YyuSwjGBTKgtROP6iLIBtQB5h4EVqY0z4mmc7x6tVXI98QuvxZ4r81iPWHovoQ3G44ShLebGK00dEHvV8lS"
}
}
],
"shipping_methods": [
{
"id": "ship_RyWOwmrX6onEa2",
"description": "Domestic",
"provider": "chec",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"countries": [
"US"
],
"regions": {
"US": [
"AL",
"AK",
"AS",
"AZ",
"AR",
"CA",
"CO",
"CT",
"DE",
"DC",
"FL",
"GA",
"GU",
"HI",
"ID",
"IL",
"IN",
"IA",
"KS",
"KY",
"LA",
"ME",
"MD",
"MA",
"MI",
"MN",
"MS",
"MO",
"MT",
"NE",
"NV",
"NH",
"NJ",
"NM",
"NY",
"NC",
"ND",
"MP",
"OH",
"OK",
"OR",
"PA",
"PR",
"RI",
"SC",
"SD",
"TN",
"TX",
"UM",
"UT",
"VT",
"VI",
"VA",
"WA",
"WV",
"WI",
"WY"
]
}
}
],
"live": {
"merchant_id": 32748,
"currency": {
"code": "USD",
"symbol": "$"
},
"subtotal": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"tax": {
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"breakdown": [],
"included_in_price": false,
"zone": [],
"provider": "chec"
},
"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"
},
"adjustments": {
"taxable": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"untaxable": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"total": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
}
},
"giftcard": [],
"total_due": {
"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
},
"line_items": [
{
"id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_bWZ3l89mMOwkpE",
"name": "Oxford loafers",
"product_name": "Oxford loafers",
"media": {
"type": "image",
"source": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"asset_id": "ast_L1vOoZdax4lRa8"
},
"sku": null,
"permalink": "76HgYX",
"quantity": 1,
"price": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"line_total": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"is_valid": true,
"product_meta": [],
"tax": {
"is_taxable": false,
"taxable_amount": null,
"amount": null,
"breakdown": null
},
"selected_options": [],
"variant": null
}
],
"discount": [],
"shipping": {
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"available_options": [
{
"id": "ship_RyWOwmrX6onEa2",
"description": "Domestic",
"provider": "chec",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"countries": [
"US"
],
"regions": {
"US": [
"AL",
"AK",
"AS",
"AZ",
"AR",
"CA",
"CO",
"CT",
"DE",
"DC",
"FL",
"GA",
"GU",
"HI",
"ID",
"IL",
"IN",
"IA",
"KS",
"KY",
"LA",
"ME",
"MD",
"MA",
"MI",
"MN",
"MS",
"MO",
"MT",
"NE",
"NV",
"NH",
"NJ",
"NM",
"NY",
"NC",
"ND",
"MP",
"OH",
"OK",
"OR",
"PA",
"PR",
"RI",
"SC",
"SD",
"TN",
"TX",
"UM",
"UT",
"VT",
"VI",
"VA",
"WA",
"WV",
"WI",
"WY"
]
}
}
]
}
},
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"adjustments": [],
"meta": null
}
Request
GET v1/checkouts/{checkout_token_id}/check/{line_item_id}/variant
URL parameters
Name | Status | Description |
---|---|---|
checkout_token_id |
required | The checkout token |
line_item_id |
required | The line item ID to check the variant for |
Query parameters
Name | Status | Description |
---|---|---|
variant_id |
optional | The specific variant ID to check |
options.* |
optional | Each variant option ID to check, if not using a variant ID |
Check requested quantity
Validates that the requested quantity is available for the provided line item ID, and adjusts it in the order. If your line item has variants, then the variant ID, or variant group ID and selected option ID for it, must have either been added to the checkout already (using the "check variant" helper, or during cart creation), or must be provided as request attributes.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/item_7RyWOwmK5nEa2V/quantity?amount=5&variant_id=vrnt_3BkyN5YDRo0b69" \
--header "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';
const lineItemId = 'item_7RyWOwmK5nEa2V';
const requestedQuantity = 5;
Commerce.checkout.checkQuantity(checkoutTokenId, lineItemId, {
amount: requestedQuantity,
}).then(response => console.log(response.available));
const url = new URL(
"https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/item_7RyWOwmK5nEa2V/quantity"
);
const params = {
"amount": "5",
"variant_id": "vrnt_3BkyN5YDRo0b69",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/item_7RyWOwmK5nEa2V/quantity'
params = {
'amount': '5',
'variant_id': 'vrnt_3BkyN5YDRo0b69',
}
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()
Example response (200):
{
"id": "chkt_ql9pzRX339zW45",
"cart_id": "cart_6oLZ1vkBDM38Ol",
"created": 1631119919,
"expires": 1631724719,
"conditionals": {
"collects_fullname": false,
"collects_shipping_address": true,
"collects_billing_address": false,
"has_physical_delivery": true,
"has_digital_delivery": false,
"has_pay_what_you_want": false,
"has_available_discounts": false,
"collects_extra_fields": false,
"is_cart_free": false
},
"collects": {
"fullname": false,
"shipping_address": true,
"billing_address": false,
"extra_fields": false
},
"has": {
"physical_delivery": true,
"digital_delivery": false,
"pay_what_you_want": false,
"available_discounts": false
},
"is": {
"cart_free": false
},
"products": [
{
"id": "prod_bWZ3l89mMOwkpE",
"created": 1630519799,
"updated": 1630519996,
"active": true,
"permalink": "76HgYX",
"name": "Oxford loafers",
"description": "<p>Classic oxford loafers</p>",
"price": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"inventory": {
"managed": false,
"available": 0
},
"media": {
"type": "image",
"source": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"asset_id": "ast_L1vOoZdax4lRa8"
},
"sku": null,
"sort_order": 0,
"seo": {
"title": null,
"description": null
},
"thank_you_url": null,
"meta": null,
"conditionals": {
"is_active": true,
"is_tax_exempt": false,
"is_pay_what_you_want": false,
"is_inventory_managed": false,
"is_sold_out": false,
"has_digital_delivery": false,
"has_physical_delivery": true,
"has_images": true,
"has_video": false,
"has_rich_embed": false,
"collects_fullname": false,
"collects_shipping_address": true,
"collects_billing_address": false,
"collects_extra_fields": false
},
"is": {
"active": true,
"tax_exempt": false,
"pay_what_you_want": false,
"inventory_managed": false,
"sold_out": false
},
"has": {
"digital_delivery": false,
"physical_delivery": true,
"images": true,
"video": false,
"rich_embed": false
},
"collects": {
"fullname": false,
"shipping_address": true,
"billing_address": false,
"extra_fields": false
},
"checkout_url": {
"checkout": "https://checkout.chec.io/76HgYX?checkout=true",
"display": "https://checkout.chec.io/76HgYX"
},
"extra_fields": [],
"variant_groups": [
{
"id": "vgrp_bO6J5a6PLlEjpK",
"name": "Material",
"meta": null,
"created": 1630519859,
"updated": 1630519859,
"options": [
{
"id": "optn_Op1YoVmEywXLv9",
"name": "Leather",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"assets": [],
"meta": null,
"created": 1630519859,
"updated": 1630519996
}
]
}
],
"categories": [],
"assets": [
{
"id": "ast_L1vOoZdax4lRa8",
"url": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"description": null,
"is_image": true,
"filename": "loafers.jpg",
"file_size": 922443,
"file_extension": "jpg",
"image_dimensions": {
"width": 2853,
"height": 2834
},
"meta": [],
"created_at": 1630519989,
"updated_at": 1630519992
}
],
"related_products": []
}
],
"merchant": {
"id": 32748,
"name": "New merchant",
"description": "",
"status": "active",
"country": "US",
"currency": {
"symbol": "$",
"code": "USD"
},
"support_email": "[email protected]",
"logo_shape": null,
"intercom": true,
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"has": {
"logo": false,
"cover": false,
"analytics": false,
"description": false
},
"images": {
"logo": null,
"cover": null
}
},
"extra_fields": [],
"gateways": [
{
"id": "gway_OoZaNX1NBba4wR",
"code": "test_gateway",
"sandbox": true,
"config": []
},
{
"id": "gway_mwDZVm8VRv3W5r",
"code": "stripe",
"sandbox": false,
"config": {
"publishable_key": "pk_test_51Hm1waEtPU7XlX8YyuSwjGBTKgtROP6iLIBtQB5h4EVqY0z4mmc7x6tVXI98QuvxZ4r81iPWHovoQ3G44ShLebGK00dEHvV8lS"
}
}
],
"shipping_methods": [
{
"id": "ship_RyWOwmrX6onEa2",
"description": "Domestic",
"provider": "chec",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"countries": [
"US"
],
"regions": {
"US": [
"AL",
"AK",
"AS",
"AZ",
"AR",
"CA",
"CO",
"CT",
"DE",
"DC",
"FL",
"GA",
"GU",
"HI",
"ID",
"IL",
"IN",
"IA",
"KS",
"KY",
"LA",
"ME",
"MD",
"MA",
"MI",
"MN",
"MS",
"MO",
"MT",
"NE",
"NV",
"NH",
"NJ",
"NM",
"NY",
"NC",
"ND",
"MP",
"OH",
"OK",
"OR",
"PA",
"PR",
"RI",
"SC",
"SD",
"TN",
"TX",
"UM",
"UT",
"VT",
"VI",
"VA",
"WA",
"WV",
"WI",
"WY"
]
}
}
],
"live": {
"merchant_id": 32748,
"currency": {
"code": "USD",
"symbol": "$"
},
"subtotal": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"tax": {
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"breakdown": [],
"included_in_price": false,
"zone": [],
"provider": "chec"
},
"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"
},
"adjustments": {
"taxable": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"untaxable": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"total": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
}
},
"giftcard": [],
"total_due": {
"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
},
"line_items": [
{
"id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_bWZ3l89mMOwkpE",
"name": "Oxford loafers",
"product_name": "Oxford loafers",
"media": {
"type": "image",
"source": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"asset_id": "ast_L1vOoZdax4lRa8"
},
"sku": null,
"permalink": "76HgYX",
"quantity": 1,
"price": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"line_total": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"is_valid": true,
"product_meta": [],
"tax": {
"is_taxable": false,
"taxable_amount": null,
"amount": null,
"breakdown": null
},
"selected_options": [],
"variant": null
}
],
"discount": [],
"shipping": {
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"available_options": [
{
"id": "ship_RyWOwmrX6onEa2",
"description": "Domestic",
"provider": "chec",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"countries": [
"US"
],
"regions": {
"US": [
"AL",
"AK",
"AS",
"AZ",
"AR",
"CA",
"CO",
"CT",
"DE",
"DC",
"FL",
"GA",
"GU",
"HI",
"ID",
"IL",
"IN",
"IA",
"KS",
"KY",
"LA",
"ME",
"MD",
"MA",
"MI",
"MN",
"MS",
"MO",
"MT",
"NE",
"NV",
"NH",
"NJ",
"NM",
"NY",
"NC",
"ND",
"MP",
"OH",
"OK",
"OR",
"PA",
"PR",
"RI",
"SC",
"SD",
"TN",
"TX",
"UM",
"UT",
"VT",
"VI",
"VA",
"WA",
"WV",
"WI",
"WY"
]
}
}
]
}
},
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"adjustments": [],
"meta": null
}
Request
GET v1/checkouts/{checkout_token_id}/check/{line_item_id}/quantity
URL parameters
Name | Status | Description |
---|---|---|
checkout_token_id |
required | The checkout token |
line_item_id |
required | The line item ID to check the variant for |
Query parameters
Name | Status | Description |
---|---|---|
amount |
required | Requested quantity amount as a positive integer |
variant_id |
optional | The variant ID to check for inventory |
variants.vgrp_Kvg9l6Apq51bB7 |
optional | The variant option ID (value) to check for each of the product's variant group IDs (key), if not already provided and if not using |
Check discount code
Validates a discount code for the provided checkout token, and applies it to the order.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/discount?code=ABC123ZYX" \
--header "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';
const discountCode = 'ABC123ZYX';
Commerce.checkout.checkDiscount(checkoutTokenId, {
code: discountCode,
}).then(response => console.log(response.valid, response.type, response.value));
const url = new URL(
"https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/discount"
);
const params = {
"code": "ABC123ZYX",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.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):
{
"id": "chkt_ql9pzRX339zW45",
"cart_id": "cart_6oLZ1vkBDM38Ol",
"created": 1631119919,
"expires": 1631724719,
"conditionals": {
"collects_fullname": false,
"collects_shipping_address": true,
"collects_billing_address": false,
"has_physical_delivery": true,
"has_digital_delivery": false,
"has_pay_what_you_want": false,
"has_available_discounts": false,
"collects_extra_fields": false,
"is_cart_free": false
},
"collects": {
"fullname": false,
"shipping_address": true,
"billing_address": false,
"extra_fields": false
},
"has": {
"physical_delivery": true,
"digital_delivery": false,
"pay_what_you_want": false,
"available_discounts": false
},
"is": {
"cart_free": false
},
"products": [
{
"id": "prod_bWZ3l89mMOwkpE",
"created": 1630519799,
"updated": 1630519996,
"active": true,
"permalink": "76HgYX",
"name": "Oxford loafers",
"description": "<p>Classic oxford loafers</p>",
"price": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"inventory": {
"managed": false,
"available": 0
},
"media": {
"type": "image",
"source": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"asset_id": "ast_L1vOoZdax4lRa8"
},
"sku": null,
"sort_order": 0,
"seo": {
"title": null,
"description": null
},
"thank_you_url": null,
"meta": null,
"conditionals": {
"is_active": true,
"is_tax_exempt": false,
"is_pay_what_you_want": false,
"is_inventory_managed": false,
"is_sold_out": false,
"has_digital_delivery": false,
"has_physical_delivery": true,
"has_images": true,
"has_video": false,
"has_rich_embed": false,
"collects_fullname": false,
"collects_shipping_address": true,
"collects_billing_address": false,
"collects_extra_fields": false
},
"is": {
"active": true,
"tax_exempt": false,
"pay_what_you_want": false,
"inventory_managed": false,
"sold_out": false
},
"has": {
"digital_delivery": false,
"physical_delivery": true,
"images": true,
"video": false,
"rich_embed": false
},
"collects": {
"fullname": false,
"shipping_address": true,
"billing_address": false,
"extra_fields": false
},
"checkout_url": {
"checkout": "https://checkout.chec.io/76HgYX?checkout=true",
"display": "https://checkout.chec.io/76HgYX"
},
"extra_fields": [],
"variant_groups": [
{
"id": "vgrp_bO6J5a6PLlEjpK",
"name": "Material",
"meta": null,
"created": 1630519859,
"updated": 1630519859,
"options": [
{
"id": "optn_Op1YoVmEywXLv9",
"name": "Leather",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"assets": [],
"meta": null,
"created": 1630519859,
"updated": 1630519996
}
]
}
],
"categories": [],
"assets": [
{
"id": "ast_L1vOoZdax4lRa8",
"url": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"description": null,
"is_image": true,
"filename": "loafers.jpg",
"file_size": 922443,
"file_extension": "jpg",
"image_dimensions": {
"width": 2853,
"height": 2834
},
"meta": [],
"created_at": 1630519989,
"updated_at": 1630519992
}
],
"related_products": []
}
],
"merchant": {
"id": 32748,
"name": "New merchant",
"description": "",
"status": "active",
"country": "US",
"currency": {
"symbol": "$",
"code": "USD"
},
"support_email": "[email protected]",
"logo_shape": null,
"intercom": true,
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"has": {
"logo": false,
"cover": false,
"analytics": false,
"description": false
},
"images": {
"logo": null,
"cover": null
}
},
"extra_fields": [],
"gateways": [
{
"id": "gway_OoZaNX1NBba4wR",
"code": "test_gateway",
"sandbox": true,
"config": []
},
{
"id": "gway_mwDZVm8VRv3W5r",
"code": "stripe",
"sandbox": false,
"config": {
"publishable_key": "pk_test_51Hm1waEtPU7XlX8YyuSwjGBTKgtROP6iLIBtQB5h4EVqY0z4mmc7x6tVXI98QuvxZ4r81iPWHovoQ3G44ShLebGK00dEHvV8lS"
}
}
],
"shipping_methods": [
{
"id": "ship_RyWOwmrX6onEa2",
"description": "Domestic",
"provider": "chec",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"countries": [
"US"
],
"regions": {
"US": [
"AL",
"AK",
"AS",
"AZ",
"AR",
"CA",
"CO",
"CT",
"DE",
"DC",
"FL",
"GA",
"GU",
"HI",
"ID",
"IL",
"IN",
"IA",
"KS",
"KY",
"LA",
"ME",
"MD",
"MA",
"MI",
"MN",
"MS",
"MO",
"MT",
"NE",
"NV",
"NH",
"NJ",
"NM",
"NY",
"NC",
"ND",
"MP",
"OH",
"OK",
"OR",
"PA",
"PR",
"RI",
"SC",
"SD",
"TN",
"TX",
"UM",
"UT",
"VT",
"VI",
"VA",
"WA",
"WV",
"WI",
"WY"
]
}
}
],
"live": {
"merchant_id": 32748,
"currency": {
"code": "USD",
"symbol": "$"
},
"subtotal": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"tax": {
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"breakdown": [],
"included_in_price": false,
"zone": [],
"provider": "chec"
},
"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"
},
"adjustments": {
"taxable": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"untaxable": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"total": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
}
},
"giftcard": [],
"total_due": {
"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
},
"line_items": [
{
"id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_bWZ3l89mMOwkpE",
"name": "Oxford loafers",
"product_name": "Oxford loafers",
"media": {
"type": "image",
"source": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"asset_id": "ast_L1vOoZdax4lRa8"
},
"sku": null,
"permalink": "76HgYX",
"quantity": 1,
"price": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"line_total": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"is_valid": true,
"product_meta": [],
"tax": {
"is_taxable": false,
"taxable_amount": null,
"amount": null,
"breakdown": null
},
"selected_options": [],
"variant": null
}
],
"discount": [],
"shipping": {
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"available_options": [
{
"id": "ship_RyWOwmrX6onEa2",
"description": "Domestic",
"provider": "chec",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"countries": [
"US"
],
"regions": {
"US": [
"AL",
"AK",
"AS",
"AZ",
"AR",
"CA",
"CO",
"CT",
"DE",
"DC",
"FL",
"GA",
"GU",
"HI",
"ID",
"IL",
"IN",
"IA",
"KS",
"KY",
"LA",
"ME",
"MD",
"MA",
"MI",
"MN",
"MS",
"MO",
"MT",
"NE",
"NV",
"NH",
"NJ",
"NM",
"NY",
"NC",
"ND",
"MP",
"OH",
"OK",
"OR",
"PA",
"PR",
"RI",
"SC",
"SD",
"TN",
"TX",
"UM",
"UT",
"VT",
"VI",
"VA",
"WA",
"WV",
"WI",
"WY"
]
}
}
]
}
},
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"adjustments": [],
"meta": null
}
Request
GET v1/checkouts/{checkout_token_id}/check/discount
URL parameters
Name | Status | Description |
---|---|---|
checkout_token_id |
required | The checkout token |
Query parameters
Name | 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. This API will return a 422 error if the checkout token doesn't have shipping enabled.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/shipping?shipping_option_id=ship_31q0o3e21lDdjR&country=US®ion=0" \
--header "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';
const shippingOptionId = 'ship_31q0o3e21lDdjR';
const country = 'US';
const region = 'CA';
Commerce.checkout.checkShippingOption(checkoutTokenId, {
shipping_option_id: shippingOptionId,
country: country,
region: region,
}).then(response => console.log(response.valid, response.live));
const url = new URL(
"https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/shipping"
);
const params = {
"shipping_option_id": "ship_31q0o3e21lDdjR",
"country": "US",
"region": "0",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.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': '0',
}
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()
Example response (200):
{
"id": "chkt_ql9pzRX339zW45",
"cart_id": "cart_6oLZ1vkBDM38Ol",
"created": 1631119919,
"expires": 1631724719,
"conditionals": {
"collects_fullname": false,
"collects_shipping_address": true,
"collects_billing_address": false,
"has_physical_delivery": true,
"has_digital_delivery": false,
"has_pay_what_you_want": false,
"has_available_discounts": false,
"collects_extra_fields": false,
"is_cart_free": false
},
"collects": {
"fullname": false,
"shipping_address": true,
"billing_address": false,
"extra_fields": false
},
"has": {
"physical_delivery": true,
"digital_delivery": false,
"pay_what_you_want": false,
"available_discounts": false
},
"is": {
"cart_free": false
},
"products": [
{
"id": "prod_bWZ3l89mMOwkpE",
"created": 1630519799,
"updated": 1630519996,
"active": true,
"permalink": "76HgYX",
"name": "Oxford loafers",
"description": "<p>Classic oxford loafers</p>",
"price": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"inventory": {
"managed": false,
"available": 0
},
"media": {
"type": "image",
"source": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"asset_id": "ast_L1vOoZdax4lRa8"
},
"sku": null,
"sort_order": 0,
"seo": {
"title": null,
"description": null
},
"thank_you_url": null,
"meta": null,
"conditionals": {
"is_active": true,
"is_tax_exempt": false,
"is_pay_what_you_want": false,
"is_inventory_managed": false,
"is_sold_out": false,
"has_digital_delivery": false,
"has_physical_delivery": true,
"has_images": true,
"has_video": false,
"has_rich_embed": false,
"collects_fullname": false,
"collects_shipping_address": true,
"collects_billing_address": false,
"collects_extra_fields": false
},
"is": {
"active": true,
"tax_exempt": false,
"pay_what_you_want": false,
"inventory_managed": false,
"sold_out": false
},
"has": {
"digital_delivery": false,
"physical_delivery": true,
"images": true,
"video": false,
"rich_embed": false
},
"collects": {
"fullname": false,
"shipping_address": true,
"billing_address": false,
"extra_fields": false
},
"checkout_url": {
"checkout": "https://checkout.chec.io/76HgYX?checkout=true",
"display": "https://checkout.chec.io/76HgYX"
},
"extra_fields": [],
"variant_groups": [
{
"id": "vgrp_bO6J5a6PLlEjpK",
"name": "Material",
"meta": null,
"created": 1630519859,
"updated": 1630519859,
"options": [
{
"id": "optn_Op1YoVmEywXLv9",
"name": "Leather",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"assets": [],
"meta": null,
"created": 1630519859,
"updated": 1630519996
}
]
}
],
"categories": [],
"assets": [
{
"id": "ast_L1vOoZdax4lRa8",
"url": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"description": null,
"is_image": true,
"filename": "loafers.jpg",
"file_size": 922443,
"file_extension": "jpg",
"image_dimensions": {
"width": 2853,
"height": 2834
},
"meta": [],
"created_at": 1630519989,
"updated_at": 1630519992
}
],
"related_products": []
}
],
"merchant": {
"id": 32748,
"name": "New merchant",
"description": "",
"status": "active",
"country": "US",
"currency": {
"symbol": "$",
"code": "USD"
},
"support_email": "[email protected]",
"logo_shape": null,
"intercom": true,
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"has": {
"logo": false,
"cover": false,
"analytics": false,
"description": false
},
"images": {
"logo": null,
"cover": null
}
},
"extra_fields": [],
"gateways": [
{
"id": "gway_OoZaNX1NBba4wR",
"code": "test_gateway",
"sandbox": true,
"config": []
},
{
"id": "gway_mwDZVm8VRv3W5r",
"code": "stripe",
"sandbox": false,
"config": {
"publishable_key": "pk_test_51Hm1waEtPU7XlX8YyuSwjGBTKgtROP6iLIBtQB5h4EVqY0z4mmc7x6tVXI98QuvxZ4r81iPWHovoQ3G44ShLebGK00dEHvV8lS"
}
}
],
"shipping_methods": [
{
"id": "ship_RyWOwmrX6onEa2",
"description": "Domestic",
"provider": "chec",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"countries": [
"US"
],
"regions": {
"US": [
"AL",
"AK",
"AS",
"AZ",
"AR",
"CA",
"CO",
"CT",
"DE",
"DC",
"FL",
"GA",
"GU",
"HI",
"ID",
"IL",
"IN",
"IA",
"KS",
"KY",
"LA",
"ME",
"MD",
"MA",
"MI",
"MN",
"MS",
"MO",
"MT",
"NE",
"NV",
"NH",
"NJ",
"NM",
"NY",
"NC",
"ND",
"MP",
"OH",
"OK",
"OR",
"PA",
"PR",
"RI",
"SC",
"SD",
"TN",
"TX",
"UM",
"UT",
"VT",
"VI",
"VA",
"WA",
"WV",
"WI",
"WY"
]
}
}
],
"live": {
"merchant_id": 32748,
"currency": {
"code": "USD",
"symbol": "$"
},
"subtotal": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"tax": {
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"breakdown": [],
"included_in_price": false,
"zone": [],
"provider": "chec"
},
"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"
},
"adjustments": {
"taxable": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"untaxable": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"total": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
}
},
"giftcard": [],
"total_due": {
"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
},
"line_items": [
{
"id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_bWZ3l89mMOwkpE",
"name": "Oxford loafers",
"product_name": "Oxford loafers",
"media": {
"type": "image",
"source": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"asset_id": "ast_L1vOoZdax4lRa8"
},
"sku": null,
"permalink": "76HgYX",
"quantity": 1,
"price": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"line_total": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"is_valid": true,
"product_meta": [],
"tax": {
"is_taxable": false,
"taxable_amount": null,
"amount": null,
"breakdown": null
},
"selected_options": [],
"variant": null
}
],
"discount": [],
"shipping": {
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"available_options": [
{
"id": "ship_RyWOwmrX6onEa2",
"description": "Domestic",
"provider": "chec",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"countries": [
"US"
],
"regions": {
"US": [
"AL",
"AK",
"AS",
"AZ",
"AR",
"CA",
"CO",
"CT",
"DE",
"DC",
"FL",
"GA",
"GU",
"HI",
"ID",
"IL",
"IN",
"IA",
"KS",
"KY",
"LA",
"ME",
"MD",
"MA",
"MI",
"MN",
"MS",
"MO",
"MT",
"NE",
"NV",
"NH",
"NJ",
"NM",
"NY",
"NC",
"ND",
"MP",
"OH",
"OK",
"OR",
"PA",
"PR",
"RI",
"SC",
"SD",
"TN",
"TX",
"UM",
"UT",
"VT",
"VI",
"VA",
"WA",
"WV",
"WI",
"WY"
]
}
}
]
}
},
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"adjustments": [],
"meta": null
}
Request
GET v1/checkouts/{checkout_token_id}/check/shipping
URL parameters
Name | Status | Description |
---|---|---|
checkout_token_id |
required | The checkout token |
Query parameters
Name | 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 giftcard
Validates a gift card for the provided checkout token, and applies it to the order.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/giftcard?code=ABC-123-ZYX" \
--header "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';
const giftcardCode = 'ABC-123-ZYX';
Commerce.checkout.checkGiftcard(checkoutTokenId, {
code: giftcardCode,
}).then(response => console.log(response.valid, response.credit, response.live));
const url = new URL(
"https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/check/giftcard"
);
const params = {
"code": "ABC-123-ZYX",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.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):
{
"id": "chkt_ql9pzRX339zW45",
"cart_id": "cart_6oLZ1vkBDM38Ol",
"created": 1631119919,
"expires": 1631724719,
"conditionals": {
"collects_fullname": false,
"collects_shipping_address": true,
"collects_billing_address": false,
"has_physical_delivery": true,
"has_digital_delivery": false,
"has_pay_what_you_want": false,
"has_available_discounts": false,
"collects_extra_fields": false,
"is_cart_free": false
},
"collects": {
"fullname": false,
"shipping_address": true,
"billing_address": false,
"extra_fields": false
},
"has": {
"physical_delivery": true,
"digital_delivery": false,
"pay_what_you_want": false,
"available_discounts": false
},
"is": {
"cart_free": false
},
"products": [
{
"id": "prod_bWZ3l89mMOwkpE",
"created": 1630519799,
"updated": 1630519996,
"active": true,
"permalink": "76HgYX",
"name": "Oxford loafers",
"description": "<p>Classic oxford loafers</p>",
"price": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"inventory": {
"managed": false,
"available": 0
},
"media": {
"type": "image",
"source": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"asset_id": "ast_L1vOoZdax4lRa8"
},
"sku": null,
"sort_order": 0,
"seo": {
"title": null,
"description": null
},
"thank_you_url": null,
"meta": null,
"conditionals": {
"is_active": true,
"is_tax_exempt": false,
"is_pay_what_you_want": false,
"is_inventory_managed": false,
"is_sold_out": false,
"has_digital_delivery": false,
"has_physical_delivery": true,
"has_images": true,
"has_video": false,
"has_rich_embed": false,
"collects_fullname": false,
"collects_shipping_address": true,
"collects_billing_address": false,
"collects_extra_fields": false
},
"is": {
"active": true,
"tax_exempt": false,
"pay_what_you_want": false,
"inventory_managed": false,
"sold_out": false
},
"has": {
"digital_delivery": false,
"physical_delivery": true,
"images": true,
"video": false,
"rich_embed": false
},
"collects": {
"fullname": false,
"shipping_address": true,
"billing_address": false,
"extra_fields": false
},
"checkout_url": {
"checkout": "https://checkout.chec.io/76HgYX?checkout=true",
"display": "https://checkout.chec.io/76HgYX"
},
"extra_fields": [],
"variant_groups": [
{
"id": "vgrp_bO6J5a6PLlEjpK",
"name": "Material",
"meta": null,
"created": 1630519859,
"updated": 1630519859,
"options": [
{
"id": "optn_Op1YoVmEywXLv9",
"name": "Leather",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"assets": [],
"meta": null,
"created": 1630519859,
"updated": 1630519996
}
]
}
],
"categories": [],
"assets": [
{
"id": "ast_L1vOoZdax4lRa8",
"url": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"description": null,
"is_image": true,
"filename": "loafers.jpg",
"file_size": 922443,
"file_extension": "jpg",
"image_dimensions": {
"width": 2853,
"height": 2834
},
"meta": [],
"created_at": 1630519989,
"updated_at": 1630519992
}
],
"related_products": []
}
],
"merchant": {
"id": 32748,
"name": "New merchant",
"description": "",
"status": "active",
"country": "US",
"currency": {
"symbol": "$",
"code": "USD"
},
"support_email": "[email protected]",
"logo_shape": null,
"intercom": true,
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"has": {
"logo": false,
"cover": false,
"analytics": false,
"description": false
},
"images": {
"logo": null,
"cover": null
}
},
"extra_fields": [],
"gateways": [
{
"id": "gway_OoZaNX1NBba4wR",
"code": "test_gateway",
"sandbox": true,
"config": []
},
{
"id": "gway_mwDZVm8VRv3W5r",
"code": "stripe",
"sandbox": false,
"config": {
"publishable_key": "pk_test_51Hm1waEtPU7XlX8YyuSwjGBTKgtROP6iLIBtQB5h4EVqY0z4mmc7x6tVXI98QuvxZ4r81iPWHovoQ3G44ShLebGK00dEHvV8lS"
}
}
],
"shipping_methods": [
{
"id": "ship_RyWOwmrX6onEa2",
"description": "Domestic",
"provider": "chec",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"countries": [
"US"
],
"regions": {
"US": [
"AL",
"AK",
"AS",
"AZ",
"AR",
"CA",
"CO",
"CT",
"DE",
"DC",
"FL",
"GA",
"GU",
"HI",
"ID",
"IL",
"IN",
"IA",
"KS",
"KY",
"LA",
"ME",
"MD",
"MA",
"MI",
"MN",
"MS",
"MO",
"MT",
"NE",
"NV",
"NH",
"NJ",
"NM",
"NY",
"NC",
"ND",
"MP",
"OH",
"OK",
"OR",
"PA",
"PR",
"RI",
"SC",
"SD",
"TN",
"TX",
"UM",
"UT",
"VT",
"VI",
"VA",
"WA",
"WV",
"WI",
"WY"
]
}
}
],
"live": {
"merchant_id": 32748,
"currency": {
"code": "USD",
"symbol": "$"
},
"subtotal": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"tax": {
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"breakdown": [],
"included_in_price": false,
"zone": [],
"provider": "chec"
},
"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"
},
"adjustments": {
"taxable": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"untaxable": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"total": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
}
},
"giftcard": [],
"total_due": {
"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
},
"line_items": [
{
"id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_bWZ3l89mMOwkpE",
"name": "Oxford loafers",
"product_name": "Oxford loafers",
"media": {
"type": "image",
"source": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"asset_id": "ast_L1vOoZdax4lRa8"
},
"sku": null,
"permalink": "76HgYX",
"quantity": 1,
"price": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"line_total": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"is_valid": true,
"product_meta": [],
"tax": {
"is_taxable": false,
"taxable_amount": null,
"amount": null,
"breakdown": null
},
"selected_options": [],
"variant": null
}
],
"discount": [],
"shipping": {
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"available_options": [
{
"id": "ship_RyWOwmrX6onEa2",
"description": "Domestic",
"provider": "chec",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"countries": [
"US"
],
"regions": {
"US": [
"AL",
"AK",
"AS",
"AZ",
"AR",
"CA",
"CO",
"CT",
"DE",
"DC",
"FL",
"GA",
"GU",
"HI",
"ID",
"IL",
"IN",
"IA",
"KS",
"KY",
"LA",
"ME",
"MD",
"MA",
"MI",
"MN",
"MS",
"MO",
"MT",
"NE",
"NV",
"NH",
"NJ",
"NM",
"NY",
"NC",
"ND",
"MP",
"OH",
"OK",
"OR",
"PA",
"PR",
"RI",
"SC",
"SD",
"TN",
"TX",
"UM",
"UT",
"VT",
"VI",
"VA",
"WA",
"WV",
"WI",
"WY"
]
}
}
]
}
},
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"adjustments": [],
"meta": null
}
Request
GET v1/checkouts/{checkout_token_id}/check/giftcard
URL parameters
Name | Status | Description |
---|---|---|
checkout_token_id |
required | The checkout token |
Query parameters
Name | Status | Description |
---|---|---|
code |
required | The giftcard code to use |
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 --request GET \
--get "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/helper/shipping_options?country=US®ion=0" \
--header "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';
const country = 'US';
const region = 'CA';
Commerce.checkout.getShippingOptions(checkoutTokenId, {
country: country,
region: region,
}).then(options => console.log(options));
const url = new URL(
"https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/helper/shipping_options"
);
const params = {
"country": "US",
"region": "0",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/helper/shipping_options'
params = {
'country': 'US',
'region': '0',
}
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()
Example response (200):
[
{
"id": "ship_31q0o3e21lDdjR",
"description": "US",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"countries": [
"US"
],
"regions": {
"US": [
"AL",
"AK",
"AS",
"AZ",
"AR"
]
}
},
{
"id": "ship_dKvg9l6vl1bB76",
"description": "CA",
"price": {
"raw": 5,
"formatted": "5.00",
"formatted_with_symbol": "$5.00",
"formatted_with_code": "5.00 USD"
},
"countries": [
"CA"
],
"regions": {
"CA": [
"AB",
"BC",
"MB",
"ON",
"QC"
]
}
}
]
Request
GET v1/checkouts/{checkout_token_id}/helper/shipping_options
URL parameters
Name | Status | Description |
---|---|---|
checkout_token_id |
required | The checkout token |
Query parameters
Name | Status | Description |
---|---|---|
country |
required | The shipping country of the customer (a valid ISO 3166-1 alpha-2 country code) |
region |
optional | optional Required if regional shipping rates are enabled. Must be a valid short code for the region, e.g. CA for California or QB for Quebec. See helper "List all subdivisions for a country" |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The ID of the shipping method |
description |
string | A description of the shipping method Example: Domestic |
price |
object | Price The cost of the shipping method |
country.* |
string | Countries (a valid ISO 3166-1 alpha-2 country code) that this shipping method is valid for |
Set tax zone
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 --request GET \
--get "https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/helper/set_tax_zone?ip_address=&country=0®ion=CA&postal_zip_code=94107" \
--header "X-Authorization: {token}"
const checkoutTokenId = 'chkt_L5z3kmQpdpkGlA';
const country = 'US';
const region = 'CA';
const postCode = '94107'
Commerce.checkout.setTaxZone(checkoutTokenId, {
country: country,
region: region,
postal_zip_code: postCode,
}).then(response => console.log(response.valid, response.live));
const url = new URL(
"https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/helper/set_tax_zone"
);
const params = {
"ip_address": "",
"country": "0",
"region": "CA",
"postal_zip_code": "94107",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/checkouts/chkt_L5z3kmQpdpkGlA/helper/set_tax_zone'
params = {
'ip_address': '',
'country': '0',
'region': 'CA',
'postal_zip_code': '94107',
}
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()
Example response (200):
{
"id": "chkt_ql9pzRX339zW45",
"cart_id": "cart_6oLZ1vkBDM38Ol",
"created": 1631119919,
"expires": 1631724719,
"conditionals": {
"collects_fullname": false,
"collects_shipping_address": true,
"collects_billing_address": false,
"has_physical_delivery": true,
"has_digital_delivery": false,
"has_pay_what_you_want": false,
"has_available_discounts": false,
"collects_extra_fields": false,
"is_cart_free": false
},
"collects": {
"fullname": false,
"shipping_address": true,
"billing_address": false,
"extra_fields": false
},
"has": {
"physical_delivery": true,
"digital_delivery": false,
"pay_what_you_want": false,
"available_discounts": false
},
"is": {
"cart_free": false
},
"products": [
{
"id": "prod_bWZ3l89mMOwkpE",
"created": 1630519799,
"updated": 1630519996,
"active": true,
"permalink": "76HgYX",
"name": "Oxford loafers",
"description": "<p>Classic oxford loafers</p>",
"price": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"inventory": {
"managed": false,
"available": 0
},
"media": {
"type": "image",
"source": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"asset_id": "ast_L1vOoZdax4lRa8"
},
"sku": null,
"sort_order": 0,
"seo": {
"title": null,
"description": null
},
"thank_you_url": null,
"meta": null,
"conditionals": {
"is_active": true,
"is_tax_exempt": false,
"is_pay_what_you_want": false,
"is_inventory_managed": false,
"is_sold_out": false,
"has_digital_delivery": false,
"has_physical_delivery": true,
"has_images": true,
"has_video": false,
"has_rich_embed": false,
"collects_fullname": false,
"collects_shipping_address": true,
"collects_billing_address": false,
"collects_extra_fields": false
},
"is": {
"active": true,
"tax_exempt": false,
"pay_what_you_want": false,
"inventory_managed": false,
"sold_out": false
},
"has": {
"digital_delivery": false,
"physical_delivery": true,
"images": true,
"video": false,
"rich_embed": false
},
"collects": {
"fullname": false,
"shipping_address": true,
"billing_address": false,
"extra_fields": false
},
"checkout_url": {
"checkout": "https://checkout.chec.io/76HgYX?checkout=true",
"display": "https://checkout.chec.io/76HgYX"
},
"extra_fields": [],
"variant_groups": [
{
"id": "vgrp_bO6J5a6PLlEjpK",
"name": "Material",
"meta": null,
"created": 1630519859,
"updated": 1630519859,
"options": [
{
"id": "optn_Op1YoVmEywXLv9",
"name": "Leather",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"assets": [],
"meta": null,
"created": 1630519859,
"updated": 1630519996
}
]
}
],
"categories": [],
"assets": [
{
"id": "ast_L1vOoZdax4lRa8",
"url": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"description": null,
"is_image": true,
"filename": "loafers.jpg",
"file_size": 922443,
"file_extension": "jpg",
"image_dimensions": {
"width": 2853,
"height": 2834
},
"meta": [],
"created_at": 1630519989,
"updated_at": 1630519992
}
],
"related_products": []
}
],
"merchant": {
"id": 32748,
"name": "New merchant",
"description": "",
"status": "active",
"country": "US",
"currency": {
"symbol": "$",
"code": "USD"
},
"support_email": "[email protected]",
"logo_shape": null,
"intercom": true,
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"has": {
"logo": false,
"cover": false,
"analytics": false,
"description": false
},
"images": {
"logo": null,
"cover": null
}
},
"extra_fields": [],
"gateways": [
{
"id": "gway_OoZaNX1NBba4wR",
"code": "test_gateway",
"sandbox": true,
"config": []
},
{
"id": "gway_mwDZVm8VRv3W5r",
"code": "stripe",
"sandbox": false,
"config": {
"publishable_key": "pk_test_51Hm1waEtPU7XlX8YyuSwjGBTKgtROP6iLIBtQB5h4EVqY0z4mmc7x6tVXI98QuvxZ4r81iPWHovoQ3G44ShLebGK00dEHvV8lS"
}
}
],
"shipping_methods": [
{
"id": "ship_RyWOwmrX6onEa2",
"description": "Domestic",
"provider": "chec",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"countries": [
"US"
],
"regions": {
"US": [
"AL",
"AK",
"AS",
"AZ",
"AR",
"CA",
"CO",
"CT",
"DE",
"DC",
"FL",
"GA",
"GU",
"HI",
"ID",
"IL",
"IN",
"IA",
"KS",
"KY",
"LA",
"ME",
"MD",
"MA",
"MI",
"MN",
"MS",
"MO",
"MT",
"NE",
"NV",
"NH",
"NJ",
"NM",
"NY",
"NC",
"ND",
"MP",
"OH",
"OK",
"OR",
"PA",
"PR",
"RI",
"SC",
"SD",
"TN",
"TX",
"UM",
"UT",
"VT",
"VI",
"VA",
"WA",
"WV",
"WI",
"WY"
]
}
}
],
"live": {
"merchant_id": 32748,
"currency": {
"code": "USD",
"symbol": "$"
},
"subtotal": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"tax": {
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"breakdown": [],
"included_in_price": false,
"zone": [],
"provider": "chec"
},
"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"
},
"adjustments": {
"taxable": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"untaxable": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"total": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
}
},
"giftcard": [],
"total_due": {
"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
},
"line_items": [
{
"id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_bWZ3l89mMOwkpE",
"name": "Oxford loafers",
"product_name": "Oxford loafers",
"media": {
"type": "image",
"source": "https://cdn.chec.io/merchants/32748/assets/AG3EUotYqG4dfDlM|loafers.jpg",
"asset_id": "ast_L1vOoZdax4lRa8"
},
"sku": null,
"permalink": "76HgYX",
"quantity": 1,
"price": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"line_total": {
"raw": 110,
"formatted": "110.00",
"formatted_with_symbol": "$110.00",
"formatted_with_code": "110.00 USD"
},
"is_valid": true,
"product_meta": [],
"tax": {
"is_taxable": false,
"taxable_amount": null,
"amount": null,
"breakdown": null
},
"selected_options": [],
"variant": null
}
],
"discount": [],
"shipping": {
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"available_options": [
{
"id": "ship_RyWOwmrX6onEa2",
"description": "Domestic",
"provider": "chec",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"countries": [
"US"
],
"regions": {
"US": [
"AL",
"AK",
"AS",
"AZ",
"AR",
"CA",
"CO",
"CT",
"DE",
"DC",
"FL",
"GA",
"GU",
"HI",
"ID",
"IL",
"IN",
"IA",
"KS",
"KY",
"LA",
"ME",
"MD",
"MA",
"MI",
"MN",
"MS",
"MO",
"MT",
"NE",
"NV",
"NH",
"NJ",
"NM",
"NY",
"NC",
"ND",
"MP",
"OH",
"OK",
"OR",
"PA",
"PR",
"RI",
"SC",
"SD",
"TN",
"TX",
"UM",
"UT",
"VT",
"VI",
"VA",
"WA",
"WV",
"WI",
"WY"
]
}
}
]
}
},
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"adjustments": [],
"meta": null
}
Request
GET v1/checkouts/{checkout_token_id}/helper/set_tax_zone
URL parameters
Name | Status | Description |
---|---|---|
checkout_token_id |
required | The checkout token |
Query parameters
Name | Status | Description |
---|---|---|
ip_address |
required | Only if using IP address to set the tax location. This will set the tax location to the estimated geographic location from this IP address. |
country |
required | Only 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 |
required | Only 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 |
required | Only 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 --request GET \
--get "https://api.chec.io/v1/services/locale/countries" \
--header "X-Authorization: {token}"
Commerce.services.localeListCountries().then(response => console.log(response.countries));
const url = new URL(
"https://api.chec.io/v1/services/locale/countries"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.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>"
}
Request
GET v1/services/locale/countries
Response
Response fields
Name | Type | Description |
---|---|---|
countries |
object | An object of all countries where keys are ISO 3166-1 alpha-2 country codes and values are full names of the countries |
html |
string | A string of all countries compiled into HTML option tags where the values are ISO 3166-1 alpha-2 country codes |
List all subdivisions for a country
Given a valid country code, returns a list of all subdivisions (states, provinces, or regions) for that country. See "List available shipping subdivisions for country" for an equivalent list of subdivisions that can be shipped to for your account.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/services/locale/0/subdivisions" \
--header "X-Authorization: {token}"
const country = 'US';
Commerce.services.localeListSubdivisions(country).then(response => console.log(response.subdivisions));
const url = new URL(
"https://api.chec.io/v1/services/locale/0/subdivisions"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/services/locale/0/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>"
}
Request
GET v1/services/locale/{country_code}/subdivisions
URL parameters
Name | Status | Description |
---|---|---|
country_code |
required | Must be a valid ISO 3166-1 alpha-2 country code (e.g. GB - United Kingdom) |
Response
Response fields
Name | Type | Description |
---|---|---|
countries |
object | An object of all countries where keys are ISO 3166-2 subdivision codes and values are full names of the subdivisions |
html |
string | A string of all subdivisions compiled into HTML option tags where the values are ISO 3166-2 subdivision codes |
List available shipping countries
Returns only the countries which can be shipped to for the current checkout.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/services/locale/chkt_L5z3kmQpdpkGlA/countries" \
--header "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/services/locale/chkt_L5z3kmQpdpkGlA/countries"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.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>"
}
Request
GET v1/services/locale/{checkout_token_id}/countries
URL parameters
Name | Status | Description |
---|---|---|
checkout_token_id |
required | The checkout token |
Response
Response fields
Name | Type | Description |
---|---|---|
countries |
object | An object of all countries where keys are ISO 3166-1 alpha-2 country codes and values are full names of the countries |
html |
string | A string of all countries compiled into HTML option tags where the values are ISO 3166-1 alpha-2 country codes |
List available shipping subdivisions for country
Returns only the subdivisions (states, provinces, or regions) in a country which can be shipped to for the current checkout.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/services/locale/chkt_L5z3kmQpdpkGlA/countries/0/subdivisions" \
--header "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/services/locale/chkt_L5z3kmQpdpkGlA/countries/0/subdivisions"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/services/locale/chkt_L5z3kmQpdpkGlA/countries/0/subdivisions'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"subdivisions": {
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado"
},
"html": "<option value=\"AL\">Alabama</option><option value=\"AK\">Alaska</option><option value=\"AS\">American Samoa</option><option value=\"AZ\">Arizona</option><option value=\"AR\">Arkansas</option><option value=\"CA\">California</option><option value=\"CO\">Colorado</option>"
}
Request
GET v1/services/locale/{checkout_token_id}/countries/{country_code}/subdivisions
URL parameters
Name | Status | Description |
---|---|---|
checkout_token_id |
required | The checkout token |
country_code |
required | Must be a valid ISO 3166-1 alpha-2 country code (e.g. GB - United Kingdom) |
Response
Response fields
Name | Type | Description |
---|---|---|
countries |
object | An object of all countries where keys are ISO 3166-2 subdivision codes and values are full names of the subdivisions |
html |
string | A string of all subdivisions compiled into HTML option tags where the values are ISO 3166-2 subdivision codes |
Customers
Issue and send login token
This endpoint accepts an email
argument which is used to resolve a customer in your account and send them
a one-click login email. The email will contain a link (based off of the base_url
argument) which contains
a short-lived login token.
When the user opens the token link, the token will be exchanged for a JSON web token which is scoped to that particular customer, and has permission to access that customer's orders, addresses, etc.
Tokens are valid for 30 minutes from when they are issued. Issuing subsequent tokens will automatically revoke previously issued tokens.
Example request:
curl --request POST \
"https://api.chec.io/v1/customers/email-token" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"email\": \"[email protected]\",
\"base_url\": \"https:\\/\\/checkout.chec.io\\/login\\/:token:\"
}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/customers/email-token"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/customers/email-token'
payload = {
"email": "[email protected]",
"base_url": "https:\/\/checkout.chec.io\/login\/:token:"
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (201):
{
"success": true,
"email": "[email protected]"
}
Request
POST v1/customers/email-token
Body parameters
Name | Type | Status | Description |
---|---|---|---|
email |
string | required | The email address for the customer |
base_url |
string | required | The base URL to attach the token to. Use |
Exchange login token for JWT
Obtain a JSON web token scoped to the customer the provided token belongs to. The returned JWT will be valid for 24 hours, and may be used to authorize API calls to the "Customers" API endpoints, such as "get orders", etc.
Example request:
curl --request POST \
"https://api.chec.io/v1/customers/exchange-token" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"token\": \"1ae420a5-2f43-426f-8a61-516eabb56d33\"
}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/customers/exchange-token"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/customers/exchange-token'
payload = {
"token": "1ae420a5-2f43-426f-8a61-516eabb56d33"
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"customer_id": "cstmr_VNplJa1EaYwL60",
"jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
Request
POST v1/customers/exchange-token
Body parameters
Name | Type | Status | Description |
---|---|---|---|
token |
string | required | Login token for a customer |
List orders for customer
Returns a list of orders that belong to the provided customer ID. The response from this API is the same as "List orders".
Example request:
curl --request GET \
--get "https://api.chec.io/v1/customers/cstmr_f89398fs489g/orders" \
--header "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/customers/cstmr_f89398fs489g/orders"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/customers/cstmr_f89398fs489g/orders'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
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": "[email protected]"
},
"extrafields": [
{
"id": "extr_7RyWOwmK5nEa2V",
"name": "Test",
"value": "Test",
"required": true
},
{
"id": "extr_1ypbroE658n4ea",
"name": "Website",
"value": "commercejs.com",
"required": false
}
],
"shipping": {
"name": "John Doe",
"street": "123 Fake St",
"town_city": "San Francisco",
"county_state": "CA",
"postal_zip_code": "94103",
"country": "US"
},
"billing": null,
"order": {
"line_items": [
{
"id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_4VPvL5zRQ5AQkX",
"product_name": "Cart Debug Digital + Physical",
"quantity": 1,
"price": {
"raw": 1,
"formatted": "1.00",
"formatted_with_symbol": "$1.00",
"formatted_with_code": "1.00 USD"
},
"line_total": {
"raw": 31,
"formatted": "31.00",
"formatted_with_symbol": "$31.00",
"formatted_with_code": "31.00 USD"
},
"variants": [
{
"variant_id": "vrnt_kpnNwAyBrwmXB3",
"option_id": "optn_PAYrQlWDbwnbR4",
"variant_name": "Variant #2",
"option_name": "Option 2",
"price": {
"raw": 20,
"formatted": "20.00",
"formatted_with_symbol": "20.00",
"formatted_with_code": "20.00 "
}
},
{
"variant_id": "vrnt_Kvg9l6Apq51bB7",
"option_id": "optn_r31q0o3E8lDdjR",
"variant_name": "Variant #1",
"option_name": "Option 2",
"price": {
"raw": 10,
"formatted": "10.00",
"formatted_with_symbol": "10.00",
"formatted_with_code": "10.00 "
}
}
],
"is_taxable": true,
"taxable_amount": {
"raw": 31,
"formatted": "31.00",
"formatted_with_symbol": "$31.00",
"formatted_with_code": "31.00 USD"
},
"tax_rate": 0.0875,
"tax_rate_percentage": "8.75%",
"tax_amount": {
"raw": 2.72,
"formatted": "2.72",
"formatted_with_symbol": "$2.72",
"formatted_with_code": "2.72 USD"
},
"tax_lines": [
{
"amount": {
"raw": 1.94,
"formatted": "1.94",
"formatted_with_symbol": "$1.94",
"formatted_with_code": "1.94 USD"
},
"rate": 0.0625,
"rate_percentage": "6.25%",
"type": "state"
},
{
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"rate": 0,
"rate_percentage": "0%",
"type": "city"
},
{
"amount": {
"raw": 0.08,
"formatted": "0.08",
"formatted_with_symbol": "$0.08",
"formatted_with_code": "0.08 USD"
},
"rate": 0.0025,
"rate_percentage": "0.25%",
"type": "county"
},
{
"amount": {
"raw": 0.7,
"formatted": "0.70",
"formatted_with_symbol": "$0.70",
"formatted_with_code": "0.70 USD"
},
"rate": 0.0225,
"rate_percentage": "2.25%",
"type": "district"
}
]
},
{
"id": "item_1ypbroE658n4ea",
"product_id": "prod_2yA6nldRBoEWbz",
"product_name": "Cart Debug W/ Shipping",
"quantity": 1,
"price": {
"raw": 11,
"formatted": "11.00",
"formatted_with_symbol": "$11.00",
"formatted_with_code": "11.00 USD"
},
"line_total": {
"raw": 11,
"formatted": "11.00",
"formatted_with_symbol": "$11.00",
"formatted_with_code": "11.00 USD"
},
"variants": [],
"is_taxable": true,
"taxable_amount": {
"raw": 11,
"formatted": "11.00",
"formatted_with_symbol": "$11.00",
"formatted_with_code": "11.00 USD"
},
"tax_rate": 0.0875,
"tax_rate_percentage": "8.75%",
"tax_amount": {
"raw": 0.97,
"formatted": "0.97",
"formatted_with_symbol": "$0.97",
"formatted_with_code": "0.97 USD"
},
"tax_lines": [
{
"amount": {
"raw": 0.69,
"formatted": "0.69",
"formatted_with_symbol": "$0.69",
"formatted_with_code": "0.69 USD"
},
"rate": 0.0625,
"rate_percentage": "6.25%",
"type": "state"
},
{
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"rate": 0,
"rate_percentage": "0%",
"type": "city"
},
{
"amount": {
"raw": 0.03,
"formatted": "0.03",
"formatted_with_symbol": "$0.03",
"formatted_with_code": "0.03 USD"
},
"rate": 0.0025,
"rate_percentage": "0.25%",
"type": "county"
},
{
"amount": {
"raw": 0.25,
"formatted": "0.25",
"formatted_with_symbol": "$0.25",
"formatted_with_code": "0.25 USD"
},
"rate": 0.0225,
"rate_percentage": "2.25%",
"type": "district"
}
]
},
{
"id": "item_dKvg9l6vl1bB76",
"product_id": "prod_Ekd6Ll2KYwV2mj",
"product_name": "Cart Debug",
"quantity": 1,
"price": {
"raw": 12,
"formatted": "12.00",
"formatted_with_symbol": "$12.00",
"formatted_with_code": "12.00 USD"
},
"line_total": {
"raw": 12,
"formatted": "12.00",
"formatted_with_symbol": "$12.00",
"formatted_with_code": "12.00 USD"
},
"variants": [],
"is_taxable": false,
"taxable_amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"tax_rate": null,
"tax_rate_percentage": null,
"tax_amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"tax_lines": null
}
],
"subtotal": {
"raw": 54,
"formatted": "54.00",
"formatted_with_symbol": "$54.00",
"formatted_with_code": "54.00 USD"
},
"discount": [],
"shipping": {
"id": "ship_31q0o3e21lDdjR",
"description": "USPS",
"price": {
"raw": 0.99,
"formatted": "0.99",
"formatted_with_symbol": "$0.99",
"formatted_with_code": "0.99 USD"
}
},
"tax": {
"amount": {
"raw": 3.69,
"formatted": "3.69",
"formatted_with_symbol": "$3.69",
"formatted_with_code": "3.69 USD"
},
"included_in_price": false,
"breakdown": [
{
"amount": {
"raw": 2.63,
"formatted": "2.63",
"formatted_with_symbol": "$2.63",
"formatted_with_code": "2.63 USD"
},
"rate": 0.0625,
"rate_percentage": "6.25%",
"type": "state"
},
{
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"rate": 0,
"rate_percentage": "0%",
"type": "city"
},
{
"amount": {
"raw": 0.11,
"formatted": "0.11",
"formatted_with_symbol": "$0.11",
"formatted_with_code": "0.11 USD"
},
"rate": 0.0025,
"rate_percentage": "0.25%",
"type": "county"
},
{
"amount": {
"raw": 0.95,
"formatted": "0.95",
"formatted_with_symbol": "$0.95",
"formatted_with_code": "0.95 USD"
},
"rate": 0.0225,
"rate_percentage": "2.25%",
"type": "district"
}
],
"zone": {
"country": "US",
"region": "CA",
"postal_zip_code": "94103",
"ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
}
},
"total": {
"raw": 54.99,
"formatted": "54.99",
"formatted_with_symbol": "$54.99",
"formatted_with_code": "54.99 USD"
},
"total_with_tax": {
"raw": 58.68,
"formatted": "58.68",
"formatted_with_symbol": "$58.68",
"formatted_with_code": "58.68 USD"
},
"pay_what_you_want": {
"enabled": true,
"minimum": {
"raw": 58.68,
"formatted": "58.68",
"formatted_with_symbol": "$58.68",
"formatted_with_code": "58.68 USD"
},
"customer_set_price": {
"raw": 100,
"formatted": "100.00",
"formatted_with_symbol": "$100.00",
"formatted_with_code": "100.00 USD"
}
}
},
"tax": {
"provider": "chec",
"provider_type": "native",
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"included_in_price": false,
"breakdown": [
{
"amount": {
"raw": 2.63,
"formatted": "2.63",
"formatted_with_symbol": "$2.63",
"formatted_with_code": "2.63 USD"
},
"rate": 0.0625,
"rate_percentage": "6.25%",
"type": "state"
},
{
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"rate": 0,
"rate_percentage": "0%",
"type": "city"
},
{
"amount": {
"raw": 0.11,
"formatted": "0.11",
"formatted_with_symbol": "$0.11",
"formatted_with_code": "0.11 USD"
},
"rate": 0.0025,
"rate_percentage": "0.25%",
"type": "county"
},
{
"amount": {
"raw": 0.95,
"formatted": "0.95",
"formatted_with_symbol": "$0.95",
"formatted_with_code": "0.95 USD"
},
"rate": 0.0225,
"rate_percentage": "2.25%",
"type": "district"
}
],
"zone": {
"country": "US",
"region": "CA",
"postal_zip_code": "94103",
"ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
}
},
"payments": [
{
"id": "pymnt_20icw2ZVLRq4",
"gateway_transaction_id": "ch_19HLUQDm0vyxCdYanLOHURDE",
"created": 1479510590,
"type": "card",
"kind": "sale",
"gateway": "stripe",
"reference": 4242,
"amount": {
"raw": 100,
"formatted": "100.00",
"formatted_with_symbol": "$100.00",
"formatted_with_code": "100.00 USD"
},
"currency": {
"code": "USD",
"symbol": "$"
},
"is_refunded": false,
"refund_date": null,
"payment_source": {
"brand": "Visa",
"country": "US",
"billing_zip_postal_code": "12345",
"tax_billing_country": "US"
}
}
],
"refunds": [],
"fulfillment": {
"shipping": {
"id": "ful_j0YnEoq65e7P61",
"description": "USPS",
"price": {
"raw": 0.99,
"formatted": "0.99",
"formatted_with_symbol": "$0.99",
"formatted_with_code": "0.99 USD"
},
"shipping_method_id": "ship_31q0o3e21lDdjR",
"provider": "chec",
"provider_type": "native_shipping",
"shipped_on": null,
"carrier": null,
"tracking_number": null,
"tracking_url": null
},
"digital": [
{
"provider": "chec",
"provider_type": "native_digital",
"line_item_id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_4VPvL5zRQ5AQkX",
"product_name": "Cart Debug Digital + Physical",
"packages": [
{
"id": "ful_Ekd6Ll2zlV2mjK",
"name": "commerce-js-example.html",
"access_link": "http://api.chec.dev/fulfill/ord_p7ZAMo1xwNJ4xX/ful_Ekd6Ll2zlV2mjK",
"ext": "HTML",
"size": "10.44 KB",
"size_in_bytes": "10694"
}
],
"lifespan": {
"expires": false,
"expiry_date": null,
"duration": null,
"period": null,
"download_limit": "unlimited",
"human": "Download links do not expire, and can be accessed unlimited time(s)"
},
"is_expired": false,
"is_access_revoked": false,
"remaining_attempts": null
}
]
},
"conditionals": {
"collected_fullname": false,
"collected_shipping_address": true,
"collected_billing_address": false,
"collected_extrafields": true,
"collected_tax": true,
"collected_eu_vat_moss_evidence": false,
"has_physical_fulfillent": true,
"has_digital_fulfillment": true,
"has_extend_fulfillment": false,
"has_webhook_fulfillment": false,
"has_extend_apps": false,
"has_pay_what_you_want": true,
"has_discounts": false,
"has_subscription_items": true,
"is_free": false,
"is_fulfilled": false,
"is_refunded": false
},
"client_details": {
"ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb",
"country_code": "US",
"country_name": "United States",
"region_code": "CA",
"region_name": "California",
"city": "San Francisco",
"postal_zip_code": "94103"
},
"metadata": []
}
],
"meta": {
"pagination": {
"total": 21,
"count": 1,
"per_page": 1,
"current_page": 1,
"total_pages": 21,
"links": {
"next": "http://api.chec.dev/v1/orders?limit=1&page=2"
}
}
}
}
Request
GET v1/customers/{customer_id}/orders
URL parameters
Name | Status | Description |
---|---|---|
customer_id |
required | The customer ID |
Get order for customer
Returns a single order by its ID which belongs to the customer ID provided. The response from this API is the same as "Retrieve order".
Example request:
curl --request GET \
--get "https://api.chec.io/v1/customers/cstmr_f89398fs489g/orders/ord_Kvg9l6zvnl1bB7" \
--header "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/customers/cstmr_f89398fs489g/orders/ord_Kvg9l6zvnl1bB7"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/customers/cstmr_f89398fs489g/orders/ord_Kvg9l6zvnl1bB7'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
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": "[email protected]"
},
"extra_fields": [
{
"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": {
"raw": 0.99,
"formatted": "0.99",
"formatted_with_symbol": "$0.99",
"formatted_with_code": "0.99 USD"
}
},
"tax": {
"amount": {
"raw": 3.69,
"formatted": "3.69",
"formatted_with_symbol": "$3.69",
"formatted_with_code": "3.69 USD"
},
"included_in_price": false,
"breakdown": [
{
"amount": {
"raw": 2.63,
"formatted": "2.63",
"formatted_with_symbol": "$2.63",
"formatted_with_code": "2.63 USD"
},
"rate": 0.0625,
"rate_percentage": "6.25%",
"type": "state"
},
{
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"rate": 0,
"rate_percentage": "0%",
"type": "city"
},
{
"amount": {
"raw": 0.11,
"formatted": "0.11",
"formatted_with_symbol": "$0.11",
"formatted_with_code": "0.11 USD"
},
"rate": 0.0025,
"rate_percentage": "0.25%",
"type": "county"
},
{
"amount": {
"raw": 0.95,
"formatted": "0.95",
"formatted_with_symbol": "$0.95",
"formatted_with_code": "0.95 USD"
},
"rate": 0.0225,
"rate_percentage": "2.25%",
"type": "district"
}
],
"zone": {
"country": "US",
"region": "CA",
"postal_zip_code": "94103",
"ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
}
},
"total": {
"raw": 54.99,
"formatted": "54.99",
"formatted_with_symbol": "$54.99",
"formatted_with_code": "54.99 USD"
},
"total_with_tax": {
"raw": 58.68,
"formatted": "58.68",
"formatted_with_symbol": "$58.68",
"formatted_with_code": "58.68 USD"
},
"pay_what_you_want": {
"enabled": true,
"minimum": {
"raw": 58.68,
"formatted": "58.68",
"formatted_with_symbol": "$58.68",
"formatted_with_code": "58.68 USD"
},
"customer_set_price": {
"raw": 100,
"formatted": "100.00",
"formatted_with_symbol": "$100.00",
"formatted_with_code": "100.00 USD"
}
}
},
"tax": {
"provider": "chec",
"provider_type": "native",
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"included_in_price": false,
"breakdown": [
{
"amount": {
"raw": 2.63,
"formatted": "2.63",
"formatted_with_symbol": "$2.63",
"formatted_with_code": "2.63 USD"
},
"rate": 0.0625,
"rate_percentage": "6.25%",
"type": "state"
},
{
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"rate": 0,
"rate_percentage": "0%",
"type": "city"
},
{
"amount": {
"raw": 0.11,
"formatted": "0.11",
"formatted_with_symbol": "$0.11",
"formatted_with_code": "0.11 USD"
},
"rate": 0.0025,
"rate_percentage": "0.25%",
"type": "county"
},
{
"amount": {
"raw": 0.95,
"formatted": "0.95",
"formatted_with_symbol": "$0.95",
"formatted_with_code": "0.95 USD"
},
"rate": 0.0225,
"rate_percentage": "2.25%",
"type": "district"
}
],
"zone": {
"country": "US",
"region": "CA",
"postal_zip_code": "94103",
"ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
}
},
"payments": [
{
"id": "pymnt_20icw2ZVLRq4",
"gateway_transaction_id": "ch_19HLUQDm0vyxCdYanLOHURDE",
"created": 1479510590,
"type": "card",
"kind": "sale",
"gateway": "stripe",
"reference": 4242,
"amount": {
"raw": 100,
"formatted": "100.00",
"formatted_with_symbol": "$100.00",
"formatted_with_code": "100.00 USD"
},
"currency": {
"code": "USD",
"symbol": "$"
},
"is_refunded": false,
"refund_date": null,
"payment_source": {
"brand": "Visa",
"country": "US",
"billing_zip_postal_code": "12345",
"tax_billing_country": "US"
}
}
],
"refunds": [],
"fulfillment": {
"shipping": {
"id": "ful_j0YnEoq65e7P61",
"description": "USPS",
"price": {
"raw": 0.99,
"formatted": "0.99",
"formatted_with_symbol": "$0.99",
"formatted_with_code": "0.99 USD"
},
"shipping_method_id": "ship_31q0o3e21lDdjR",
"provider": "chec",
"provider_type": "native_shipping",
"shipped_on": null,
"carrier": null,
"tracking_number": null,
"tracking_url": null
},
"digital": [
{
"provider": "chec",
"provider_type": "native_digital",
"line_item_id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_4VPvL5zRQ5AQkX",
"product_name": "Cart Debug Digital + Physical",
"packages": [
{
"id": "ful_Ekd6Ll2zlV2mjK",
"name": "commerce-js-example.html",
"access_link": "http://api.chec.dev/fulfill/ord_p7ZAMo1xwNJ4xX/ful_Ekd6Ll2zlV2mjK",
"ext": "HTML",
"size": "10.44 KB",
"size_in_bytes": "10694"
}
],
"lifespan": {
"expires": false,
"expiry_date": null,
"duration": null,
"period": null,
"download_limit": "unlimited",
"human": "Download links do not expire, and can be accessed unlimited time(s)"
},
"is_expired": false,
"is_access_revoked": false,
"remaining_attempts": null
}
]
},
"conditionals": {
"collected_fullname": false,
"collected_shipping_address": true,
"collected_billing_address": false,
"collected_extrafields": true,
"collected_tax": true,
"collected_eu_vat_moss_evidence": false,
"has_physical_fulfillent": true,
"has_digital_fulfillment": true,
"has_extend_fulfillment": false,
"has_webhook_fulfillment": false,
"has_extend_apps": false,
"has_pay_what_you_want": true,
"has_discounts": false,
"has_subscription_items": true,
"is_free": false,
"is_fulfilled": false,
"is_refunded": false
},
"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": []
}
Request
GET v1/customers/{customer_id}/orders/{order_id}
URL parameters
Name | Status | Description |
---|---|---|
customer_id |
required | The customer ID |
order_id |
required | The order ID |
Get customer
Returns a customer by it's ID.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6" \
--header "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"id": "cstmr_VNplJa1EaYwL60",
"external_id": "MY_CRM_ID_123",
"firstname": "Mary",
"lastname": "Malleable",
"email": "[email protected]",
"phone": "+1 987 789 6543",
"meta": {
"utm_campaign": "summer"
},
"created": 1601579509,
"updated": 1601579509
}
Request
GET v1/customers/{customer_id}
URL parameters
Name | Status | Description |
---|---|---|
customer_id |
required | The customer's ID |
Update customer
Update an existing customer. All fields in this request are optional. Email addresses must be unique for your merchant's list of customers.
Example request:
curl --request PUT \
"https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"email\": \"[email protected]\",
\"phone\": \"+1 987 654 3210\",
\"firstname\": \"Leslie\",
\"lastname\": \"Lawless\",
\"external_id\": \"MY_CRM_USER_123\"
}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6'
payload = {
"email": "[email protected]",
"phone": "+1 987 654 3210",
"firstname": "Leslie",
"lastname": "Lawless",
"external_id": "MY_CRM_USER_123"
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"id": "cstmr_VNplJa1EaYwL60",
"external_id": null,
"firstname": "Dario",
"lastname": "Dancer",
"email": "[email protected]",
"phone": "+1 987 654 3210",
"meta": {
"utm_campaign": "winter"
},
"created": 1601579752,
"updated": 1587399600
}
Request
PUT v1/customers/{customer_id}
URL parameters
Name | Status | Description |
---|---|---|
customer_id |
required | The customer's ID |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
email |
string | optional | The customer's email address, must be unique |
phone |
string | optional | The customer's phone number |
firstname |
string | optional | The customer's firstname |
lastname |
string | optional | The customer's lastname/surname |
external_id |
string | optional | An optional ID for external systems |
meta |
object | optional | Optional metadata to store on the customer |
List addresses for customer
Returns a list of addresses that belong to the provided customer ID.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/customers/cstmr_f89398fs489g/addresses" \
--header "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/customers/cstmr_f89398fs489g/addresses"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/customers/cstmr_f89398fs489g/addresses'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"data": [
{
"id": "adrs_LkpnNwAxlmXB3b",
"name": "Jack Ryan",
"street": "456 Brock St",
"street_2": "suite 2",
"town_city": "Hollywood",
"postal_zip_code": "90210",
"county_state": "CA",
"country": "US",
"default_billing": false,
"default_shipping": true,
"meta": {
"requires_signature": 1
},
"created": 1577934245,
"updated": 1577937906
},
{
"id": "adrs_1ypbroE658n4ea",
"name": "Jack Ryan",
"street": "123 Center St",
"street_2": "Floor 9",
"town_city": "Hollywood",
"postal_zip_code": "90210",
"county_state": "CA",
"country": "US",
"default_billing": true,
"default_shipping": false,
"meta": {
"requires_signature": 0
},
"created": 1577934245,
"updated": 1577937906
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 20,
"current_page": 1,
"total_pages": 1,
"links": []
}
}
}
Request
GET v1/customers/{customer_id}/addresses
URL parameters
Name | Status | Description |
---|---|---|
customer_id |
required | The customer ID |
Get address for customer
Example request:
curl --request GET \
--get "https://api.chec.io/v1/customers/cstmr_f89398fs489g/addresses/adrs_Kvg9l6zvnl1bB7" \
--header "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/customers/cstmr_f89398fs489g/addresses/adrs_Kvg9l6zvnl1bB7"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/customers/cstmr_f89398fs489g/addresses/adrs_Kvg9l6zvnl1bB7'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"id": "adrs_LkpnNwAxlmXB3b",
"name": "Jack Ryan",
"street": "456 Washington St",
"street_2": "suite 2",
"town_city": "Hollywood",
"postal_zip_code": "90210",
"county_state": "CA",
"country": "US",
"default_billing": false,
"default_shipping": true,
"meta": {
"requires_signature": 1
},
"created": 1577934245,
"updated": 1577937906
}
Request
GET v1/customers/{customer_id}/addresses/{address_id}
URL parameters
Name | Status | Description |
---|---|---|
customer_id |
required | The customer ID |
address_id |
required | The address ID |
Create an address for customer
Create a new address and assign it to the provided customer.
Example request:
curl --request POST \
"https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6/addresses" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"name\": \"Johnny Doe\",
\"street\": \"123 Fake St\",
\"street_2\": \"Floor 2\",
\"town_city\": \"San Francisco\",
\"county_state\": \"CA\",
\"postal_zip_code\": \"94103\",
\"country\": \"US\",
\"default_billing\": true,
\"default_shipping\": false
}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6/addresses"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6/addresses'
payload = {
"name": "Johnny Doe",
"street": "123 Fake St",
"street_2": "Floor 2",
"town_city": "San Francisco",
"county_state": "CA",
"postal_zip_code": "94103",
"country": "US",
"default_billing": true,
"default_shipping": false
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"id": "adrs_LkpnNwAxlmXB3b",
"name": "Jack Ryan",
"street": "456 Washington St",
"street_2": "suite 2",
"town_city": "Hollywood",
"postal_zip_code": "90210",
"county_state": "CA",
"country": "US",
"default_billing": false,
"default_shipping": true,
"meta": {
"requires_signature": 1
},
"created": 1577934245,
"updated": 1577937906
}
Request
POST v1/customers/{customer_id}/addresses
URL parameters
Name | Status | Description |
---|---|---|
customer_id |
required | The customer's ID |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
name |
string | optional | The ship to name |
street |
string | optional | Shipping street address for customer |
street_2 |
string | optional | Shipping street address second line for customer |
town_city |
string | optional | Shipping town or city for customer |
county_state |
string | optional | Shipping county/state/province for customer |
postal_zip_code |
string | optional | Shipping postal or ZIP code for customer: |
country |
string | optional | Shipping country for customer (ISO 3166-1 alpha-2, e.g. GB - United Kingdom) |
default_billing |
boolean | optional | Is this the default billing for this customer |
default_shipping |
boolean | optional | Is this the default shipping for this customer |
meta |
object | optional | Optional metadata to store on the address |
Update address for customer
Updates a specific address for the provided customer.
Example request:
curl --request PUT \
"https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6/addresses/1" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"name\": \"Johnny Doe\",
\"street\": \"123 Fake St\",
\"street_2\": \"Floor 2\",
\"town_city\": \"San Francisco\",
\"county_state\": \"CA\",
\"postal_zip_code\": \"94103\",
\"country\": \"US\",
\"default_billing\": true,
\"default_shipping\": false
}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6/addresses/1"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6/addresses/1'
payload = {
"name": "Johnny Doe",
"street": "123 Fake St",
"street_2": "Floor 2",
"town_city": "San Francisco",
"county_state": "CA",
"postal_zip_code": "94103",
"country": "US",
"default_billing": true,
"default_shipping": false
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"id": "adrs_LkpnNwAxlmXB3b",
"name": "Jack Ryan",
"street": "456 Washington St",
"street_2": "suite 2",
"town_city": "Hollywood",
"postal_zip_code": "90210",
"county_state": "CA",
"country": "US",
"default_billing": false,
"default_shipping": true,
"meta": {
"requires_signature": 1
},
"created": 1577934245,
"updated": 1577937906
}
Request
PUT v1/customers/{customer_id}/addresses/{note_id}
URL parameters
Name | Status | Description |
---|---|---|
customer_id |
required | The customer's ID |
address_id |
required | The address ID |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
name |
string | optional | The ship to name |
street |
string | optional | Shipping street address for customer |
street_2 |
string | optional | Shipping street address second line for customer |
town_city |
string | optional | Shipping town or city for customer |
county_state |
string | optional | Shipping county/state/province for customer |
postal_zip_code |
string | optional | Shipping postal or ZIP code for customer: |
country |
string | optional | Shipping country for customer (ISO 3166-1 alpha-2, e.g. GB - United Kingdom) |
default_billing |
boolean | optional | Is this the default billing for this customer |
default_shipping |
boolean | optional | Is this the default shipping for this customer |
meta |
object | optional | Optional metadata to store on the address |
Delete address for customer
Deletes address from the provided customer.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6/addresses/1" \
--header "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6/addresses/1"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6/addresses/1'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/customers/{customer_id}/addresses/{note_id}
URL parameters
Name | Status | Description |
---|---|---|
customer_id |
required | The customer's ID |
address_id |
required | The address ID |
Issue and return login token
This API works the same way as "Issue and send login token", but requires a secret API key, and will return the issued token rather than emailing it to the customer. This API can be used when you do not want to use Chec branded emails for your implementation, and you'd prefer to build your own handler for this process instead.
Use the returned token
and email
parameters to construct your "click here to log in" email and send it
to your customer.
Tokens are valid for 30 minutes from when they are issued. Issuing subsequent tokens will automatically revoke previously issued tokens.
Please note that if you are using this API to send your own emails instead of using the default Chec emails, it is advisable to always return a successful response message regardless of whether the customer's email address record was found. This prevents email address enumeration attacks, where showing a "not found" message discloses information about your customers to attackers.
Example request:
curl --request POST \
"https://api.chec.io/v1/customers/issue-token" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"email\": \"[email protected]\",
\"base_url\": \"https:\\/\\/mystore.com\\/login\\/:token:\"
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/customers/issue-token"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/customers/issue-token'
payload = {
"email": "[email protected]",
"base_url": "https:\/\/mystore.com\/login\/:token:"
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (201):
{
"token": "1ae420a5-2f43-426f-8a61-516eabb56d33",
"customer_id": "cstmr_VNplJa1EaYwL60",
"revoked": false,
"created": 1587399600,
"expires": 1587401400
}
Request
POST v1/customers/issue-token
Body parameters
Name | Type | Status | Description |
---|---|---|---|
email |
string | required | The email address for the customer |
base_url |
string | required | The base URL to attach the token to. Use |
List customers
Returns a paginated list of all customers for the current merchant.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/customers" \
--header "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/customers"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/customers'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"data": [
{
"id": "cstmr_VNplJa1EaYwL60",
"external_id": "MY_CRM_ID_123",
"firstname": "Mary",
"lastname": "Malleable",
"email": "[email protected]",
"phone": "+1 987 789 6543",
"meta": {
"utm_campaign": "summer"
},
"created": 1601579628,
"updated": 1601579628
},
{
"id": "cstmr_B7ZQobNDa4AgNn",
"external_id": null,
"firstname": "Alice",
"lastname": "Ansible",
"email": "[email protected]",
"phone": "+1 123 456 7890",
"meta": null,
"created": 1601579628,
"updated": 1601579628
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 20,
"current_page": 1,
"total_pages": 1,
"links": []
}
}
}
Request
GET v1/customers
Query parameters
Name | Status | Description |
---|---|---|
query |
optional | Filter by a term that will be matched against the customers ID (exactly), first name, last name, and email |
external_id |
optional | Find customers matching a specific external_id. Note that this is not a partial match |
Create customer
Create a new customer record for the current merchant. Email addresses must be unique for your merchant's list of customers.
Example request:
curl --request POST \
"https://api.chec.io/v1/customers" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"email\": \"[email protected]\",
\"phone\": \"+1 987 654 3210\",
\"firstname\": \"Leslie\",
\"lastname\": \"Lawless\",
\"external_id\": \"MY_CRM_USER_123\"
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/customers"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/customers'
payload = {
"email": "[email protected]",
"phone": "+1 987 654 3210",
"firstname": "Leslie",
"lastname": "Lawless",
"external_id": "MY_CRM_USER_123"
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (201):
{
"id": "cstmr_K1YDR2qy29Qem6",
"external_id": null,
"firstname": "Dario",
"lastname": "Dancer",
"email": "[email protected]",
"phone": "+1 987 654 3210",
"meta": {
"utm_campaign": "winter"
},
"created": 1587399600,
"updated": 1587399600
}
Request
POST v1/customers
Body parameters
Name | Type | Status | Description |
---|---|---|---|
email |
string | required | The customer's email address, must be unique |
phone |
string | optional | The customer's phone number |
firstname |
string | optional | The customer's firstname |
lastname |
string | optional | The customer's lastname/surname |
external_id |
string | optional | An optional ID for external systems |
meta |
object | optional | Optional metadata to store on the customer |
Delete customer
Deletes a customer by its ID.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6" \
--header "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/customers/cstmr_K1YDR2qy29Qem6"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/customers/{customer_id}
URL parameters
Name | Status | Description |
---|---|---|
customer_id |
required | The customer's ID |
Issue JWT for customer
As a merchant, you may issue a JSON web token for a customer directly using your secret Chec API key. This may be a desirable option if you are integrating your own customer authentication, and simply need a token to authorize API requests as your customer with.
Example request:
curl --request POST \
"https://api.chec.io/v1/customers/cstmr_VNplJa1EaYwL60/issue-token" \
--header "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/customers/cstmr_VNplJa1EaYwL60/issue-token"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/customers/cstmr_VNplJa1EaYwL60/issue-token'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('POST', url, headers=headers)
response.json()
Example response (200):
{
"customer_id": "cstmr_VNplJa1EaYwL60",
"jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
Request
POST v1/customers/{customer_id}/issue-token
URL parameters
Name | Status | Description |
---|---|---|
customer_id |
required | The customer's ID to generate a token for |
List notes for customer
Returns a paginated list of private (merchant only) notes for the provided customer.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6/notes" \
--header "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/customers/cstmr_K1YDR2qy29Qem6/notes"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6/notes'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"data": [
{
"id": "note_VNplJa1EaYwL60",
"content": "Customer has been refunded for the shipping amount",
"meta": {
"signed_off_by": "Charlie in accounts"
},
"created": 1577934245,
"updated": 1577937906
},
{
"id": "note_B7ZQobNDa4AgNn",
"content": "2020 was a write off, bring on the new year.",
"meta": [],
"created": 1577934245,
"updated": 1577937906
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 20,
"current_page": 1,
"total_pages": 1,
"links": []
}
}
}
Request
GET v1/customers/{customer_id}/notes
URL parameters
Name | Status | Description |
---|---|---|
customer_id |
required | The customer's ID |
Get note for customer
Returns a single private (merchant only) note for the provided customer.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6/notes/note_7RyWOwmK5nEa2V" \
--header "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/customers/cstmr_K1YDR2qy29Qem6/notes/note_7RyWOwmK5nEa2V"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6/notes/note_7RyWOwmK5nEa2V'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"id": "note_VNplJa1EaYwL60",
"content": "Customer has been refunded for the shipping amount",
"meta": {
"signed_off_by": "Charlie in accounts"
},
"created": 1577934245,
"updated": 1577937906
}
Request
GET v1/customers/{customer_id}/notes/{note_id}
URL parameters
Name | Status | Description |
---|---|---|
customer_id |
required | The customer's ID |
note_id |
required | The note ID to retrieve |
Create note for customer
Create a new note and assign it to the provided customer.
Example request:
curl --request POST \
"https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6/notes" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"content\": \"Today was a good day\"
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6/notes"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6/notes'
payload = {
"content": "Today was a good day"
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"id": "note_VNplJa1EaYwL60",
"content": "Customer has been refunded for the shipping amount",
"meta": {
"signed_off_by": "Charlie in accounts"
},
"created": 1577934245,
"updated": 1577937906
}
Request
POST v1/customers/{customer_id}/notes
URL parameters
Name | Status | Description |
---|---|---|
customer_id |
required | The customer's ID |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
content |
string | required | The content of the note |
meta |
string[] | optional | An optional array of metadata to store on the note |
Update note for customer
Updates a specific note for the provided customer.
Example request:
curl --request PUT \
"https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6/notes/note_7RyWOwmK5nEa2V" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"content\": \"Today was a good day\"
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6/notes/note_7RyWOwmK5nEa2V"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6/notes/note_7RyWOwmK5nEa2V'
payload = {
"content": "Today was a good day"
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"id": "note_VNplJa1EaYwL60",
"content": "Customer has been refunded for the shipping amount",
"meta": {
"signed_off_by": "Charlie in accounts"
},
"created": 1577934245,
"updated": 1577937906
}
Request
PUT v1/customers/{customer_id}/notes/{note_id}
URL parameters
Name | Status | Description |
---|---|---|
customer_id |
required | The customer's ID |
note_id |
required | The note ID to retrieve |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
content |
string | required | The content of the note |
meta |
string[] | optional | An optional array of metadata to store on the note |
Delete note for customer
Deletes a note from the provided customer.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6/notes/note_7RyWOwmK5nEa2V" \
--header "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/customers/cstmr_K1YDR2qy29Qem6/notes/note_7RyWOwmK5nEa2V"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/customers/cstmr_K1YDR2qy29Qem6/notes/note_7RyWOwmK5nEa2V'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/customers/{customer_id}/notes/{note_id}
URL parameters
Name | Status | Description |
---|---|---|
customer_id |
required | The customer's ID |
note_id |
required | The note ID to retrieve |
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 --request GET \
--get "https://api.chec.io/v1/developer/logs?limit=10&page=2&format=full" \
--header "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"
);
const params = {
"limit": "10",
"page": "2",
"format": "full",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/developer/logs'
params = {
'limit': '10',
'page': '2',
'format': 'full',
}
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()
Example response (200):
[
{
"id": "log_1ypbroE658n4ea",
"version": "2021-10-22",
"method": "GET",
"url": "/v1/checkouts/chkt_ABC123/check/discount",
"status_code": "422",
"request": null,
"response": null,
"key_used": null,
"sandbox": true,
"token_id": null,
"ip_address": null,
"created": 1658849854
},
{
"id": "log_1ypbroE658n4ea",
"version": "2021-10-22",
"method": "GET",
"url": "/v1/checkouts/chkt_ABC123/check/discount",
"status_code": "422",
"request": null,
"response": null,
"key_used": null,
"sandbox": true,
"token_id": null,
"ip_address": null,
"created": 1658849854
}
]
Request
GET v1/developer/logs
Query parameters
Name | Status | Description |
---|---|---|
limit |
optional | The number of latest logs to return (default: 20) |
page |
optional | The page to return (default: 1) |
format |
optional | Desired output format. Options: |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The log ID |
created |
integer | Timestamp of the time the log was created |
version |
string | API version |
key_used |
string | Type of API key used |
sandbox |
boolean | Whether the request was made with a sandbox API key |
url |
string | The endpoint URI that the log was created from |
method |
string | The HTTP method executed |
ip_address |
string | The IP address |
status_code |
integer | The HTTP status code of the response |
request |
object | The request payload |
response |
object | The response body |
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 --request GET \
--get "https://api.chec.io/v1/developer/logs/rqst_r98h894f98ssdh?format=full" \
--header "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"
);
const params = {
"format": "full",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.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):
{
"id": "log_1ypbroE658n4ea",
"version": "2021-10-22",
"method": "GET",
"url": "/v1/checkouts/chkt_ABC123/check/discount",
"status_code": "422",
"request": null,
"response": null,
"key_used": null,
"sandbox": true,
"token_id": null,
"ip_address": null,
"created": 1658849854
}
Request
GET v1/developer/logs/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | The log's ID |
Query parameters
Name | Status | Description |
---|---|---|
format |
optional | Desired output format. Options: |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The log ID |
created |
integer | Timestamp of the time the log was created |
version |
string | API version |
key_used |
string | Type of API key used |
sandbox |
boolean | Whether the request was made with a sandbox API key |
url |
string | The endpoint URI that the log was created from |
method |
string | The HTTP method executed |
ip_address |
string | The IP address |
status_code |
integer | The HTTP status code of the response |
request |
object | The request payload |
response |
object | The response body |
Clear logs
Clears all developer logs for the current merchant.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/developer/logs" \
--header "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"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/developer/logs'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/developer/logs
Discounts
List discounts
Example request:
curl --request GET \
--get "https://api.chec.io/v1/discounts" \
--header "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"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/discounts'
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": 1658707200,
"starts_on": null,
"is_expired": true,
"limit_quantity": false,
"quantity": 0,
"description": null,
"meta": {
"campaign": "partners-promo-2022"
},
"product_ids": []
}
Request
GET v1/discounts
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The discount ID |
created |
integer | A unix timestamp when the discount code was initially created |
code |
string | The discount code |
type |
string | Either |
value |
number | If |
expires_on |
integer | A unix timestamp of when the discount code will expire |
starts_on |
integer | A unit timestamp of when the discount code starts being valid |
is_expired |
boolean | Whether the discount code expiry date has been reached |
limit_quantity |
boolean | Whether there is a limited number of times that this discount code is available for use |
quantity |
integer | If |
product_id |
string | The product ID, if empty the discount code can be used with all products |
description |
string | A description for this discount code |
meta |
object | The discount code metadata |
Retrieve discount
Returns the detailed information for a discount code
Example request:
curl --request GET \
--get "https://api.chec.io/v1/discounts/0" \
--header "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/0"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/discounts/0'
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": 1658707200,
"starts_on": null,
"is_expired": true,
"limit_quantity": false,
"quantity": 0,
"description": null,
"meta": {
"campaign": "partners-promo-2022"
},
"product_ids": []
}
Request
GET v1/discounts/{discount_id}
URL parameters
Name | Status | Description |
---|---|---|
discount_id |
required | The discount ID to retrieve |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The discount ID |
created |
integer | A unix timestamp when the discount code was initially created |
code |
string | The discount code |
type |
string | Either |
value |
number | If |
expires_on |
integer | A unix timestamp of when the discount code will expire |
starts_on |
integer | A unit timestamp of when the discount code starts being valid |
is_expired |
boolean | Whether the discount code expiry date has been reached |
limit_quantity |
boolean | Whether there is a limited number of times that this discount code is available for use |
quantity |
integer | If |
product_id |
string | The product ID, if empty the discount code can be used with all products |
description |
string | A description for this discount code |
meta |
object | The discount code metadata |
Create discount
Example request:
curl --request POST \
"https://api.chec.io/v1/discounts" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"code\": \"RHKZKU71WG\",
\"type\": \"fixed\",
\"value\": 49.95,
\"limit_quantity\": true,
\"product_id\": \"prod_9wh9t0hw4h0\",
\"quantity\": 10,
\"expires\": false
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/discounts"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/discounts'
payload = {
"code": "RHKZKU71WG",
"type": "fixed",
"value": 49.95,
"limit_quantity": true,
"product_id": "prod_9wh9t0hw4h0",
"quantity": 10,
"expires": false
}
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": 1658707200,
"starts_on": null,
"is_expired": true,
"limit_quantity": false,
"quantity": 0,
"description": null,
"meta": {
"campaign": "partners-promo-2022"
},
"product_ids": []
}
Request
POST v1/discounts
Body parameters
Name | Type | Status | Description |
---|---|---|---|
code |
string | optional | The discount code, will be auto generated if not provided |
type |
string | optional | Either |
value |
number | required | If |
description |
string | optional | A description for this discount code |
limit_quantity |
boolean | optional | Whether there should be a limited number this discount code available for use: |
product_id |
string | optional | A product ID for which this discount would be applicable. If not provided, will apply to all. |
quantity |
integer | optional | If |
expires |
boolean | optional | Whether the discount code should expire |
expires_on |
integer | optional | If |
starts_on |
integer | optional | An optional unix timestamp for when the discount code should start being valid from. Defaults to now if not provided. |
meta |
object | optional | Optional metadata to store on the discount code |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The discount ID |
created |
integer | A unix timestamp when the discount code was initially created |
code |
string | The discount code |
type |
string | Either |
value |
number | If |
expires_on |
integer | A unix timestamp of when the discount code will expire |
starts_on |
integer | A unit timestamp of when the discount code starts being valid |
is_expired |
boolean | Whether the discount code expiry date has been reached |
limit_quantity |
boolean | Whether there is a limited number of times that this discount code is available for use |
quantity |
integer | If |
product_id |
string | The product ID, if empty the discount code can be used with all products |
description |
string | A description for this discount code |
meta |
object | The discount code metadata |
Update discount
The request and responses for this method are the same as for "Create discount", only all request arguments are optional.
Example request:
curl --request PUT \
"https://api.chec.io/v1/discounts/{discount_id}" \
--header "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/{discount_id}"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/discounts/{discount_id}'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('PUT', url, headers=headers)
response.json()
Request
PUT v1/discounts/{discount_id}
Delete discount
Deletes a discount code from the system.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/discounts/0" \
--header "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/0"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/discounts/0'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/discounts/{discount_id}
URL parameters
Name | Status | Description |
---|---|---|
discount_id |
required | The discount ID to remove |
Extra Fields
List extra fields
Returns a list of all global extra fields. This does not include product-level extra fields, which must be managed through the Products APIs.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/extra-fields" \
--header "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/extra-fields"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/extra-fields'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"data": [
{
"id": "extr_1ypbroE658n4ea",
"name": "Middle name",
"type": "text",
"required": false,
"options": null,
"meta": null,
"created": 1658849854,
"updated": 1658849854
},
{
"id": "extr_1ypbroE658n4ea",
"name": "Middle name",
"type": "text",
"required": false,
"options": null,
"meta": null,
"created": 1658849854,
"updated": 1658849854
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 2,
"current_page": 1,
"total_pages": 1,
"links": {}
}
}
}
Request
GET v1/extra-fields
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The extra field ID Example: extr_7RyWOwmK5nEa2V |
name |
string | A name for the extra field - usually used as a field label Example: Your website |
type |
string | A type for the extra field. One of "text", "options", "number", "checkbox", "date", "radio", "hidden". Currently only "text" is supported for products Example: "text" |
required |
boolean | Whether this extra field is required Example: false |
options |
string[] | An array of strings defining the options for this field, if the field is a selectable type No-example |
meta |
string[] | Optional metadata attached to the extrafield No-example |
created |
integer | Unix timestamp for when the extra field was created No-example |
updated |
integer | Unix timestamp for when the extra field was last updated No-example |
Get extra field
Retrieve an extra field by its ID.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/extra-fields/extr_K1YDR2qy29Qem6" \
--header "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/extra-fields/extr_K1YDR2qy29Qem6"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/extra-fields/extr_K1YDR2qy29Qem6'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"id": "extr_1ypbroE658n4ea",
"name": "Middle name",
"type": "text",
"required": false,
"options": null,
"meta": null,
"created": 1658849854,
"updated": 1658849854
}
Request
GET v1/extra-fields/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | The extra field ID |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The extra field ID Example: extr_7RyWOwmK5nEa2V |
name |
string | A name for the extra field - usually used as a field label Example: Your website |
type |
string | A type for the extra field. One of "text", "options", "number", "checkbox", "date", "radio", "hidden". Currently only "text" is supported for products Example: "text" |
required |
boolean | Whether this extra field is required Example: false |
options |
string[] | An array of strings defining the options for this field, if the field is a selectable type No-example |
meta |
string[] | Optional metadata attached to the extrafield No-example |
created |
integer | Unix timestamp for when the extra field was created No-example |
updated |
integer | Unix timestamp for when the extra field was last updated No-example |
Create extra field
Create a new extra field, and attach to the current merchant.
Example request:
curl --request POST \
"https://api.chec.io/v1/extra-fields" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"name\": \"Gift wrapping\",
\"required\": true,
\"type\": \"text\"
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/extra-fields"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/extra-fields'
payload = {
"name": "Gift wrapping",
"required": true,
"type": "text"
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (201):
{
"id": "extr_O3bR5XBQkwnzdj",
"name": "Gift wrapping",
"type": "text",
"required": true,
"options": [
"large"
],
"meta": null,
"created": 1615832139,
"updated": 1615832516
}
Request
POST v1/extra-fields
Body parameters
Name | Type | Status | Description |
---|---|---|---|
name |
string | required | The extra field name |
required |
boolean | optional | Whether the field is required during |
type |
string | required | The type of field (for frontend use). One of: text, options, number, checkbox, date, radio, hidden |
options.* |
string | optional | A list of string options, for when |
meta |
object | optional | Optional metadata to store on the extra field |
Update extra field
Update attributes on the specified extra field. The request arguments are the same as for the "create extra
field" API, however the name
is not required.
Example request:
curl --request PUT \
"https://api.chec.io/v1/extra-fields/extr_K1YDR2qy29Qem6" \
--header "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/extra-fields/extr_K1YDR2qy29Qem6"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/extra-fields/extr_K1YDR2qy29Qem6'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('PUT', url, headers=headers)
response.json()
Example response (200):
{
"id": "extr_O3bR5XBQkwnzdj",
"name": "Would you like gift wrapping?",
"type": "options",
"required": true,
"options": [
"Yes",
"No"
],
"meta": null,
"created": 1615832139,
"updated": 1615832516
}
Request
PUT v1/extra-fields/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | The extra field ID |
Delete extra field
Delete an extra field by its ID.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/extra-fields/extr_K1YDR2qy29Qem6" \
--header "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/extra-fields/extr_K1YDR2qy29Qem6"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/extra-fields/extr_K1YDR2qy29Qem6'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/extra-fields/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | The extra field ID |
Gateways
List gateways
Returns a list of registered payment gateways.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/gateways" \
--header "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/gateways"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/gateways'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"data": [
{
"id": "gway_1ypbroE658n4ea",
"code": "test_gateway",
"sandbox": {
"supported": true,
"enabled": true
},
"config": null,
"transaction_volume": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"meta": null,
"created": 1658849853,
"updated": 1658849853
},
{
"id": "gway_1ypbroE658n4ea",
"code": "test_gateway",
"sandbox": {
"supported": true,
"enabled": true
},
"config": null,
"transaction_volume": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"meta": null,
"created": 1658849853,
"updated": 1658849853
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 2,
"current_page": 1,
"total_pages": 1,
"links": {}
}
}
}
Request
GET v1/gateways
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | Gateway ID |
code |
string | Code for the gateway, e.g. stripe |
sandbox.supported |
boolean | Whether sandbox mode is supported for this gateway |
sandbox.enabled |
boolean | Whether sandbox mode is enabled |
config |
string[] | The configuration options for this gateway, e.g. API keys |
transaction_volume |
Price | The total volume of transactions through this gateway to date |
meta |
object | Optional metadata to store on the gateway |
created |
integer | Unix timestamp of when the gateway was created |
updated |
integer | Unix timestamp of when the gateway was last updated |
Get gateway
Returns a specific payment gateway.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/gateways/gway_4WJvlK66B5bYV1" \
--header "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/gateways/gway_4WJvlK66B5bYV1"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/gateways/gway_4WJvlK66B5bYV1'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"id": "gway_1ypbroE658n4ea",
"code": "test_gateway",
"sandbox": {
"supported": true,
"enabled": true
},
"config": null,
"transaction_volume": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"meta": null,
"created": 1658849853,
"updated": 1658849853
}
Request
GET v1/gateways/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | Payment gateway ID |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | Gateway ID |
code |
string | Code for the gateway, e.g. stripe |
sandbox.supported |
boolean | Whether sandbox mode is supported for this gateway |
sandbox.enabled |
boolean | Whether sandbox mode is enabled |
config |
string[] | The configuration options for this gateway, e.g. API keys |
transaction_volume |
Price | The total volume of transactions through this gateway to date |
meta |
object | Optional metadata to store on the gateway |
created |
integer | Unix timestamp of when the gateway was created |
updated |
integer | Unix timestamp of when the gateway was last updated |
Create gateway
Register a new payment gateway for the current merchant. The required configuration options vary between each gateway code.
If you are a Square gateway, the response will contain a registration_url
argument. This contains a link to
Square to continue with the OAuth authorization process. When you complete this process it will return to the
Chec API. You may provide a return_to
argument when you create the gateway, in which case this returned API
route will redirect to your return_to
argument once everything has completed. If this argument is not provided,
an empty 200 OK response will be returned.
Example request:
curl --request POST \
"https://api.chec.io/v1/gateways" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"code\": \"nostrum\",
\"sandbox\": false
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/gateways"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/gateways'
payload = {
"code": "nostrum",
"sandbox": false
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (201):
{
"id": "gway_B7ZQobNDa4AgNn",
"code": "stripe",
"sandbox": true,
"config": {
"access_token": "29850684-39ce-4d1c-aed4-86b914d048d4",
"stripe_secret_key": "d126f620-4edd-4676-97c0-d654796421ed",
"stripe_publishable_key": "e2e507eb-9d3e-48a6-ae39-c82a5fc7684c"
},
"meta": {
"region": "south-america"
},
"created": 1623954766,
"updated": 1623954766
}
Request
POST v1/gateways
Body parameters
Name | Type | Status | Description |
---|---|---|---|
code |
string | required | One of braintree, manual, omise, paypal, razorpay, square, stripe, test_gateway |
sandbox |
boolean | optional | Specify whether the gateway should be in sandbox mode. Note that not all gateways support sandbox mode. |
meta |
object | optional | Optional metadata to store on the gateway |
config.access_token |
string | optional | Access token, required if using Stripe or Square |
config.stripe_secret_key |
string | optional | Stripe secret key, required if using Stripe |
config.stripe_publishable_key |
string | optional | Stripe publishable key, required if using Stripe |
config.payment_method_types.* |
string | optional | If using Stripe Payment Intents, a list of "payment_method_types" to allow (default: |
config.braintree_merchant_id |
string | optional | Braintree merchant ID, required if using Braintree |
config.braintree_public_key |
string | optional | Braintree public key, required if using Braintree |
config.braintree_private_key |
string | optional | Braintree private key, required if using Braintree |
config.omise_public_key |
string | optional | Omise public key, required if using Omise |
config.omise_secret_key |
string | optional | Omise private key, required if using Omise |
config.key_id |
string | optional | Razorpay key ID, required if using Razorpay |
config.key_secret |
string | optional | Razorpay key secret, required if using Razorpay |
config.email |
string | optional | PayPal seller account email address, required if using PayPal |
config.name |
string | optional | Manual gateway name, required if using manual gateway |
config.details |
string | optional | Manual gateway details, required if using manual gateway |
config.payment_instructions |
string | optional | Manual gateway payment instructions, required if using manual gateway |
return_to |
string | optional | If using Square, provide a URL to be redirected back to after OAuth authorization is complete |
Update gateway
Update details for an existing payment gateway. The request arguments for this API are the same as for "Create gateway", however none of the attributes are required.
Example request:
curl --request PUT \
"https://api.chec.io/v1/gateways/gway_4WJvlK66B5bYV1" \
--header "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/gateways/gway_4WJvlK66B5bYV1"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/gateways/gway_4WJvlK66B5bYV1'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('PUT', url, headers=headers)
response.json()
Example response (200):
{
"id": "gway_B7ZQobNDa4AgNn",
"code": "stripe",
"sandbox": false,
"config": {
"access_token": "29850684-39ce-4d1c-aed4-86b914d048d4",
"stripe_secret_key": "d126f620-4edd-4676-97c0-d654796421ed",
"stripe_publishable_key": "e2e507eb-9d3e-48a6-ae39-c82a5fc7684c"
},
"meta": {
"region": "north-america"
},
"created": 1623954766,
"updated": 1623956532
}
Request
PUT v1/gateways/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | Payment gateway ID |
Delete gateway
Removes a payment gateway from the merchant's account.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/gateways/gway_4WJvlK66B5bYV1" \
--header "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/gateways/gway_4WJvlK66B5bYV1"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/gateways/gway_4WJvlK66B5bYV1'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/gateways/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | Payment gateway ID |
Giftcards
Retrieve gift card
Fetches the details for a gift card, including balance and metadata.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/giftcards/gft_2yA6nld4lEWbz7?type=id" \
--header "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/giftcards/gft_2yA6nld4lEWbz7"
);
const params = {
"type": "id",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.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,
"updated": 1556801100
}
Request
GET v1/giftcards/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | The gift card ID |
Query parameters
Name | Status | Description |
---|---|---|
type |
optional | Either |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The gift card ID |
code |
string | An alphanumeric code that customers use to redeem the gift card |
balance |
Price | The current monetary amount available to redeem |
initial_value |
Price | The initial balance set when creating the gift card |
note |
string | An user defined note that may be stored on the gift card |
created |
integer | A unix timestamp for when the gift card was originally created |
updated |
integer | A unix timestamp for when the gift card was last updated |
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 --request POST \
"https://api.chec.io/v1/giftcards/27URV9 OY3X NFIW KCYV28/redeem" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"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"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.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,
"updated": 1556801100
}
Request
POST v1/giftcards/{code}/redeem
URL parameters
Name | Status | Description |
---|---|---|
code |
required | Gift card code to redeem |
Body parameters
Name | 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 |
object | optional | Optional metadata to add to the redemption |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The gift card ID |
code |
string | An alphanumeric code that customers use to redeem the gift card |
balance |
Price | The current monetary amount available to redeem |
initial_value |
Price | The initial balance set when creating the gift card |
note |
string | An user defined note that may be stored on the gift card |
created |
integer | A unix timestamp for when the gift card was originally created |
updated |
integer | A unix timestamp for when the gift card was last updated |
Create gift card
Create a new gift card.
Example request:
curl --request POST \
"https://api.chec.io/v1/giftcards" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"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"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.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 (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,
"updated": 1556801100
}
Request
POST v1/giftcards
Body parameters
Name | 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 |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The gift card ID |
code |
string | An alphanumeric code that customers use to redeem the gift card |
balance |
Price | The current monetary amount available to redeem |
initial_value |
Price | The initial balance set when creating the gift card |
note |
string | An user defined note that may be stored on the gift card |
created |
integer | A unix timestamp for when the gift card was originally created |
updated |
integer | A unix timestamp for when the gift card was last updated |
Integrations
List integrations
Returns a list of integrations registered for your merchant account.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/integrations" \
--header "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/integrations"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/integrations'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"data": [
{
"id": "int_4VPvL5zN5AQkXp",
"template_id": "tmpl_bOp1YoV1wXLv9E",
"status": "ready",
"url": "https://run.chec-integrations.io/int_4VPvL5zN5AQkXp",
"config": {
"webhook_url": "https://hooks.slack.com/services/CBD345/BCD234/ABC123",
"text": "New order <https://dashboard.chec.io/orders/{id}|{order_reference}> placed for {order_value}."
},
"success_rate": 1,
"last_run": 1637776630,
"meta": null,
"created": 1637776620,
"updated": 1637776630,
"webhooks": [
{
"id": "wbhk_7ZAMo10LWwNJ4x",
"subscribed_events": [
"orders.create"
]
}
]
}
],
"meta": {
"pagination": {
"total": 1,
"count": 1,
"per_page": 20,
"current_page": 1,
"total_pages": 1,
"links": {}
}
}
}
Request
GET v1/integrations
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The integration ID |
template_id |
string | The template ID this integration uses |
external_id |
string|null | A customizable string that identifies this integration |
status |
string | Either "initializing" or "ready", depending on provisioning status |
url |
string | The URL of the provisioned integration, e.g. |
config |
object | The configuration for this integration. This might contain API keys, settings, etc. |
success_rate |
number | A number between 0 and 1 indicating how many of the previous integration runs were successful |
last_run |
integer | A unix timestamp for when the integration last ran |
meta |
object | Optional metadata attached to this integration |
created |
integer | A unix timestamp for when the integration was created |
updated |
integer | A unix timestamp for when the integration was last updated |
List templates
Returns a list of available integration templates. An integration template is the source code and configuration for an integration, which is used when the integration is provisioned.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/integrations/templates" \
--header "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/integrations/templates"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/integrations/templates'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"data": [
{
"id": "tmpl_1ypbroE658n4ea",
"code": "dummy_template",
"name": "Dummy template",
"short_description": "Used for local development.",
"description": "Used for local development and end-to-end testing.",
"tags": [
"testing",
"local",
"dummy"
],
"icon_url": "https://cdn.chec.io/chec-assets/holo-on-dark.png",
"source_repo": "chec/dummy-integration",
"webhooks": [
"products.create",
"products.update",
"products.delete"
],
"form_schema": null,
"config_frame_url": null,
"skip_initial_configuration": false
},
{
"id": "tmpl_1ypbroE658n4ea",
"code": "dummy_template",
"name": "Dummy template",
"short_description": "Used for local development.",
"description": "Used for local development and end-to-end testing.",
"tags": [
"testing",
"local",
"dummy"
],
"icon_url": "https://cdn.chec.io/chec-assets/holo-on-dark.png",
"source_repo": "chec/dummy-integration",
"webhooks": [
"products.create",
"products.update",
"products.delete"
],
"form_schema": null,
"config_frame_url": null,
"skip_initial_configuration": false
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 2,
"current_page": 1,
"total_pages": 1,
"links": {}
}
}
}
Request
GET v1/integrations/templates
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The template ID |
code |
string | A short code/slug, e.g. "algolia" |
name |
string | Human readable name |
short_description |
string | A sentence summarising the template |
description |
string | A full HTML description |
tags |
string[] | An array of strings categorising the template |
source_repo |
string | The organisation and repository slug for the template's GitHub repository, e.g. chec/example-template |
webhooks |
string[] | An array of webhook events that this template will subscribe to |
form_schema |
string[] | Form schema for the configuration fields to create this integration |
config_frame_url |
string | If this template uses a "configuration app", the URL to the hosted application |
skip_initial_configuration |
boolean | If this template has no fields to configure, whether it should skip the configuration screen |
Get template
Returns an integration template by its ID.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/integrations/templates/tmpl_K1YDR2qy29Qem6" \
--header "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/integrations/templates/tmpl_K1YDR2qy29Qem6"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/integrations/templates/tmpl_K1YDR2qy29Qem6'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"id": "tmpl_1ypbroE658n4ea",
"code": "dummy_template",
"name": "Dummy template",
"short_description": "Used for local development.",
"description": "Used for local development and end-to-end testing.",
"tags": [
"testing",
"local",
"dummy"
],
"icon_url": "https://cdn.chec.io/chec-assets/holo-on-dark.png",
"source_repo": "chec/dummy-integration",
"webhooks": [
"products.create",
"products.update",
"products.delete"
],
"form_schema": null,
"config_frame_url": null,
"skip_initial_configuration": false
}
Request
GET v1/integrations/templates/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | The template ID |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The template ID |
code |
string | A short code/slug, e.g. "algolia" |
name |
string | Human readable name |
short_description |
string | A sentence summarising the template |
description |
string | A full HTML description |
tags |
string[] | An array of strings categorising the template |
source_repo |
string | The organisation and repository slug for the template's GitHub repository, e.g. chec/example-template |
webhooks |
string[] | An array of webhook events that this template will subscribe to |
form_schema |
string[] | Form schema for the configuration fields to create this integration |
config_frame_url |
string | If this template uses a "configuration app", the URL to the hosted application |
skip_initial_configuration |
boolean | If this template has no fields to configure, whether it should skip the configuration screen |
Get integration
Returns information about a specific integration by its ID.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/integrations/int_4WJvlK66B5bYV1" \
--header "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/integrations/int_4WJvlK66B5bYV1"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/integrations/int_4WJvlK66B5bYV1'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"id": "int_4VPvL5zN5AQkXp",
"template_id": "tmpl_bOp1YoV1wXLv9E",
"status": "ready",
"url": "https://run.chec-integrations.io/int_4VPvL5zN5AQkXp",
"config": {
"webhook_url": "https://hooks.slack.com/services/CBD345/BCD234/ABC123",
"text": "New order <https://dashboard.chec.io/orders/{id}|{order_reference}> placed for {order_value}."
},
"success_rate": 1,
"last_run": 1637776630,
"meta": null,
"created": 1637776620,
"updated": 1637776630,
"webhooks": [
{
"id": "wbhk_7ZAMo10LWwNJ4x",
"subscribed_events": [
"orders.create"
]
}
]
}
Request
GET v1/integrations/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | The integration ID |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The integration ID |
template_id |
string | The template ID this integration uses |
external_id |
string|null | A customizable string that identifies this integration |
status |
string | Either "initializing" or "ready", depending on provisioning status |
url |
string | The URL of the provisioned integration, e.g. |
config |
object | The configuration for this integration. This might contain API keys, settings, etc. |
success_rate |
number | A number between 0 and 1 indicating how many of the previous integration runs were successful |
last_run |
integer | A unix timestamp for when the integration last ran |
meta |
object | Optional metadata attached to this integration |
created |
integer | A unix timestamp for when the integration was created |
updated |
integer | A unix timestamp for when the integration was last updated |
Create integration
Creates a new integration using the template provided. Integrations are provisioned using the source code
from a template, which is then bundled together and deployed to a serverless function. This will be mapped
to a public domain which can be invoked by Chec webhooks, e.g. update your Algolia search indexes when
a products.create
or products.update
event is fired. The serverless function is given a public and
secret Chec API key when it is provisioned.
During creation the integration will be marked with a status of "initializing", and provisioning will run
asynchronously. When provisioning is complete, the status will be updated to "ready" and the integration
will be ready to use. At this point the integration's public URL will be set by the provisioner, and an initial
integrations.ready
webhook event will be fired at the integration's handler. This event can be used to
run initial installation steps.
Example request:
curl --request POST \
"https://api.chec.io/v1/integrations" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"template\": \"tmpl_K1YDR2qy29Qem6\"
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/integrations"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/integrations'
payload = {
"template": "tmpl_K1YDR2qy29Qem6"
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (201):
{
"id": "int_4VPvL5zN5AQkXp",
"template_id": "tmpl_bOp1YoV1wXLv9E",
"status": "ready",
"url": "https://run.chec-integrations.io/int_4VPvL5zN5AQkXp",
"config": {
"webhook_url": "https://hooks.slack.com/services/CBD345/BCD234/ABC123",
"text": "New order <https://dashboard.chec.io/orders/{id}|{order_reference}> placed for {order_value}."
},
"success_rate": 1,
"last_run": 1637776630,
"meta": null,
"created": 1637776620,
"updated": 1637776630,
"webhooks": [
{
"id": "wbhk_7ZAMo10LWwNJ4x",
"subscribed_events": [
"orders.create"
]
}
]
}
Request
POST v1/integrations
Body parameters
Name | Type | Status | Description |
---|---|---|---|
template |
string | required | The integration template ID to use |
config |
string[] | optional | An optional array of configuration to attach to the integration before provisioning |
url |
string | optional | Initially set the integration URL. Usually this is done automatically during provisioning |
meta |
object | optional | Optional metadata to store on the integration |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The integration ID |
template_id |
string | The template ID this integration uses |
external_id |
string|null | A customizable string that identifies this integration |
status |
string | Either "initializing" or "ready", depending on provisioning status |
url |
string | The URL of the provisioned integration, e.g. |
config |
object | The configuration for this integration. This might contain API keys, settings, etc. |
success_rate |
number | A number between 0 and 1 indicating how many of the previous integration runs were successful |
last_run |
integer | A unix timestamp for when the integration last ran |
meta |
object | Optional metadata attached to this integration |
created |
integer | A unix timestamp for when the integration was created |
updated |
integer | A unix timestamp for when the integration was last updated |
Update integration
Updates an existing integration. The template cannot be changed, however you can update the configuration, URL, or metadata. Specify the "redeploy" attribute to trigger re-provisioning, which will update the source code from the template and any environment variables.
You may update the status of the integration in the following scenarios:
installing
may be changed toready
awaiting_third_party
may be changed toinitializing
(which will trigger provisioning)
Example request:
curl --request PUT \
"https://api.chec.io/v1/integrations/int_7RqEv5xKOoZz4j" \
--header "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/integrations/int_7RqEv5xKOoZz4j"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/integrations/int_7RqEv5xKOoZz4j'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('PUT', url, headers=headers)
response.json()
Example response (200):
{
"id": "int_4VPvL5zN5AQkXp",
"template_id": "tmpl_bOp1YoV1wXLv9E",
"status": "ready",
"url": "https://run.chec-integrations.io/int_4VPvL5zN5AQkXp",
"config": {
"webhook_url": "https://hooks.slack.com/services/CBD345/BCD234/ABC123",
"text": "New order <https://dashboard.chec.io/orders/{id}|{order_reference}> placed for {order_value}."
},
"success_rate": 1,
"last_run": 1637776630,
"meta": null,
"created": 1637776620,
"updated": 1637776630,
"webhooks": [
{
"id": "wbhk_7ZAMo10LWwNJ4x",
"subscribed_events": [
"orders.create"
]
}
]
}
Request
PUT v1/integrations/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | The ID of the integration |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
config |
string[] | optional | Update configuration on the integration |
url |
string | optional | The URL for the integration |
meta |
object | optional | Optional metadata to store on the integration |
redeploy |
boolean | optional | Whether to re-provision the integration |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The integration ID |
template_id |
string | The template ID this integration uses |
external_id |
string|null | A customizable string that identifies this integration |
status |
string | Either "initializing" or "ready", depending on provisioning status |
url |
string | The URL of the provisioned integration, e.g. |
config |
object | The configuration for this integration. This might contain API keys, settings, etc. |
success_rate |
number | A number between 0 and 1 indicating how many of the previous integration runs were successful |
last_run |
integer | A unix timestamp for when the integration last ran |
meta |
object | Optional metadata attached to this integration |
created |
integer | A unix timestamp for when the integration was created |
updated |
integer | A unix timestamp for when the integration was last updated |
Delete integration
Removes and de-provisions an integration.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/integrations/int_7RqEv5xKOoZz4j" \
--header "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/integrations/int_7RqEv5xKOoZz4j"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/integrations/int_7RqEv5xKOoZz4j'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/integrations/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | The ID of the integration |
Merchants
List merchants
Returns a list of all merchants available with your access token or API key.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/merchants" \
--header "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/merchants"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.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,
"name": "Test store",
"description": "",
"status": "active",
"country": "US",
"currency": {
"symbol": "$",
"code": "USD"
},
"has": {
"logo": false,
"cover": false,
"analytics": false,
"description": false,
"enabled_hosted_checkouts": true,
"enabled_hosted_storefront": true
},
"support_email": "[email protected]",
"logo_shape": null,
"intercom": false,
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"images": {
"logo": null,
"cover": null
}
}
Request
GET v1/merchants
Response
Response fields
Name | Type | Description |
---|---|---|
id |
integer | The merchant's ID Example: 123 |
name |
string | Name of the business Example: Acme Anvil Co |
description |
string | Description of the business Example: Making big metal things since ages ago |
status |
string | Status of the merchant, one of "active" or "disabled" Example: active |
country |
string | Two letter country code for the merchant's base country Example: US |
currency.symbol |
string | The merchant's currency symbol Example: $ |
currency.code |
string | The merchant's currency code Example: USD |
support_email |
string | A support address for the merchant Example: [email protected] |
logo_shape |
string | How the merchant's logo should be rendered, one of "circle" or "squared" Example: circle |
analytics.google.settings.tracking_id |
string | Google Analytics tracking ID Example: GA-12345-UI |
analytics.google.settings.linked_domains.* |
string | Linked domains for Google Analytics Example: acme.example.com |
has.logo |
boolean | Whether a logo exists Example: true |
has.cover |
boolean | Whether a cover image exists Example: true |
has.analytics |
boolean | Whether Google Analytics is configured Example: true |
has.description |
boolean | Whether the business has a description Example: true |
Get merchant details
Returns information for the specified merchant account.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/merchants/{merchant_id}" \
--header "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/merchants/{merchant_id}"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/merchants/{merchant_id}'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"id": 1,
"name": "Test store",
"description": "",
"status": "active",
"country": "US",
"currency": {
"symbol": "$",
"code": "USD"
},
"has": {
"logo": false,
"cover": false,
"analytics": false,
"description": false,
"enabled_hosted_checkouts": true,
"enabled_hosted_storefront": true
},
"support_email": "[email protected]",
"logo_shape": null,
"intercom": false,
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"images": {
"logo": null,
"cover": null
}
}
Request
GET v1/merchants/{merchant_id}
Response
Response fields
Name | Type | Description |
---|---|---|
id |
integer | The merchant's ID Example: 123 |
name |
string | Name of the business Example: Acme Anvil Co |
description |
string | Description of the business Example: Making big metal things since ages ago |
status |
string | Status of the merchant, one of "active" or "disabled" Example: active |
country |
string | Two letter country code for the merchant's base country Example: US |
currency.symbol |
string | The merchant's currency symbol Example: $ |
currency.code |
string | The merchant's currency code Example: USD |
support_email |
string | A support address for the merchant Example: [email protected] |
logo_shape |
string | How the merchant's logo should be rendered, one of "circle" or "squared" Example: circle |
analytics.google.settings.tracking_id |
string | Google Analytics tracking ID Example: GA-12345-UI |
analytics.google.settings.linked_domains.* |
string | Linked domains for Google Analytics Example: acme.example.com |
has.logo |
boolean | Whether a logo exists Example: true |
has.cover |
boolean | Whether a cover image exists Example: true |
has.analytics |
boolean | Whether Google Analytics is configured Example: true |
has.description |
boolean | Whether the business has a description Example: true |
Update merchant details
Use this to update the details on your Chec merchant account.
Example request:
curl --request PUT \
"https://api.chec.io/v1/merchants/{merchant_id}" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"name\": \"Acme Axe Co.\",
\"description\": \"We sell strong axes\",
\"email\": \"[email protected]\"
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/merchants/{merchant_id}"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/merchants/{merchant_id}'
payload = {
"name": "Acme Axe Co.",
"description": "We sell strong axes",
"email": "[email protected]"
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"id": 1,
"name": "Test store",
"description": "",
"status": "active",
"country": "US",
"currency": {
"symbol": "$",
"code": "USD"
},
"has": {
"logo": false,
"cover": false,
"analytics": false,
"description": false,
"enabled_hosted_checkouts": true,
"enabled_hosted_storefront": true
},
"support_email": "[email protected]",
"logo_shape": null,
"intercom": false,
"analytics": {
"google": {
"settings": {
"tracking_id": null,
"linked_domains": []
}
}
},
"images": {
"logo": null,
"cover": null
}
}
Request
PUT v1/merchants/{merchant_id}
Body parameters
Name | Type | Status | Description |
---|---|---|---|
name |
string | optional | Name for the merchant account |
description |
string | optional | A description of the business |
email |
string | optional | A contact email address for the account |
images.logo |
string | optional | ID of an asset to use as the merchant's logo |
images.cover |
string | optional | ID of an asset to use as the merchant's cover image |
cors_domains.* |
string | optional | If you want to set CORS origin domains for public key API calls, specify an array of URLs |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
integer | The merchant's ID Example: 123 |
name |
string | Name of the business Example: Acme Anvil Co |
description |
string | Description of the business Example: Making big metal things since ages ago |
status |
string | Status of the merchant, one of "active" or "disabled" Example: active |
country |
string | Two letter country code for the merchant's base country Example: US |
currency.symbol |
string | The merchant's currency symbol Example: $ |
currency.code |
string | The merchant's currency code Example: USD |
support_email |
string | A support address for the merchant Example: [email protected] |
logo_shape |
string | How the merchant's logo should be rendered, one of "circle" or "squared" Example: circle |
analytics.google.settings.tracking_id |
string | Google Analytics tracking ID Example: GA-12345-UI |
analytics.google.settings.linked_domains.* |
string | Linked domains for Google Analytics Example: acme.example.com |
has.logo |
boolean | Whether a logo exists Example: true |
has.cover |
boolean | Whether a cover image exists Example: true |
has.analytics |
boolean | Whether Google Analytics is configured Example: true |
has.description |
boolean | Whether the business has a description Example: true |
Delete merchant account
Permanently deletes your merchant account, and all of your data. Please note that this action is irreversible, so use with caution.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/merchants/123" \
--header "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/123"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/merchants/123'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/merchants/{merchant_id}
URL parameters
Name | Status | Description |
---|---|---|
merchant_id |
required | Your merchant ID |
Get notification settings
Lists notification settings for a merchant, or customers of a merchant.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/merchants/{merchant_id}/notifications" \
--header "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/{merchant_id}/notifications"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/merchants/{merchant_id}/notifications'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"customer": {
"login_token": true,
"orders": true,
"shipments": true
},
"merchant": {
"news": true,
"orders": true,
"dashboard_notifications": "quiet"
}
}
Request
GET v1/merchants/{merchant_id}/notifications
Response
Response fields
Name | Type | Description |
---|---|---|
customer.login_token |
boolean | Whether customers receive login token emails |
customer.orders |
boolean | Whether customers receive order confirmation emails |
customer.shipments |
boolean | Whether customers receive order shipment emails |
merchant.news |
boolean | Whether merchants are subscribed to news and feature update emails |
merchant.orders |
boolean | Whether merchants receive new order emails |
merchant.dashboard_notifications |
string | One of "off", "quiet", or "full" |
Update notification settings
Update notification settings for a merchant, or customers of a merchant.
Example request:
curl --request PUT \
"https://api.chec.io/v1/merchants/{merchant_id}/notifications" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"dashboard_notifications\": \"quiet\"
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/merchants/{merchant_id}/notifications"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/merchants/{merchant_id}/notifications'
payload = {
"dashboard_notifications": "quiet"
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()
Request
PUT v1/merchants/{merchant_id}/notifications
Body parameters
Name | Type | Status | Description |
---|---|---|---|
customer.login_token |
boolean | optional | Whether customers will receive login token emails |
customer.orders |
boolean | optional | Whether customers will receive order confirmation emails |
customer.shipments |
boolean | optional | Whether customers will receive order shipment confirmation emails |
merchant.orders |
boolean | optional | Whether you (as a merchant) will receive "you have a new order" emails |
dashboard_notifications |
string | optional | Set the verbosity level for notifications in the Chec Dashboard. One of "off", "quiet", or "full" |
Delete test orders
Deletes all orders from a merchant's account that are marked as sandbox.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/merchants/123/test-data" \
--header "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/123/test-data"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/merchants/123/test-data'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/merchants/{merchant_id}/test-data
URL parameters
Name | Status | Description |
---|---|---|
merchant_id |
required | Your merchant ID |
List fulfillment zones
Returns a list of a merchant's registered fulfillment zones.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/fulfillment/physical/zones" \
--header "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/fulfillment/physical/zones"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/fulfillment/physical/zones'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"data": [
{
"id": "zone_1ypbroE658n4ea",
"name": "International",
"countries": [
"CA",
"MX",
"NZ",
"AU",
"AS",
"CC",
"CK",
"CX",
"FJ",
"FM",
"GU",
"KI",
"MH",
"MP",
"NC",
"NF",
"NR",
"NU",
"PF",
"PG",
"PN",
"PW",
"SB",
"TK",
"TO",
"TV",
"VU",
"WF",
"WS",
"AE",
"AF",
"AM",
"AZ",
"BD",
"BH",
"BN",
"BT",
"CN",
"GE",
"HK",
"ID",
"IL",
"IN",
"IQ",
"IR",
"JO",
"JP",
"KG",
"KH",
"KP",
"KR",
"KW",
"KZ",
"LA",
"LB",
"LK",
"MM",
"MN",
"MO",
"MV",
"MY",
"NP",
"OM",
"PH",
"PK",
"PS",
"QA",
"SA",
"SG",
"SY",
"TH",
"TJ",
"TL",
"TM",
"TR",
"TW",
"UZ",
"VN",
"YE",
"AR",
"BO",
"BR",
"CL",
"CO",
"EC",
"FK",
"GF",
"GS",
"GY",
"PE",
"PY",
"SR",
"UY",
"VE",
"BM",
"BZ",
"CR",
"GT",
"HN",
"NI",
"PA",
"PM",
"SV",
"UM",
"AG",
"AI",
"AW",
"BB",
"BL",
"BS",
"CU",
"CW",
"DM",
"DO",
"GD",
"GP",
"HT",
"JM",
"KN",
"KY",
"LC",
"MF",
"MQ",
"MS",
"PR",
"SX",
"TC",
"TT",
"VC",
"VG",
"VI",
"AO",
"BF",
"BI",
"BJ",
"BW",
"CD",
"CF",
"CG",
"CI",
"CM",
"CV",
"DJ",
"DZ",
"EG",
"EH",
"ER",
"ET",
"GA",
"GH",
"GM",
"GN",
"GQ",
"GW",
"IO",
"KE",
"KM",
"LR",
"LS",
"LY",
"MA",
"MG",
"ML",
"MR",
"MU",
"MW",
"MZ",
"NA",
"NE",
"NG",
"RE",
"RW",
"SC",
"SD",
"SL",
"SN",
"SO",
"SS",
"ST",
"SZ",
"TD",
"TG",
"TN",
"TZ",
"UG",
"YT",
"ZA",
"ZM",
"ZW"
],
"subdivisions": {
"CA": [
"AB",
"BC",
"MB",
"NB",
"NL",
"NT",
"NS",
"NU",
"ON",
"PE",
"QC",
"SK",
"YT"
],
"MX": [
"AGU",
"BCN",
"BCS",
"CAM",
"CHP",
"CHH",
"COA",
"COL",
"DIF",
"DUR",
"GUA",
"GRO",
"HID",
"JAL",
"MIC",
"MOR",
"MEX",
"NAY",
"NLE",
"OAX",
"PUE",
"QUE",
"ROO",
"SLP",
"SIN",
"SON",
"TAB",
"TAM",
"TLA",
"VER",
"YUC",
"ZAC"
],
"NZ": [
"AUK",
"BOP",
"CAN",
"GIS",
"HKB",
"MWT",
"MBH",
"NSN",
"NTL",
"OTA",
"STL",
"TKI",
"TAS",
"WKO",
"WGN",
"WTC"
],
"AU": [
"ACT",
"NSW",
"NT",
"QLD",
"SA",
"TAS",
"VIC",
"WA"
],
"FJ": [
"C",
"E",
"N",
"R",
"W"
],
"FM": [
"KSA",
"PNI",
"YAP",
"TRK"
],
"KI": [
"G",
"L",
"P"
],
"MH": [
"ALL",
"ALK",
"ARN",
"AUR",
"EBO",
"ENI",
"JAL",
"KIL",
"KWA",
"LAE",
"LIB",
"LIK",
"MAJ",
"MAL",
"MEJ",
"MIL",
"NMK",
"NMU",
"L",
"T",
"RON",
"UJA",
"UJL",
"UTI",
"WTH",
"WTJ"
],
"PG": [
"CPM",
"CPK",
"EBR",
"ESW",
"EHG",
"EPW",
"GPK",
"MPM",
"MRL",
"MBA",
"MPL",
"NCD",
"NIK",
"NSA",
"NPP",
"SAN",
"SHM",
"WBK",
"WPD",
"WHM"
],
"SB": [
"CT",
"CE",
"GU",
"IS",
"MK",
"ML",
"TE",
"WE"
],
"VU": [
"MAP",
"PAM",
"SAM",
"SEE",
"TAE",
"TOB"
],
"WS": [
"AA",
"AL",
"AT",
"FA",
"GE",
"GI",
"PA",
"SA",
"TU",
"VF",
"VS"
],
"AE": [
"AZ",
"FU",
"SH",
"DU",
"RK",
"UQ",
"AJ"
],
"AF": [
"BDS",
"BGL",
"BAL",
"BDG",
"BAM",
"FRA",
"FYB",
"GHA",
"GHO",
"HEL",
"HER",
"JOW",
"KAB",
"KAN",
"KNR",
"KDZ",
"KAP",
"LAG",
"LOW",
"NAN",
"NIM",
"ORU",
"PKA",
"PIA",
"PAR",
"SAM",
"SAR",
"TAK",
"WAR",
"ZAB"
],
"AM": [
"AG",
"AR",
"AV",
"ER",
"GR",
"KT",
"LO",
"SU",
"TV",
"VD",
"SH"
],
"AZ": [
"ABS",
"AST",
"AGC",
"AGM",
"AGS",
"AGA",
"AGU",
"BAB",
"BA",
"BAL",
"BEY",
"BIL",
"BAR",
"CUL",
"CAB",
"CAL",
"DAS",
"DAV",
"FUZ",
"GOR",
"GAD",
"GA",
"GOY",
"HAC",
"IMI",
"ISM",
"KAL",
"KUR",
"LAC",
"LER",
"LAN",
"LA",
"MAS",
"MI",
"NA",
"MM",
"NEF",
"ORD",
"OGU",
"QAX",
"QAZ",
"QOB",
"QBA",
"QBI",
"QUS",
"QAB",
"SAT",
"SAB",
"SAL",
"SMX",
"SIY",
"SM",
"SAD",
"TOV",
"TAR",
"UCA",
"XA",
"XAN",
"XAC",
"XIZ",
"XCI",
"XVD",
"YAR",
"YEV",
"YE",
"ZAQ",
"ZAN",
"ZAR",
"AB",
"SAH",
"SMI",
"SUS",
"SS",
"SA",
"SAK",
"SKR",
"SAR"
],
"BD": [
"2A",
"1B",
"1",
"5C",
"2E",
"2D",
"2",
"2F",
"3G",
"3",
"5H",
"3I",
"3J",
"4K",
"4L",
"4",
"4M",
"3N",
"2O",
"5P",
"1Q",
"5R",
"5",
"5S",
"2T",
"3U"
],
"BH": [
"03",
"10",
"07",
"05",
"02",
"01",
"09",
"04",
"12",
"08",
"11",
"06"
],
"BN": [
"BE",
"BM",
"TE",
"TU"
],
"BT": [
"33",
"12",
"22",
"GA",
"13",
"44",
"42",
"11",
"43",
"23",
"45",
"14",
"31",
"15",
"TY",
"41",
"32",
"21",
"24",
"34"
],
"CN": [
"34",
"11",
"50",
"35",
"62",
"44",
"45",
"52",
"46",
"13",
"23",
"41",
"91",
"42",
"43",
"32",
"36",
"22",
"21",
"15",
"64",
"63",
"61",
"37",
"31",
"14",
"51",
"71",
"12",
"65",
"54",
"53",
"33"
],
"GE": [
"01",
"AJ",
"02",
"03",
"04",
"05",
"06",
"07",
"AB",
"08",
"09",
"BUS",
"10",
"11",
"12",
"13",
"CHI",
"14",
"15",
"16",
"GAG",
"17",
"18",
"GOR",
"19",
"20",
"21",
"22",
"23",
"24",
"26",
"33",
"KUT",
"25",
"27",
"28",
"29",
"30",
"31",
"32",
"34",
"35",
"36",
"37",
"38",
"39",
"40",
"41",
"42",
"43",
"44",
"PTI",
"45",
"46",
"RUS",
"47",
"48",
"49",
"50",
"51",
"52",
"SUI",
"53",
"TBS",
"54",
"55",
"56",
"57",
"TQI",
"TQV",
"58",
"59",
"60",
"TSQ",
"61",
"62",
"ZUG",
"63"
],
"ID": [
"PB",
"PA",
"JWU",
"JB",
"JT",
"JI",
"JK",
"YO",
"KAU",
"KB",
"KS",
"KT",
"KI",
"MAU",
"MA",
"NUU",
"BA",
"NB",
"NT",
"SLU",
"SN",
"ST",
"SG",
"SA",
"SMU",
"BE",
"JA",
"LA",
"RI",
"SB",
"SS",
"SU",
"AC",
"BT",
"GO",
"KU",
"BB",
"KR",
"SR"
],
"IL": [
"D",
"M",
"2",
"HA",
"TA",
"JM"
],
"IN": [
"AN",
"AP",
"AR",
"AS",
"BR",
"CH",
"DN",
"DD",
"DL",
"GA",
"GJ",
"HR",
"HP",
"JK",
"KA",
"KL",
"LD",
"MP",
"MH",
"MN",
"ML",
"MZ",
"NL",
"OR",
"PY",
"PB",
"RJ",
"SK",
"TN",
"TR",
"UP",
"WB"
],
"IQ": [
"AN",
"BA",
"MU",
"QA",
"NA",
"AR",
"SU",
"TS",
"BG",
"BB",
"DA",
"DQ",
"DI",
"KA",
"MA",
"NI",
"WA",
"SD"
],
"IR": [
"03",
"06",
"08",
"04",
"14",
"19",
"24",
"23",
"15",
"17",
"09",
"10",
"18",
"16",
"20",
"22",
"21",
"26",
"12",
"13",
"07",
"25",
"11",
"02",
"01",
"05"
],
"JO": [
"AQ",
"BA",
"KA",
"MA",
"AZ",
"AT",
"IR",
"JA",
"MN",
"MD",
"AJ",
"AM"
],
"JP": [
"23",
"05",
"02",
"38",
"21",
"10",
"34",
"01",
"18",
"40",
"07",
"28",
"08",
"17",
"03",
"37",
"46",
"14",
"43",
"26",
"39",
"24",
"04",
"45",
"20",
"42",
"29",
"15",
"33",
"47",
"41",
"11",
"25",
"22",
"12",
"36",
"09",
"31",
"16",
"13",
"30",
"06",
"35",
"19",
"44",
"27"
],
"KG": [
"C",
"J",
"N",
"O",
"T",
"Y"
],
"KH": [
"2",
"1",
"3",
"4",
"5",
"6",
"7",
"8",
"10",
"23",
"18",
"11",
"22",
"12",
"15",
"13",
"14",
"16",
"17",
"19",
"20",
"21"
],
"KP": [
"CHA",
"HAB",
"HAN",
"HWB",
"HWN",
"KAE",
"KAN",
"NAM",
"PYB",
"PYN",
"PYO",
"YAN"
],
"KR": [
"26",
"43",
"44",
"27",
"30",
"42",
"29",
"41",
"47",
"48",
"28",
"49",
"45",
"46",
"11",
"31"
],
"KW": [
"AH",
"FA",
"JA",
"KU",
"HA"
],
"KZ": [
"ALA",
"ALM",
"AKM",
"AKT",
"ATY",
"ZAP",
"BAY",
"MAN",
"YUZ",
"PAV",
"KAR",
"KUS",
"KZY",
"VOS",
"SEV",
"ZHA"
],
"LA": [
"AT",
"BK",
"BL",
"CH",
"HO",
"KH",
"LM",
"LP",
"OU",
"PH",
"SL",
"SV",
"VT",
"VI",
"XA",
"XI",
"XE"
],
"LB": [
"BA",
"BI",
"JL",
"AS",
"JA",
"NA"
],
"LK": [
"71",
"52",
"81",
"1",
"51",
"11",
"3",
"31",
"12",
"33",
"41",
"13",
"21",
"92",
"42",
"61",
"2",
"43",
"22",
"32",
"82",
"45",
"5",
"23",
"72",
"62",
"91",
"9",
"53",
"4",
"7",
"8",
"44",
"6"
],
"MM": [
"07",
"02",
"14",
"11",
"12",
"13",
"03",
"04",
"15",
"16",
"01",
"17",
"05",
"06"
],
"MN": [
"073",
"071",
"069",
"067",
"037",
"061",
"063",
"059",
"057",
"065",
"064",
"039",
"043",
"041",
"035",
"049",
"051",
"047",
"1",
"046",
"053",
"055"
],
"MV": [
"02",
"20",
"17",
"14",
"27",
"28",
"29",
"07",
"23",
"26",
"05",
"03",
"MLE",
"12",
"25",
"13",
"01",
"24",
"08",
"04"
],
"MY": [
"J",
"K",
"D",
"M",
"N",
"C",
"A",
"R",
"P",
"SA",
"SK",
"B",
"T",
"W",
"L"
],
"NP": [
"BA",
"BH",
"DH",
"GA",
"JA",
"KA",
"KO",
"LU",
"2",
"1",
"MA",
"ME",
"NA",
"3",
"4",
"RA",
"SA",
"SE",
"5"
],
"OM": [
"DA",
"BA",
"JA",
"WU",
"SH",
"ZA",
"MA",
"MU"
],
"PK": [
"JK",
"BA",
"TA",
"IS",
"NW",
"NA",
"PB",
"SD"
],
"QA": [
"DA",
"GH",
"JU",
"KH",
"WA",
"RA",
"JB",
"MS",
"US"
],
"SA": [
"11",
"12",
"03",
"05",
"08",
"O1",
"04",
"09",
"02",
"10",
"07",
"06",
"14"
],
"SY": [
"LA",
"QU",
"HA",
"RA",
"SU",
"DR",
"DY",
"DI",
"ID",
"RD",
"TA",
"HL",
"HM",
"HI"
],
"TH": [
"37",
"15",
"31",
"24",
"18",
"36",
"22",
"50",
"57",
"20",
"86",
"46",
"62",
"71",
"40",
"81",
"10",
"52",
"51",
"42",
"16",
"58",
"44",
"49",
"26",
"73",
"48",
"30",
"60",
"80",
"55",
"96",
"39",
"43",
"12",
"13",
"94",
"82",
"93",
"S",
"56",
"67",
"76",
"66",
"65",
"14",
"54",
"83",
"25",
"77",
"85",
"70",
"21",
"45",
"27",
"47",
"11",
"74",
"75",
"19",
"91",
"33",
"17",
"90",
"64",
"72",
"84",
"32",
"63",
"92",
"23",
"34",
"41",
"61",
"53",
"95",
"35"
],
"TJ": [
"GB",
"KR",
"KT",
"LN"
],
"TM": [
"A",
"B",
"D",
"L",
"M"
],
"TR": [
"01",
"02",
"03",
"68",
"05",
"06",
"07",
"75",
"08",
"09",
"04",
"10",
"74",
"72",
"69",
"11",
"12",
"13",
"14",
"15",
"16",
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28",
"29",
"30",
"31",
"32",
"76",
"46",
"78",
"70",
"36",
"37",
"38",
"79",
"41",
"42",
"43",
"39",
"71",
"40",
"44",
"4S",
"47",
"48",
"49",
"SO",
"51",
"52",
"53",
"54",
"SS",
"56",
"57",
"S8",
"59",
"60",
"61",
"62",
"64",
"65",
"77",
"66",
"67",
"17",
"18",
"19",
"34",
"35",
"33",
"63",
"73"
],
"TW": [
"CHA",
"CYI",
"HSZ",
"HUA",
"ILA",
"KHH",
"KEE",
"MIA",
"NAN",
"PEN",
"PIF",
"TXG",
"TNN",
"TPE",
"TTT",
"TAO",
"YUN"
],
"UZ": [
"AN",
"BU",
"FA",
"JI",
"KH",
"NG",
"NW",
"QA",
"QR",
"SA",
"SI",
"SU",
"TO"
],
"VN": [
"44",
"43",
"53",
"54",
"55",
"56",
"50",
"31",
"57",
"58",
"40",
"59",
"48",
"04",
"60",
"33",
"39",
"45",
"30",
"03",
"63",
"64",
"15",
"23",
"61",
"62",
"65",
"14",
"66",
"34",
"47",
"28",
"01",
"35",
"09",
"02",
"41",
"67",
"22",
"18",
"36",
"68",
"32",
"27",
"29",
"24",
"25",
"52",
"05",
"37",
"20",
"69",
"21",
"26",
"46",
"51",
"07",
"49",
"70",
"06"
],
"YE": [
"AB",
"BA",
"JA",
"MR",
"MW",
"HU",
"DH",
"IB",
"LA",
"MA",
"SH",
"TA",
"SD",
"SN",
"HJ",
"HD",
"AD"
],
"AR": [
"B",
"C",
"K",
"H",
"U",
"W",
"X",
"E",
"P",
"Y",
"L",
"F",
"M",
"N",
"Q",
"R",
"A",
"J",
"D",
"Z",
"S",
"G",
"V",
"T"
],
"BO": [
"H",
"C",
"B",
"L",
"O",
"N",
"P",
"S",
"T"
],
"BR": [
"AC",
"AL",
"AP",
"AM",
"BA",
"CE",
"DF",
"ES",
"GO",
"MA",
"MT",
"MS",
"MG",
"PR",
"PB",
"PA",
"PE",
"PI",
"RN",
"RS",
"RJ",
"R0",
"RR",
"SC",
"SE",
"SP",
"TO"
],
"CL": [
"AI",
"AN",
"AR",
"AT",
"BI",
"CO",
"LI",
"LL",
"MA",
"ML",
"RM",
"TA",
"VS"
],
"CO": [
"AMA",
"ANT",
"ARA",
"ATL",
"BOL",
"BOY",
"CAL",
"CAQ",
"CAS",
"CAU",
"CES",
"CHO",
"CUN",
"COR",
"DC",
"GUA",
"GUV",
"HUI",
"LAG",
"MAG",
"MET",
"NAR",
"NSA",
"PUT",
"QUI",
"RIS",
"SAP",
"SAN",
"SUC",
"TOL",
"VAC",
"VAU",
"VID"
],
"EC": [
"A",
"B",
"C",
"F",
"H",
"X",
"O",
"E",
"W",
"G",
"I",
"L",
"R",
"M",
"S",
"N",
"Y",
"P",
"U",
"T",
"Z"
],
"GY": [
"BA",
"CU",
"DE",
"EB",
"ES",
"MA",
"PM",
"PT",
"UD",
"UT"
],
"PE": [
"AMA",
"ANC",
"APU",
"ARE",
"AYA",
"CAJ",
"CUS",
"CAL",
"HUV",
"HUC",
"ICA",
"JUN",
"LAL",
"LAM",
"LIM",
"LOR",
"MDD",
"MOQ",
"PAS",
"PIU",
"PUN",
"SAM",
"TAC",
"TUM",
"UCA"
],
"PY": [
"16",
"10",
"13",
"ASU",
"19",
"5",
"6",
"14",
"11",
"1",
"3",
"4",
"7",
"8",
"12",
"9",
"15",
"2"
],
"SR": [
"BR",
"CM",
"CR",
"MA",
"NI",
"PR",
"PM",
"SA",
"SI",
"WA"
],
"UY": [
"AR",
"CA",
"CL",
"CO",
"DU",
"FS",
"FD",
"LA",
"MA",
"MO",
"PA",
"RV",
"RO",
"RN",
"SA",
"SJ",
"SO",
"TA",
"TT"
],
"VE": [
"Z",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"Y",
"W",
"A",
"I",
"J",
"K",
"M",
"N",
"L",
"O",
"P",
"R",
"T",
"S",
"U",
"V"
],
"BZ": [
"BZ",
"CY",
"CZL",
"OW",
"SC",
"TOL"
],
"CR": [
"A",
"C",
"G",
"H",
"L",
"P",
"SJ"
],
"GT": [
"AV",
"BV",
"CM",
"CQ",
"PR",
"ES",
"GU",
"HU",
"IZ",
"JA",
"JU",
"PE",
"QZ",
"QC",
"RE",
"SA",
"SM",
"SR",
"SO",
"SU",
"TO",
"ZA"
],
"HN": [
"AT",
"CH",
"CL",
"CM",
"CP",
"CR",
"EP",
"FM",
"GD",
"IN",
"IB",
"LP",
"LE",
"OC",
"OL",
"SB",
"VA",
"YO"
],
"NI": [
"BO",
"CA",
"CI",
"CO",
"ES",
"GR",
"JI",
"LE",
"MD",
"MN",
"MS",
"MT",
"NS",
"RI",
"SJ",
"ZE"
],
"PA": [
"1",
"4",
"2",
"3",
"0",
"5",
"6",
"7",
"8",
"9"
],
"SV": [
"AH",
"CA",
"CH",
"CU",
"LI",
"PA",
"UN",
"MO",
"SM",
"SS",
"SV",
"SA",
"SO",
"SU"
],
"BS": [
"AC",
"BI",
"CI",
"EX",
"FP",
"FC",
"GH",
"GT",
"HI",
"HR",
"IN",
"KB",
"LI",
"MH",
"MG",
"NP",
"NB",
"RI",
"RS",
"SR",
"SP"
],
"CU": [
"09",
"03",
"12",
"14",
"11",
"99",
"02",
"10",
"04",
"01",
"07",
"13",
"05"
],
"DO": [
"AZ",
"BR",
"BH",
"DA",
"DN",
"DU",
"SE",
"HM",
"IN",
"AL",
"EP",
"RO",
"VE",
"MT",
"MN",
"MC",
"MP",
"PN",
"PR",
"PP",
"SC",
"SM",
"CR",
"JU",
"PM",
"SZ",
"ST",
"SR",
"VA"
],
"HT": [
"AR",
"CE",
"GA",
"ND",
"NE",
"NO",
"OU",
"SD",
"SE"
],
"JM": [
"13",
"09",
"01",
"12",
"04",
"02",
"06",
"14",
"11",
"08",
"05",
"03",
"07",
"10"
],
"TT": [
"ARI",
"CHA",
"CTT",
"DMN",
"ETO",
"PED",
"PTF",
"POS",
"PRT",
"RCM",
"SFO",
"SJL",
"SGE",
"SIP",
"TUP",
"WTO"
],
"AO": [
"BGO",
"BGU",
"BIE",
"CAB",
"CCU",
"CNO",
"CUS",
"CNN",
"HUA",
"HUI",
"LUA",
"LNO",
"LSU",
"MAL",
"MOX",
"NAM",
"UIG",
"ZAI"
],
"BF": [
"BAL",
"BAM",
"BAN",
"BAZ",
"BGR",
"BLG",
"BLK",
"COM",
"GAN",
"GNA",
"GOU",
"HOU",
"IOB",
"KAD",
"KMD",
"KMP",
"KOS",
"KOP",
"KOT",
"KOW",
"KEN",
"LOR",
"LER",
"MOU",
"NAO",
"NAM",
"NAY",
"NOU",
"OUB",
"OUD",
"PAS",
"PON",
"SNG",
"SMT",
"SIS",
"SOM",
"SOR",
"SEN",
"TAP",
"TUI",
"YAG",
"YAT",
"ZIR",
"ZON",
"ZOU"
],
"BI": [
"BB",
"BJ",
"BR",
"CA",
"CI",
"GI",
"KR",
"KY",
"KI",
"MA",
"MU",
"MY",
"NG",
"RT",
"RY"
],
"BJ": [
"AK",
"AQ",
"BO",
"MO",
"OU",
"ZO"
],
"BW": [
"CE",
"CH",
"GH",
"KG",
"KL",
"KW",
"NG",
"NE",
"SE",
"SO"
],
"CD": [
"BN",
"BC",
"HC",
"KW",
"KE",
"KA",
"KN",
"MA",
"NK",
"SK",
"EQ"
],
"CF": [
"BB",
"BGF",
"BK",
"HM",
"HK",
"KG",
"LB",
"HS",
"MB",
"KB",
"NM",
"MP",
"UK",
"AC",
"OP",
"SE",
"VK"
],
"CG": [
"11",
"BZV",
"8",
"15",
"5",
"7",
"2",
"9",
"14",
"12",
"13"
],
"CI": [
"06",
"16",
"09",
"10",
"02",
"07",
"01",
"12",
"05",
"11",
"03",
"15",
"13",
"04",
"14",
"08"
],
"CM": [
"AD",
"CE",
"ES",
"EN",
"LT",
"NO",
"NW",
"SU",
"SW",
"OU"
],
"CV": [
"BV",
"BR",
"FO",
"B",
"S",
"MA",
"PA",
"PN",
"PR",
"RG",
"SL",
"CA",
"CR",
"SN",
"SV",
"TA"
],
"DJ": [
"AS",
"DI",
"DJ",
"OB",
"TA"
],
"DZ": [
"01",
"16",
"44",
"46",
"05",
"07",
"09",
"34",
"10",
"35",
"08",
"06",
"02",
"25",
"17",
"32",
"39",
"36",
"47",
"24",
"33",
"18",
"40",
"03",
"29",
"43",
"27",
"28",
"26",
"45",
"31",
"30",
"04",
"48",
"20",
"22",
"21",
"41",
"19",
"11",
"14",
"37",
"42",
"38",
"15",
"13",
"12"
],
"EG": [
"DK",
"BA",
"BH",
"FYM",
"GH",
"ALX",
"IS",
"GZ",
"MN",
"MNF",
"KB",
"C",
"WAD",
"SUZ",
"SHR",
"ASN",
"AST",
"BNS",
"PTS",
"DT",
"JS",
"KFS",
"MT",
"KN",
"SIN",
"SHG"
],
"ER": [
"AG",
"AS",
"BA",
"DE",
"GS",
"HA",
"SA",
"SM",
"SN",
"SR"
],
"ET": [
"AA",
"AF",
"AM",
"BE",
"GA",
"HA",
"OR",
"SO",
"SN",
"TI"
],
"GA": [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"
],
"GH": [
"AH",
"BA",
"CP",
"EP",
"AA",
"NP",
"UE",
"UW",
"TV",
"WP"
],
"GM": [
"B",
"L",
"M",
"N",
"U",
"W"
],
"GN": [
"B",
"BE",
"BF",
"BK",
"C",
"CO",
"DB",
"DL",
"DI",
"DU",
"FA",
"F",
"FO",
"FR",
"GA",
"GU",
"KA",
"K",
"KD",
"D",
"KS",
"KB",
"KO",
"KE",
"LA",
"L",
"LO",
"LE",
"MC",
"ML",
"MM",
"M",
"MD",
"NZ",
"N",
"PI",
"SI",
"TO",
"TE",
"YO"
],
"GQ": [
"AN",
"BN",
"BS",
"CS",
"KN",
"LI",
"C",
"I",
"WN"
],
"GW": [
"BA",
"BM",
"BS",
"BL",
"CA",
"GA",
"OI",
"QU"
],
"KE": [
"200",
"300",
"400",
"110",
"500",
"600",
"700",
"900"
],
"KM": [
"A",
"G",
"M"
],
"LR": [
"BM",
"BG",
"GB",
"CM",
"GG",
"GK",
"LO",
"MG",
"MY",
"MO",
"NI",
"RI",
"SI"
],
"LS": [
"D",
"B",
"C",
"E",
"A",
"F",
"J",
"H",
"G",
"K"
],
"LY": [
"BU",
"JA",
"JG",
"Ju",
"Wu",
"WA",
"ZA",
"BA",
"FA",
"MI",
"NA",
"SF",
"TB"
],
"MA": [
"AGD",
"HAO",
"HOC",
"ASZ",
"AZI",
"BAH",
"MEL",
"BES",
"BEM",
"BER",
"BOD",
"BOM",
"CAS",
"CE",
"CN",
"CS",
"CHE",
"CHI",
"HAJ",
"JDI",
"ERR",
"ESM",
"ESI",
"ES",
"FIG",
"FES",
"GUE",
"IFR",
"IRA",
"KES",
"KHE",
"KHN",
"KHO",
"KEN",
"LAA",
"LAR",
"MAR",
"MEK",
"NAD",
"NO",
"OUA",
"OUD",
"OUJ",
"RBA",
"SAF",
"SEF",
"SET",
"SIK",
"SU",
"TNT",
"TNG",
"TAO",
"TAR",
"TAT",
"TAZ",
"TS",
"TIZ",
"TET"
],
"MG": [
"T",
"D",
"F",
"M",
"A",
"U"
],
"ML": [
"BKO",
"7",
"1",
"8",
"2",
"5",
"3",
"4",
"6"
],
"MR": [
"07",
"03",
"05",
"08",
"04",
"10",
"01",
"02",
"12",
"NKC",
"09",
"11",
"06"
],
"MU": [
"AG",
"BR",
"BL",
"CC",
"CU",
"FL",
"GP",
"MO",
"PA",
"PW",
"PL",
"QB",
"RR",
"RO",
"SA",
"VP"
],
"MW": [
"BL",
"C",
"CK",
"CR",
"CT",
"DE",
"DO",
"KR",
"KS",
"LI",
"MH",
"MG",
"MC",
"MU",
"MW",
"MZ",
"NB",
"NK",
"N",
"NS",
"NU",
"NI",
"RU",
"SA",
"S",
"TH",
"ZO"
],
"MZ": [
"P",
"G",
"I",
"B",
"MPM",
"L",
"N",
"A",
"S",
"T",
"Q"
],
"NA": [
"CA",
"ER",
"HA",
"KA",
"KH",
"KU",
"OW",
"OK",
"OH",
"OS",
"ON",
"OT",
"OD"
],
"NE": [
"1",
"2",
"3",
"4",
"8",
"5",
"6",
"7"
],
"NG": [
"AB",
"FC",
"AD",
"AK",
"AN",
"BA",
"BE",
"BO",
"CR",
"DE",
"ED",
"EN",
"IM",
"JI",
"KD",
"KN",
"KT",
"KE",
"KO",
"KW",
"LA",
"NI",
"OG",
"ON",
"OS",
"OY",
"PL",
"RI",
"SO",
"TA",
"YO"
],
"RW": [
"C",
"I",
"E",
"D",
"G",
"B",
"J",
"F",
"K",
"L",
"M",
"H"
],
"SD": [
"26",
"18",
"07",
"03",
"06",
"22",
"04",
"08",
"24",
"01",
"23",
"17",
"14",
"12",
"10",
"16",
"11",
"13",
"20",
"05",
"15",
"02",
"09",
"19",
"25",
"21"
],
"SL": [
"E",
"N",
"S",
"W"
],
"SN": [
"DK",
"DB",
"FK",
"KL",
"KD",
"LG",
"SL",
"TC",
"TH",
"ZG"
],
"SO": [
"AW",
"BY",
"BK",
"BN",
"BR",
"GA",
"GE",
"HI",
"JD",
"JH",
"MU",
"NU",
"SA",
"SD",
"SH",
"SO",
"TO",
"WO"
],
"ST": [
"P",
"S"
],
"SZ": [
"HH",
"LU",
"MA",
"SH"
],
"TD": [
"BA",
"BI",
"BET",
"CB",
"GR",
"KA",
"LC",
"LO",
"LR",
"MK",
"MC",
"OD",
"SA",
"TA"
],
"TG": [
"C",
"K",
"M",
"P",
"S"
],
"TN": [
"13",
"23",
"31",
"81",
"71",
"32",
"41",
"42",
"73",
"12",
"33",
"53",
"82",
"52",
"21",
"61",
"43",
"34",
"51",
"83",
"72",
"11",
"22"
],
"TZ": [
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20",
"21",
"22",
"23",
"24",
"25"
],
"UG": [
"APA",
"ARU",
"BUN",
"BUS",
"GUL",
"HOI",
"IGA",
"JIN",
"KBL",
"KBR",
"KLG",
"KLA",
"KLI",
"KAP",
"KAS",
"KLE",
"KIB",
"KIS",
"KIT",
"KOT",
"KUM",
"LIR",
"LUW",
"MSK",
"MSI",
"MBL",
"MBR",
"MOR",
"MOY",
"MPI",
"MUB",
"MUK",
"NEB",
"NTU",
"PAL",
"RAK",
"RUK",
"SOR",
"TOR"
],
"ZA": [
"EC",
"FS",
"GT",
"NL",
"MP",
"NW",
"NC",
"NP",
"WC"
],
"ZM": [
"02",
"08",
"03",
"04",
"09",
"06",
"05",
"07",
"01"
],
"ZW": [
"BU",
"HA",
"MA",
"MC",
"ME",
"MW",
"MV",
"MN",
"MS",
"MI"
]
},
"meta": {
"managed_by_zonely": false
},
"created": 1587399600,
"updated": 1587399600
},
{
"id": "zone_1ypbroE658n4ea",
"name": "International",
"countries": [
"CA",
"MX",
"NZ",
"AU",
"AS",
"CC",
"CK",
"CX",
"FJ",
"FM",
"GU",
"KI",
"MH",
"MP",
"NC",
"NF",
"NR",
"NU",
"PF",
"PG",
"PN",
"PW",
"SB",
"TK",
"TO",
"TV",
"VU",
"WF",
"WS",
"AE",
"AF",
"AM",
"AZ",
"BD",
"BH",
"BN",
"BT",
"CN",
"GE",
"HK",
"ID",
"IL",
"IN",
"IQ",
"IR",
"JO",
"JP",
"KG",
"KH",
"KP",
"KR",
"KW",
"KZ",
"LA",
"LB",
"LK",
"MM",
"MN",
"MO",
"MV",
"MY",
"NP",
"OM",
"PH",
"PK",
"PS",
"QA",
"SA",
"SG",
"SY",
"TH",
"TJ",
"TL",
"TM",
"TR",
"TW",
"UZ",
"VN",
"YE",
"AR",
"BO",
"BR",
"CL",
"CO",
"EC",
"FK",
"GF",
"GS",
"GY",
"PE",
"PY",
"SR",
"UY",
"VE",
"BM",
"BZ",
"CR",
"GT",
"HN",
"NI",
"PA",
"PM",
"SV",
"UM",
"AG",
"AI",
"AW",
"BB",
"BL",
"BS",
"CU",
"CW",
"DM",
"DO",
"GD",
"GP",
"HT",
"JM",
"KN",
"KY",
"LC",
"MF",
"MQ",
"MS",
"PR",
"SX",
"TC",
"TT",
"VC",
"VG",
"VI",
"AO",
"BF",
"BI",
"BJ",
"BW",
"CD",
"CF",
"CG",
"CI",
"CM",
"CV",
"DJ",
"DZ",
"EG",
"EH",
"ER",
"ET",
"GA",
"GH",
"GM",
"GN",
"GQ",
"GW",
"IO",
"KE",
"KM",
"LR",
"LS",
"LY",
"MA",
"MG",
"ML",
"MR",
"MU",
"MW",
"MZ",
"NA",
"NE",
"NG",
"RE",
"RW",
"SC",
"SD",
"SL",
"SN",
"SO",
"SS",
"ST",
"SZ",
"TD",
"TG",
"TN",
"TZ",
"UG",
"YT",
"ZA",
"ZM",
"ZW"
],
"subdivisions": {
"CA": [
"AB",
"BC",
"MB",
"NB",
"NL",
"NT",
"NS",
"NU",
"ON",
"PE",
"QC",
"SK",
"YT"
],
"MX": [
"AGU",
"BCN",
"BCS",
"CAM",
"CHP",
"CHH",
"COA",
"COL",
"DIF",
"DUR",
"GUA",
"GRO",
"HID",
"JAL",
"MIC",
"MOR",
"MEX",
"NAY",
"NLE",
"OAX",
"PUE",
"QUE",
"ROO",
"SLP",
"SIN",
"SON",
"TAB",
"TAM",
"TLA",
"VER",
"YUC",
"ZAC"
],
"NZ": [
"AUK",
"BOP",
"CAN",
"GIS",
"HKB",
"MWT",
"MBH",
"NSN",
"NTL",
"OTA",
"STL",
"TKI",
"TAS",
"WKO",
"WGN",
"WTC"
],
"AU": [
"ACT",
"NSW",
"NT",
"QLD",
"SA",
"TAS",
"VIC",
"WA"
],
"FJ": [
"C",
"E",
"N",
"R",
"W"
],
"FM": [
"KSA",
"PNI",
"YAP",
"TRK"
],
"KI": [
"G",
"L",
"P"
],
"MH": [
"ALL",
"ALK",
"ARN",
"AUR",
"EBO",
"ENI",
"JAL",
"KIL",
"KWA",
"LAE",
"LIB",
"LIK",
"MAJ",
"MAL",
"MEJ",
"MIL",
"NMK",
"NMU",
"L",
"T",
"RON",
"UJA",
"UJL",
"UTI",
"WTH",
"WTJ"
],
"PG": [
"CPM",
"CPK",
"EBR",
"ESW",
"EHG",
"EPW",
"GPK",
"MPM",
"MRL",
"MBA",
"MPL",
"NCD",
"NIK",
"NSA",
"NPP",
"SAN",
"SHM",
"WBK",
"WPD",
"WHM"
],
"SB": [
"CT",
"CE",
"GU",
"IS",
"MK",
"ML",
"TE",
"WE"
],
"VU": [
"MAP",
"PAM",
"SAM",
"SEE",
"TAE",
"TOB"
],
"WS": [
"AA",
"AL",
"AT",
"FA",
"GE",
"GI",
"PA",
"SA",
"TU",
"VF",
"VS"
],
"AE": [
"AZ",
"FU",
"SH",
"DU",
"RK",
"UQ",
"AJ"
],
"AF": [
"BDS",
"BGL",
"BAL",
"BDG",
"BAM",
"FRA",
"FYB",
"GHA",
"GHO",
"HEL",
"HER",
"JOW",
"KAB",
"KAN",
"KNR",
"KDZ",
"KAP",
"LAG",
"LOW",
"NAN",
"NIM",
"ORU",
"PKA",
"PIA",
"PAR",
"SAM",
"SAR",
"TAK",
"WAR",
"ZAB"
],
"AM": [
"AG",
"AR",
"AV",
"ER",
"GR",
"KT",
"LO",
"SU",
"TV",
"VD",
"SH"
],
"AZ": [
"ABS",
"AST",
"AGC",
"AGM",
"AGS",
"AGA",
"AGU",
"BAB",
"BA",
"BAL",
"BEY",
"BIL",
"BAR",
"CUL",
"CAB",
"CAL",
"DAS",
"DAV",
"FUZ",
"GOR",
"GAD",
"GA",
"GOY",
"HAC",
"IMI",
"ISM",
"KAL",
"KUR",
"LAC",
"LER",
"LAN",
"LA",
"MAS",
"MI",
"NA",
"MM",
"NEF",
"ORD",
"OGU",
"QAX",
"QAZ",
"QOB",
"QBA",
"QBI",
"QUS",
"QAB",
"SAT",
"SAB",
"SAL",
"SMX",
"SIY",
"SM",
"SAD",
"TOV",
"TAR",
"UCA",
"XA",
"XAN",
"XAC",
"XIZ",
"XCI",
"XVD",
"YAR",
"YEV",
"YE",
"ZAQ",
"ZAN",
"ZAR",
"AB",
"SAH",
"SMI",
"SUS",
"SS",
"SA",
"SAK",
"SKR",
"SAR"
],
"BD": [
"2A",
"1B",
"1",
"5C",
"2E",
"2D",
"2",
"2F",
"3G",
"3",
"5H",
"3I",
"3J",
"4K",
"4L",
"4",
"4M",
"3N",
"2O",
"5P",
"1Q",
"5R",
"5",
"5S",
"2T",
"3U"
],
"BH": [
"03",
"10",
"07",
"05",
"02",
"01",
"09",
"04",
"12",
"08",
"11",
"06"
],
"BN": [
"BE",
"BM",
"TE",
"TU"
],
"BT": [
"33",
"12",
"22",
"GA",
"13",
"44",
"42",
"11",
"43",
"23",
"45",
"14",
"31",
"15",
"TY",
"41",
"32",
"21",
"24",
"34"
],
"CN": [
"34",
"11",
"50",
"35",
"62",
"44",
"45",
"52",
"46",
"13",
"23",
"41",
"91",
"42",
"43",
"32",
"36",
"22",
"21",
"15",
"64",
"63",
"61",
"37",
"31",
"14",
"51",
"71",
"12",
"65",
"54",
"53",
"33"
],
"GE": [
"01",
"AJ",
"02",
"03",
"04",
"05",
"06",
"07",
"AB",
"08",
"09",
"BUS",
"10",
"11",
"12",
"13",
"CHI",
"14",
"15",
"16",
"GAG",
"17",
"18",
"GOR",
"19",
"20",
"21",
"22",
"23",
"24",
"26",
"33",
"KUT",
"25",
"27",
"28",
"29",
"30",
"31",
"32",
"34",
"35",
"36",
"37",
"38",
"39",
"40",
"41",
"42",
"43",
"44",
"PTI",
"45",
"46",
"RUS",
"47",
"48",
"49",
"50",
"51",
"52",
"SUI",
"53",
"TBS",
"54",
"55",
"56",
"57",
"TQI",
"TQV",
"58",
"59",
"60",
"TSQ",
"61",
"62",
"ZUG",
"63"
],
"ID": [
"PB",
"PA",
"JWU",
"JB",
"JT",
"JI",
"JK",
"YO",
"KAU",
"KB",
"KS",
"KT",
"KI",
"MAU",
"MA",
"NUU",
"BA",
"NB",
"NT",
"SLU",
"SN",
"ST",
"SG",
"SA",
"SMU",
"BE",
"JA",
"LA",
"RI",
"SB",
"SS",
"SU",
"AC",
"BT",
"GO",
"KU",
"BB",
"KR",
"SR"
],
"IL": [
"D",
"M",
"2",
"HA",
"TA",
"JM"
],
"IN": [
"AN",
"AP",
"AR",
"AS",
"BR",
"CH",
"DN",
"DD",
"DL",
"GA",
"GJ",
"HR",
"HP",
"JK",
"KA",
"KL",
"LD",
"MP",
"MH",
"MN",
"ML",
"MZ",
"NL",
"OR",
"PY",
"PB",
"RJ",
"SK",
"TN",
"TR",
"UP",
"WB"
],
"IQ": [
"AN",
"BA",
"MU",
"QA",
"NA",
"AR",
"SU",
"TS",
"BG",
"BB",
"DA",
"DQ",
"DI",
"KA",
"MA",
"NI",
"WA",
"SD"
],
"IR": [
"03",
"06",
"08",
"04",
"14",
"19",
"24",
"23",
"15",
"17",
"09",
"10",
"18",
"16",
"20",
"22",
"21",
"26",
"12",
"13",
"07",
"25",
"11",
"02",
"01",
"05"
],
"JO": [
"AQ",
"BA",
"KA",
"MA",
"AZ",
"AT",
"IR",
"JA",
"MN",
"MD",
"AJ",
"AM"
],
"JP": [
"23",
"05",
"02",
"38",
"21",
"10",
"34",
"01",
"18",
"40",
"07",
"28",
"08",
"17",
"03",
"37",
"46",
"14",
"43",
"26",
"39",
"24",
"04",
"45",
"20",
"42",
"29",
"15",
"33",
"47",
"41",
"11",
"25",
"22",
"12",
"36",
"09",
"31",
"16",
"13",
"30",
"06",
"35",
"19",
"44",
"27"
],
"KG": [
"C",
"J",
"N",
"O",
"T",
"Y"
],
"KH": [
"2",
"1",
"3",
"4",
"5",
"6",
"7",
"8",
"10",
"23",
"18",
"11",
"22",
"12",
"15",
"13",
"14",
"16",
"17",
"19",
"20",
"21"
],
"KP": [
"CHA",
"HAB",
"HAN",
"HWB",
"HWN",
"KAE",
"KAN",
"NAM",
"PYB",
"PYN",
"PYO",
"YAN"
],
"KR": [
"26",
"43",
"44",
"27",
"30",
"42",
"29",
"41",
"47",
"48",
"28",
"49",
"45",
"46",
"11",
"31"
],
"KW": [
"AH",
"FA",
"JA",
"KU",
"HA"
],
"KZ": [
"ALA",
"ALM",
"AKM",
"AKT",
"ATY",
"ZAP",
"BAY",
"MAN",
"YUZ",
"PAV",
"KAR",
"KUS",
"KZY",
"VOS",
"SEV",
"ZHA"
],
"LA": [
"AT",
"BK",
"BL",
"CH",
"HO",
"KH",
"LM",
"LP",
"OU",
"PH",
"SL",
"SV",
"VT",
"VI",
"XA",
"XI",
"XE"
],
"LB": [
"BA",
"BI",
"JL",
"AS",
"JA",
"NA"
],
"LK": [
"71",
"52",
"81",
"1",
"51",
"11",
"3",
"31",
"12",
"33",
"41",
"13",
"21",
"92",
"42",
"61",
"2",
"43",
"22",
"32",
"82",
"45",
"5",
"23",
"72",
"62",
"91",
"9",
"53",
"4",
"7",
"8",
"44",
"6"
],
"MM": [
"07",
"02",
"14",
"11",
"12",
"13",
"03",
"04",
"15",
"16",
"01",
"17",
"05",
"06"
],
"MN": [
"073",
"071",
"069",
"067",
"037",
"061",
"063",
"059",
"057",
"065",
"064",
"039",
"043",
"041",
"035",
"049",
"051",
"047",
"1",
"046",
"053",
"055"
],
"MV": [
"02",
"20",
"17",
"14",
"27",
"28",
"29",
"07",
"23",
"26",
"05",
"03",
"MLE",
"12",
"25",
"13",
"01",
"24",
"08",
"04"
],
"MY": [
"J",
"K",
"D",
"M",
"N",
"C",
"A",
"R",
"P",
"SA",
"SK",
"B",
"T",
"W",
"L"
],
"NP": [
"BA",
"BH",
"DH",
"GA",
"JA",
"KA",
"KO",
"LU",
"2",
"1",
"MA",
"ME",
"NA",
"3",
"4",
"RA",
"SA",
"SE",
"5"
],
"OM": [
"DA",
"BA",
"JA",
"WU",
"SH",
"ZA",
"MA",
"MU"
],
"PK": [
"JK",
"BA",
"TA",
"IS",
"NW",
"NA",
"PB",
"SD"
],
"QA": [
"DA",
"GH",
"JU",
"KH",
"WA",
"RA",
"JB",
"MS",
"US"
],
"SA": [
"11",
"12",
"03",
"05",
"08",
"O1",
"04",
"09",
"02",
"10",
"07",
"06",
"14"
],
"SY": [
"LA",
"QU",
"HA",
"RA",
"SU",
"DR",
"DY",
"DI",
"ID",
"RD",
"TA",
"HL",
"HM",
"HI"
],
"TH": [
"37",
"15",
"31",
"24",
"18",
"36",
"22",
"50",
"57",
"20",
"86",
"46",
"62",
"71",
"40",
"81",
"10",
"52",
"51",
"42",
"16",
"58",
"44",
"49",
"26",
"73",
"48",
"30",
"60",
"80",
"55",
"96",
"39",
"43",
"12",
"13",
"94",
"82",
"93",
"S",
"56",
"67",
"76",
"66",
"65",
"14",
"54",
"83",
"25",
"77",
"85",
"70",
"21",
"45",
"27",
"47",
"11",
"74",
"75",
"19",
"91",
"33",
"17",
"90",
"64",
"72",
"84",
"32",
"63",
"92",
"23",
"34",
"41",
"61",
"53",
"95",
"35"
],
"TJ": [
"GB",
"KR",
"KT",
"LN"
],
"TM": [
"A",
"B",
"D",
"L",
"M"
],
"TR": [
"01",
"02",
"03",
"68",
"05",
"06",
"07",
"75",
"08",
"09",
"04",
"10",
"74",
"72",
"69",
"11",
"12",
"13",
"14",
"15",
"16",
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28",
"29",
"30",
"31",
"32",
"76",
"46",
"78",
"70",
"36",
"37",
"38",
"79",
"41",
"42",
"43",
"39",
"71",
"40",
"44",
"4S",
"47",
"48",
"49",
"SO",
"51",
"52",
"53",
"54",
"SS",
"56",
"57",
"S8",
"59",
"60",
"61",
"62",
"64",
"65",
"77",
"66",
"67",
"17",
"18",
"19",
"34",
"35",
"33",
"63",
"73"
],
"TW": [
"CHA",
"CYI",
"HSZ",
"HUA",
"ILA",
"KHH",
"KEE",
"MIA",
"NAN",
"PEN",
"PIF",
"TXG",
"TNN",
"TPE",
"TTT",
"TAO",
"YUN"
],
"UZ": [
"AN",
"BU",
"FA",
"JI",
"KH",
"NG",
"NW",
"QA",
"QR",
"SA",
"SI",
"SU",
"TO"
],
"VN": [
"44",
"43",
"53",
"54",
"55",
"56",
"50",
"31",
"57",
"58",
"40",
"59",
"48",
"04",
"60",
"33",
"39",
"45",
"30",
"03",
"63",
"64",
"15",
"23",
"61",
"62",
"65",
"14",
"66",
"34",
"47",
"28",
"01",
"35",
"09",
"02",
"41",
"67",
"22",
"18",
"36",
"68",
"32",
"27",
"29",
"24",
"25",
"52",
"05",
"37",
"20",
"69",
"21",
"26",
"46",
"51",
"07",
"49",
"70",
"06"
],
"YE": [
"AB",
"BA",
"JA",
"MR",
"MW",
"HU",
"DH",
"IB",
"LA",
"MA",
"SH",
"TA",
"SD",
"SN",
"HJ",
"HD",
"AD"
],
"AR": [
"B",
"C",
"K",
"H",
"U",
"W",
"X",
"E",
"P",
"Y",
"L",
"F",
"M",
"N",
"Q",
"R",
"A",
"J",
"D",
"Z",
"S",
"G",
"V",
"T"
],
"BO": [
"H",
"C",
"B",
"L",
"O",
"N",
"P",
"S",
"T"
],
"BR": [
"AC",
"AL",
"AP",
"AM",
"BA",
"CE",
"DF",
"ES",
"GO",
"MA",
"MT",
"MS",
"MG",
"PR",
"PB",
"PA",
"PE",
"PI",
"RN",
"RS",
"RJ",
"R0",
"RR",
"SC",
"SE",
"SP",
"TO"
],
"CL": [
"AI",
"AN",
"AR",
"AT",
"BI",
"CO",
"LI",
"LL",
"MA",
"ML",
"RM",
"TA",
"VS"
],
"CO": [
"AMA",
"ANT",
"ARA",
"ATL",
"BOL",
"BOY",
"CAL",
"CAQ",
"CAS",
"CAU",
"CES",
"CHO",
"CUN",
"COR",
"DC",
"GUA",
"GUV",
"HUI",
"LAG",
"MAG",
"MET",
"NAR",
"NSA",
"PUT",
"QUI",
"RIS",
"SAP",
"SAN",
"SUC",
"TOL",
"VAC",
"VAU",
"VID"
],
"EC": [
"A",
"B",
"C",
"F",
"H",
"X",
"O",
"E",
"W",
"G",
"I",
"L",
"R",
"M",
"S",
"N",
"Y",
"P",
"U",
"T",
"Z"
],
"GY": [
"BA",
"CU",
"DE",
"EB",
"ES",
"MA",
"PM",
"PT",
"UD",
"UT"
],
"PE": [
"AMA",
"ANC",
"APU",
"ARE",
"AYA",
"CAJ",
"CUS",
"CAL",
"HUV",
"HUC",
"ICA",
"JUN",
"LAL",
"LAM",
"LIM",
"LOR",
"MDD",
"MOQ",
"PAS",
"PIU",
"PUN",
"SAM",
"TAC",
"TUM",
"UCA"
],
"PY": [
"16",
"10",
"13",
"ASU",
"19",
"5",
"6",
"14",
"11",
"1",
"3",
"4",
"7",
"8",
"12",
"9",
"15",
"2"
],
"SR": [
"BR",
"CM",
"CR",
"MA",
"NI",
"PR",
"PM",
"SA",
"SI",
"WA"
],
"UY": [
"AR",
"CA",
"CL",
"CO",
"DU",
"FS",
"FD",
"LA",
"MA",
"MO",
"PA",
"RV",
"RO",
"RN",
"SA",
"SJ",
"SO",
"TA",
"TT"
],
"VE": [
"Z",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"Y",
"W",
"A",
"I",
"J",
"K",
"M",
"N",
"L",
"O",
"P",
"R",
"T",
"S",
"U",
"V"
],
"BZ": [
"BZ",
"CY",
"CZL",
"OW",
"SC",
"TOL"
],
"CR": [
"A",
"C",
"G",
"H",
"L",
"P",
"SJ"
],
"GT": [
"AV",
"BV",
"CM",
"CQ",
"PR",
"ES",
"GU",
"HU",
"IZ",
"JA",
"JU",
"PE",
"QZ",
"QC",
"RE",
"SA",
"SM",
"SR",
"SO",
"SU",
"TO",
"ZA"
],
"HN": [
"AT",
"CH",
"CL",
"CM",
"CP",
"CR",
"EP",
"FM",
"GD",
"IN",
"IB",
"LP",
"LE",
"OC",
"OL",
"SB",
"VA",
"YO"
],
"NI": [
"BO",
"CA",
"CI",
"CO",
"ES",
"GR",
"JI",
"LE",
"MD",
"MN",
"MS",
"MT",
"NS",
"RI",
"SJ",
"ZE"
],
"PA": [
"1",
"4",
"2",
"3",
"0",
"5",
"6",
"7",
"8",
"9"
],
"SV": [
"AH",
"CA",
"CH",
"CU",
"LI",
"PA",
"UN",
"MO",
"SM",
"SS",
"SV",
"SA",
"SO",
"SU"
],
"BS": [
"AC",
"BI",
"CI",
"EX",
"FP",
"FC",
"GH",
"GT",
"HI",
"HR",
"IN",
"KB",
"LI",
"MH",
"MG",
"NP",
"NB",
"RI",
"RS",
"SR",
"SP"
],
"CU": [
"09",
"03",
"12",
"14",
"11",
"99",
"02",
"10",
"04",
"01",
"07",
"13",
"05"
],
"DO": [
"AZ",
"BR",
"BH",
"DA",
"DN",
"DU",
"SE",
"HM",
"IN",
"AL",
"EP",
"RO",
"VE",
"MT",
"MN",
"MC",
"MP",
"PN",
"PR",
"PP",
"SC",
"SM",
"CR",
"JU",
"PM",
"SZ",
"ST",
"SR",
"VA"
],
"HT": [
"AR",
"CE",
"GA",
"ND",
"NE",
"NO",
"OU",
"SD",
"SE"
],
"JM": [
"13",
"09",
"01",
"12",
"04",
"02",
"06",
"14",
"11",
"08",
"05",
"03",
"07",
"10"
],
"TT": [
"ARI",
"CHA",
"CTT",
"DMN",
"ETO",
"PED",
"PTF",
"POS",
"PRT",
"RCM",
"SFO",
"SJL",
"SGE",
"SIP",
"TUP",
"WTO"
],
"AO": [
"BGO",
"BGU",
"BIE",
"CAB",
"CCU",
"CNO",
"CUS",
"CNN",
"HUA",
"HUI",
"LUA",
"LNO",
"LSU",
"MAL",
"MOX",
"NAM",
"UIG",
"ZAI"
],
"BF": [
"BAL",
"BAM",
"BAN",
"BAZ",
"BGR",
"BLG",
"BLK",
"COM",
"GAN",
"GNA",
"GOU",
"HOU",
"IOB",
"KAD",
"KMD",
"KMP",
"KOS",
"KOP",
"KOT",
"KOW",
"KEN",
"LOR",
"LER",
"MOU",
"NAO",
"NAM",
"NAY",
"NOU",
"OUB",
"OUD",
"PAS",
"PON",
"SNG",
"SMT",
"SIS",
"SOM",
"SOR",
"SEN",
"TAP",
"TUI",
"YAG",
"YAT",
"ZIR",
"ZON",
"ZOU"
],
"BI": [
"BB",
"BJ",
"BR",
"CA",
"CI",
"GI",
"KR",
"KY",
"KI",
"MA",
"MU",
"MY",
"NG",
"RT",
"RY"
],
"BJ": [
"AK",
"AQ",
"BO",
"MO",
"OU",
"ZO"
],
"BW": [
"CE",
"CH",
"GH",
"KG",
"KL",
"KW",
"NG",
"NE",
"SE",
"SO"
],
"CD": [
"BN",
"BC",
"HC",
"KW",
"KE",
"KA",
"KN",
"MA",
"NK",
"SK",
"EQ"
],
"CF": [
"BB",
"BGF",
"BK",
"HM",
"HK",
"KG",
"LB",
"HS",
"MB",
"KB",
"NM",
"MP",
"UK",
"AC",
"OP",
"SE",
"VK"
],
"CG": [
"11",
"BZV",
"8",
"15",
"5",
"7",
"2",
"9",
"14",
"12",
"13"
],
"CI": [
"06",
"16",
"09",
"10",
"02",
"07",
"01",
"12",
"05",
"11",
"03",
"15",
"13",
"04",
"14",
"08"
],
"CM": [
"AD",
"CE",
"ES",
"EN",
"LT",
"NO",
"NW",
"SU",
"SW",
"OU"
],
"CV": [
"BV",
"BR",
"FO",
"B",
"S",
"MA",
"PA",
"PN",
"PR",
"RG",
"SL",
"CA",
"CR",
"SN",
"SV",
"TA"
],
"DJ": [
"AS",
"DI",
"DJ",
"OB",
"TA"
],
"DZ": [
"01",
"16",
"44",
"46",
"05",
"07",
"09",
"34",
"10",
"35",
"08",
"06",
"02",
"25",
"17",
"32",
"39",
"36",
"47",
"24",
"33",
"18",
"40",
"03",
"29",
"43",
"27",
"28",
"26",
"45",
"31",
"30",
"04",
"48",
"20",
"22",
"21",
"41",
"19",
"11",
"14",
"37",
"42",
"38",
"15",
"13",
"12"
],
"EG": [
"DK",
"BA",
"BH",
"FYM",
"GH",
"ALX",
"IS",
"GZ",
"MN",
"MNF",
"KB",
"C",
"WAD",
"SUZ",
"SHR",
"ASN",
"AST",
"BNS",
"PTS",
"DT",
"JS",
"KFS",
"MT",
"KN",
"SIN",
"SHG"
],
"ER": [
"AG",
"AS",
"BA",
"DE",
"GS",
"HA",
"SA",
"SM",
"SN",
"SR"
],
"ET": [
"AA",
"AF",
"AM",
"BE",
"GA",
"HA",
"OR",
"SO",
"SN",
"TI"
],
"GA": [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"
],
"GH": [
"AH",
"BA",
"CP",
"EP",
"AA",
"NP",
"UE",
"UW",
"TV",
"WP"
],
"GM": [
"B",
"L",
"M",
"N",
"U",
"W"
],
"GN": [
"B",
"BE",
"BF",
"BK",
"C",
"CO",
"DB",
"DL",
"DI",
"DU",
"FA",
"F",
"FO",
"FR",
"GA",
"GU",
"KA",
"K",
"KD",
"D",
"KS",
"KB",
"KO",
"KE",
"LA",
"L",
"LO",
"LE",
"MC",
"ML",
"MM",
"M",
"MD",
"NZ",
"N",
"PI",
"SI",
"TO",
"TE",
"YO"
],
"GQ": [
"AN",
"BN",
"BS",
"CS",
"KN",
"LI",
"C",
"I",
"WN"
],
"GW": [
"BA",
"BM",
"BS",
"BL",
"CA",
"GA",
"OI",
"QU"
],
"KE": [
"200",
"300",
"400",
"110",
"500",
"600",
"700",
"900"
],
"KM": [
"A",
"G",
"M"
],
"LR": [
"BM",
"BG",
"GB",
"CM",
"GG",
"GK",
"LO",
"MG",
"MY",
"MO",
"NI",
"RI",
"SI"
],
"LS": [
"D",
"B",
"C",
"E",
"A",
"F",
"J",
"H",
"G",
"K"
],
"LY": [
"BU",
"JA",
"JG",
"Ju",
"Wu",
"WA",
"ZA",
"BA",
"FA",
"MI",
"NA",
"SF",
"TB"
],
"MA": [
"AGD",
"HAO",
"HOC",
"ASZ",
"AZI",
"BAH",
"MEL",
"BES",
"BEM",
"BER",
"BOD",
"BOM",
"CAS",
"CE",
"CN",
"CS",
"CHE",
"CHI",
"HAJ",
"JDI",
"ERR",
"ESM",
"ESI",
"ES",
"FIG",
"FES",
"GUE",
"IFR",
"IRA",
"KES",
"KHE",
"KHN",
"KHO",
"KEN",
"LAA",
"LAR",
"MAR",
"MEK",
"NAD",
"NO",
"OUA",
"OUD",
"OUJ",
"RBA",
"SAF",
"SEF",
"SET",
"SIK",
"SU",
"TNT",
"TNG",
"TAO",
"TAR",
"TAT",
"TAZ",
"TS",
"TIZ",
"TET"
],
"MG": [
"T",
"D",
"F",
"M",
"A",
"U"
],
"ML": [
"BKO",
"7",
"1",
"8",
"2",
"5",
"3",
"4",
"6"
],
"MR": [
"07",
"03",
"05",
"08",
"04",
"10",
"01",
"02",
"12",
"NKC",
"09",
"11",
"06"
],
"MU": [
"AG",
"BR",
"BL",
"CC",
"CU",
"FL",
"GP",
"MO",
"PA",
"PW",
"PL",
"QB",
"RR",
"RO",
"SA",
"VP"
],
"MW": [
"BL",
"C",
"CK",
"CR",
"CT",
"DE",
"DO",
"KR",
"KS",
"LI",
"MH",
"MG",
"MC",
"MU",
"MW",
"MZ",
"NB",
"NK",
"N",
"NS",
"NU",
"NI",
"RU",
"SA",
"S",
"TH",
"ZO"
],
"MZ": [
"P",
"G",
"I",
"B",
"MPM",
"L",
"N",
"A",
"S",
"T",
"Q"
],
"NA": [
"CA",
"ER",
"HA",
"KA",
"KH",
"KU",
"OW",
"OK",
"OH",
"OS",
"ON",
"OT",
"OD"
],
"NE": [
"1",
"2",
"3",
"4",
"8",
"5",
"6",
"7"
],
"NG": [
"AB",
"FC",
"AD",
"AK",
"AN",
"BA",
"BE",
"BO",
"CR",
"DE",
"ED",
"EN",
"IM",
"JI",
"KD",
"KN",
"KT",
"KE",
"KO",
"KW",
"LA",
"NI",
"OG",
"ON",
"OS",
"OY",
"PL",
"RI",
"SO",
"TA",
"YO"
],
"RW": [
"C",
"I",
"E",
"D",
"G",
"B",
"J",
"F",
"K",
"L",
"M",
"H"
],
"SD": [
"26",
"18",
"07",
"03",
"06",
"22",
"04",
"08",
"24",
"01",
"23",
"17",
"14",
"12",
"10",
"16",
"11",
"13",
"20",
"05",
"15",
"02",
"09",
"19",
"25",
"21"
],
"SL": [
"E",
"N",
"S",
"W"
],
"SN": [
"DK",
"DB",
"FK",
"KL",
"KD",
"LG",
"SL",
"TC",
"TH",
"ZG"
],
"SO": [
"AW",
"BY",
"BK",
"BN",
"BR",
"GA",
"GE",
"HI",
"JD",
"JH",
"MU",
"NU",
"SA",
"SD",
"SH",
"SO",
"TO",
"WO"
],
"ST": [
"P",
"S"
],
"SZ": [
"HH",
"LU",
"MA",
"SH"
],
"TD": [
"BA",
"BI",
"BET",
"CB",
"GR",
"KA",
"LC",
"LO",
"LR",
"MK",
"MC",
"OD",
"SA",
"TA"
],
"TG": [
"C",
"K",
"M",
"P",
"S"
],
"TN": [
"13",
"23",
"31",
"81",
"71",
"32",
"41",
"42",
"73",
"12",
"33",
"53",
"82",
"52",
"21",
"61",
"43",
"34",
"51",
"83",
"72",
"11",
"22"
],
"TZ": [
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20",
"21",
"22",
"23",
"24",
"25"
],
"UG": [
"APA",
"ARU",
"BUN",
"BUS",
"GUL",
"HOI",
"IGA",
"JIN",
"KBL",
"KBR",
"KLG",
"KLA",
"KLI",
"KAP",
"KAS",
"KLE",
"KIB",
"KIS",
"KIT",
"KOT",
"KUM",
"LIR",
"LUW",
"MSK",
"MSI",
"MBL",
"MBR",
"MOR",
"MOY",
"MPI",
"MUB",
"MUK",
"NEB",
"NTU",
"PAL",
"RAK",
"RUK",
"SOR",
"TOR"
],
"ZA": [
"EC",
"FS",
"GT",
"NL",
"MP",
"NW",
"NC",
"NP",
"WC"
],
"ZM": [
"02",
"08",
"03",
"04",
"09",
"06",
"05",
"07",
"01"
],
"ZW": [
"BU",
"HA",
"MA",
"MC",
"ME",
"MW",
"MV",
"MN",
"MS",
"MI"
]
},
"meta": {
"managed_by_zonely": false
},
"created": 1587399600,
"updated": 1587399600
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 2,
"current_page": 1,
"total_pages": 1,
"links": {}
}
}
}
Request
GET v1/fulfillment/physical/zones
Create fulfillment zone
Create a new fulfillment zone for the current merchant.
Example request:
curl --request POST \
"https://api.chec.io/v1/fulfillment/physical/zones" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"name\": \"United States\"
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/fulfillment/physical/zones"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/fulfillment/physical/zones'
payload = {
"name": "United States"
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"id": "zone_1ypbroE658n4ea",
"name": "International",
"countries": [
"CA",
"MX",
"NZ",
"AU",
"AS",
"CC",
"CK",
"CX",
"FJ",
"FM",
"GU",
"KI",
"MH",
"MP",
"NC",
"NF",
"NR",
"NU",
"PF",
"PG",
"PN",
"PW",
"SB",
"TK",
"TO",
"TV",
"VU",
"WF",
"WS",
"AE",
"AF",
"AM",
"AZ",
"BD",
"BH",
"BN",
"BT",
"CN",
"GE",
"HK",
"ID",
"IL",
"IN",
"IQ",
"IR",
"JO",
"JP",
"KG",
"KH",
"KP",
"KR",
"KW",
"KZ",
"LA",
"LB",
"LK",
"MM",
"MN",
"MO",
"MV",
"MY",
"NP",
"OM",
"PH",
"PK",
"PS",
"QA",
"SA",
"SG",
"SY",
"TH",
"TJ",
"TL",
"TM",
"TR",
"TW",
"UZ",
"VN",
"YE",
"AR",
"BO",
"BR",
"CL",
"CO",
"EC",
"FK",
"GF",
"GS",
"GY",
"PE",
"PY",
"SR",
"UY",
"VE",
"BM",
"BZ",
"CR",
"GT",
"HN",
"NI",
"PA",
"PM",
"SV",
"UM",
"AG",
"AI",
"AW",
"BB",
"BL",
"BS",
"CU",
"CW",
"DM",
"DO",
"GD",
"GP",
"HT",
"JM",
"KN",
"KY",
"LC",
"MF",
"MQ",
"MS",
"PR",
"SX",
"TC",
"TT",
"VC",
"VG",
"VI",
"AO",
"BF",
"BI",
"BJ",
"BW",
"CD",
"CF",
"CG",
"CI",
"CM",
"CV",
"DJ",
"DZ",
"EG",
"EH",
"ER",
"ET",
"GA",
"GH",
"GM",
"GN",
"GQ",
"GW",
"IO",
"KE",
"KM",
"LR",
"LS",
"LY",
"MA",
"MG",
"ML",
"MR",
"MU",
"MW",
"MZ",
"NA",
"NE",
"NG",
"RE",
"RW",
"SC",
"SD",
"SL",
"SN",
"SO",
"SS",
"ST",
"SZ",
"TD",
"TG",
"TN",
"TZ",
"UG",
"YT",
"ZA",
"ZM",
"ZW"
],
"subdivisions": {
"CA": [
"AB",
"BC",
"MB",
"NB",
"NL",
"NT",
"NS",
"NU",
"ON",
"PE",
"QC",
"SK",
"YT"
],
"MX": [
"AGU",
"BCN",
"BCS",
"CAM",
"CHP",
"CHH",
"COA",
"COL",
"DIF",
"DUR",
"GUA",
"GRO",
"HID",
"JAL",
"MIC",
"MOR",
"MEX",
"NAY",
"NLE",
"OAX",
"PUE",
"QUE",
"ROO",
"SLP",
"SIN",
"SON",
"TAB",
"TAM",
"TLA",
"VER",
"YUC",
"ZAC"
],
"NZ": [
"AUK",
"BOP",
"CAN",
"GIS",
"HKB",
"MWT",
"MBH",
"NSN",
"NTL",
"OTA",
"STL",
"TKI",
"TAS",
"WKO",
"WGN",
"WTC"
],
"AU": [
"ACT",
"NSW",
"NT",
"QLD",
"SA",
"TAS",
"VIC",
"WA"
],
"FJ": [
"C",
"E",
"N",
"R",
"W"
],
"FM": [
"KSA",
"PNI",
"YAP",
"TRK"
],
"KI": [
"G",
"L",
"P"
],
"MH": [
"ALL",
"ALK",
"ARN",
"AUR",
"EBO",
"ENI",
"JAL",
"KIL",
"KWA",
"LAE",
"LIB",
"LIK",
"MAJ",
"MAL",
"MEJ",
"MIL",
"NMK",
"NMU",
"L",
"T",
"RON",
"UJA",
"UJL",
"UTI",
"WTH",
"WTJ"
],
"PG": [
"CPM",
"CPK",
"EBR",
"ESW",
"EHG",
"EPW",
"GPK",
"MPM",
"MRL",
"MBA",
"MPL",
"NCD",
"NIK",
"NSA",
"NPP",
"SAN",
"SHM",
"WBK",
"WPD",
"WHM"
],
"SB": [
"CT",
"CE",
"GU",
"IS",
"MK",
"ML",
"TE",
"WE"
],
"VU": [
"MAP",
"PAM",
"SAM",
"SEE",
"TAE",
"TOB"
],
"WS": [
"AA",
"AL",
"AT",
"FA",
"GE",
"GI",
"PA",
"SA",
"TU",
"VF",
"VS"
],
"AE": [
"AZ",
"FU",
"SH",
"DU",
"RK",
"UQ",
"AJ"
],
"AF": [
"BDS",
"BGL",
"BAL",
"BDG",
"BAM",
"FRA",
"FYB",
"GHA",
"GHO",
"HEL",
"HER",
"JOW",
"KAB",
"KAN",
"KNR",
"KDZ",
"KAP",
"LAG",
"LOW",
"NAN",
"NIM",
"ORU",
"PKA",
"PIA",
"PAR",
"SAM",
"SAR",
"TAK",
"WAR",
"ZAB"
],
"AM": [
"AG",
"AR",
"AV",
"ER",
"GR",
"KT",
"LO",
"SU",
"TV",
"VD",
"SH"
],
"AZ": [
"ABS",
"AST",
"AGC",
"AGM",
"AGS",
"AGA",
"AGU",
"BAB",
"BA",
"BAL",
"BEY",
"BIL",
"BAR",
"CUL",
"CAB",
"CAL",
"DAS",
"DAV",
"FUZ",
"GOR",
"GAD",
"GA",
"GOY",
"HAC",
"IMI",
"ISM",
"KAL",
"KUR",
"LAC",
"LER",
"LAN",
"LA",
"MAS",
"MI",
"NA",
"MM",
"NEF",
"ORD",
"OGU",
"QAX",
"QAZ",
"QOB",
"QBA",
"QBI",
"QUS",
"QAB",
"SAT",
"SAB",
"SAL",
"SMX",
"SIY",
"SM",
"SAD",
"TOV",
"TAR",
"UCA",
"XA",
"XAN",
"XAC",
"XIZ",
"XCI",
"XVD",
"YAR",
"YEV",
"YE",
"ZAQ",
"ZAN",
"ZAR",
"AB",
"SAH",
"SMI",
"SUS",
"SS",
"SA",
"SAK",
"SKR",
"SAR"
],
"BD": [
"2A",
"1B",
"1",
"5C",
"2E",
"2D",
"2",
"2F",
"3G",
"3",
"5H",
"3I",
"3J",
"4K",
"4L",
"4",
"4M",
"3N",
"2O",
"5P",
"1Q",
"5R",
"5",
"5S",
"2T",
"3U"
],
"BH": [
"03",
"10",
"07",
"05",
"02",
"01",
"09",
"04",
"12",
"08",
"11",
"06"
],
"BN": [
"BE",
"BM",
"TE",
"TU"
],
"BT": [
"33",
"12",
"22",
"GA",
"13",
"44",
"42",
"11",
"43",
"23",
"45",
"14",
"31",
"15",
"TY",
"41",
"32",
"21",
"24",
"34"
],
"CN": [
"34",
"11",
"50",
"35",
"62",
"44",
"45",
"52",
"46",
"13",
"23",
"41",
"91",
"42",
"43",
"32",
"36",
"22",
"21",
"15",
"64",
"63",
"61",
"37",
"31",
"14",
"51",
"71",
"12",
"65",
"54",
"53",
"33"
],
"GE": [
"01",
"AJ",
"02",
"03",
"04",
"05",
"06",
"07",
"AB",
"08",
"09",
"BUS",
"10",
"11",
"12",
"13",
"CHI",
"14",
"15",
"16",
"GAG",
"17",
"18",
"GOR",
"19",
"20",
"21",
"22",
"23",
"24",
"26",
"33",
"KUT",
"25",
"27",
"28",
"29",
"30",
"31",
"32",
"34",
"35",
"36",
"37",
"38",
"39",
"40",
"41",
"42",
"43",
"44",
"PTI",
"45",
"46",
"RUS",
"47",
"48",
"49",
"50",
"51",
"52",
"SUI",
"53",
"TBS",
"54",
"55",
"56",
"57",
"TQI",
"TQV",
"58",
"59",
"60",
"TSQ",
"61",
"62",
"ZUG",
"63"
],
"ID": [
"PB",
"PA",
"JWU",
"JB",
"JT",
"JI",
"JK",
"YO",
"KAU",
"KB",
"KS",
"KT",
"KI",
"MAU",
"MA",
"NUU",
"BA",
"NB",
"NT",
"SLU",
"SN",
"ST",
"SG",
"SA",
"SMU",
"BE",
"JA",
"LA",
"RI",
"SB",
"SS",
"SU",
"AC",
"BT",
"GO",
"KU",
"BB",
"KR",
"SR"
],
"IL": [
"D",
"M",
"2",
"HA",
"TA",
"JM"
],
"IN": [
"AN",
"AP",
"AR",
"AS",
"BR",
"CH",
"DN",
"DD",
"DL",
"GA",
"GJ",
"HR",
"HP",
"JK",
"KA",
"KL",
"LD",
"MP",
"MH",
"MN",
"ML",
"MZ",
"NL",
"OR",
"PY",
"PB",
"RJ",
"SK",
"TN",
"TR",
"UP",
"WB"
],
"IQ": [
"AN",
"BA",
"MU",
"QA",
"NA",
"AR",
"SU",
"TS",
"BG",
"BB",
"DA",
"DQ",
"DI",
"KA",
"MA",
"NI",
"WA",
"SD"
],
"IR": [
"03",
"06",
"08",
"04",
"14",
"19",
"24",
"23",
"15",
"17",
"09",
"10",
"18",
"16",
"20",
"22",
"21",
"26",
"12",
"13",
"07",
"25",
"11",
"02",
"01",
"05"
],
"JO": [
"AQ",
"BA",
"KA",
"MA",
"AZ",
"AT",
"IR",
"JA",
"MN",
"MD",
"AJ",
"AM"
],
"JP": [
"23",
"05",
"02",
"38",
"21",
"10",
"34",
"01",
"18",
"40",
"07",
"28",
"08",
"17",
"03",
"37",
"46",
"14",
"43",
"26",
"39",
"24",
"04",
"45",
"20",
"42",
"29",
"15",
"33",
"47",
"41",
"11",
"25",
"22",
"12",
"36",
"09",
"31",
"16",
"13",
"30",
"06",
"35",
"19",
"44",
"27"
],
"KG": [
"C",
"J",
"N",
"O",
"T",
"Y"
],
"KH": [
"2",
"1",
"3",
"4",
"5",
"6",
"7",
"8",
"10",
"23",
"18",
"11",
"22",
"12",
"15",
"13",
"14",
"16",
"17",
"19",
"20",
"21"
],
"KP": [
"CHA",
"HAB",
"HAN",
"HWB",
"HWN",
"KAE",
"KAN",
"NAM",
"PYB",
"PYN",
"PYO",
"YAN"
],
"KR": [
"26",
"43",
"44",
"27",
"30",
"42",
"29",
"41",
"47",
"48",
"28",
"49",
"45",
"46",
"11",
"31"
],
"KW": [
"AH",
"FA",
"JA",
"KU",
"HA"
],
"KZ": [
"ALA",
"ALM",
"AKM",
"AKT",
"ATY",
"ZAP",
"BAY",
"MAN",
"YUZ",
"PAV",
"KAR",
"KUS",
"KZY",
"VOS",
"SEV",
"ZHA"
],
"LA": [
"AT",
"BK",
"BL",
"CH",
"HO",
"KH",
"LM",
"LP",
"OU",
"PH",
"SL",
"SV",
"VT",
"VI",
"XA",
"XI",
"XE"
],
"LB": [
"BA",
"BI",
"JL",
"AS",
"JA",
"NA"
],
"LK": [
"71",
"52",
"81",
"1",
"51",
"11",
"3",
"31",
"12",
"33",
"41",
"13",
"21",
"92",
"42",
"61",
"2",
"43",
"22",
"32",
"82",
"45",
"5",
"23",
"72",
"62",
"91",
"9",
"53",
"4",
"7",
"8",
"44",
"6"
],
"MM": [
"07",
"02",
"14",
"11",
"12",
"13",
"03",
"04",
"15",
"16",
"01",
"17",
"05",
"06"
],
"MN": [
"073",
"071",
"069",
"067",
"037",
"061",
"063",
"059",
"057",
"065",
"064",
"039",
"043",
"041",
"035",
"049",
"051",
"047",
"1",
"046",
"053",
"055"
],
"MV": [
"02",
"20",
"17",
"14",
"27",
"28",
"29",
"07",
"23",
"26",
"05",
"03",
"MLE",
"12",
"25",
"13",
"01",
"24",
"08",
"04"
],
"MY": [
"J",
"K",
"D",
"M",
"N",
"C",
"A",
"R",
"P",
"SA",
"SK",
"B",
"T",
"W",
"L"
],
"NP": [
"BA",
"BH",
"DH",
"GA",
"JA",
"KA",
"KO",
"LU",
"2",
"1",
"MA",
"ME",
"NA",
"3",
"4",
"RA",
"SA",
"SE",
"5"
],
"OM": [
"DA",
"BA",
"JA",
"WU",
"SH",
"ZA",
"MA",
"MU"
],
"PK": [
"JK",
"BA",
"TA",
"IS",
"NW",
"NA",
"PB",
"SD"
],
"QA": [
"DA",
"GH",
"JU",
"KH",
"WA",
"RA",
"JB",
"MS",
"US"
],
"SA": [
"11",
"12",
"03",
"05",
"08",
"O1",
"04",
"09",
"02",
"10",
"07",
"06",
"14"
],
"SY": [
"LA",
"QU",
"HA",
"RA",
"SU",
"DR",
"DY",
"DI",
"ID",
"RD",
"TA",
"HL",
"HM",
"HI"
],
"TH": [
"37",
"15",
"31",
"24",
"18",
"36",
"22",
"50",
"57",
"20",
"86",
"46",
"62",
"71",
"40",
"81",
"10",
"52",
"51",
"42",
"16",
"58",
"44",
"49",
"26",
"73",
"48",
"30",
"60",
"80",
"55",
"96",
"39",
"43",
"12",
"13",
"94",
"82",
"93",
"S",
"56",
"67",
"76",
"66",
"65",
"14",
"54",
"83",
"25",
"77",
"85",
"70",
"21",
"45",
"27",
"47",
"11",
"74",
"75",
"19",
"91",
"33",
"17",
"90",
"64",
"72",
"84",
"32",
"63",
"92",
"23",
"34",
"41",
"61",
"53",
"95",
"35"
],
"TJ": [
"GB",
"KR",
"KT",
"LN"
],
"TM": [
"A",
"B",
"D",
"L",
"M"
],
"TR": [
"01",
"02",
"03",
"68",
"05",
"06",
"07",
"75",
"08",
"09",
"04",
"10",
"74",
"72",
"69",
"11",
"12",
"13",
"14",
"15",
"16",
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28",
"29",
"30",
"31",
"32",
"76",
"46",
"78",
"70",
"36",
"37",
"38",
"79",
"41",
"42",
"43",
"39",
"71",
"40",
"44",
"4S",
"47",
"48",
"49",
"SO",
"51",
"52",
"53",
"54",
"SS",
"56",
"57",
"S8",
"59",
"60",
"61",
"62",
"64",
"65",
"77",
"66",
"67",
"17",
"18",
"19",
"34",
"35",
"33",
"63",
"73"
],
"TW": [
"CHA",
"CYI",
"HSZ",
"HUA",
"ILA",
"KHH",
"KEE",
"MIA",
"NAN",
"PEN",
"PIF",
"TXG",
"TNN",
"TPE",
"TTT",
"TAO",
"YUN"
],
"UZ": [
"AN",
"BU",
"FA",
"JI",
"KH",
"NG",
"NW",
"QA",
"QR",
"SA",
"SI",
"SU",
"TO"
],
"VN": [
"44",
"43",
"53",
"54",
"55",
"56",
"50",
"31",
"57",
"58",
"40",
"59",
"48",
"04",
"60",
"33",
"39",
"45",
"30",
"03",
"63",
"64",
"15",
"23",
"61",
"62",
"65",
"14",
"66",
"34",
"47",
"28",
"01",
"35",
"09",
"02",
"41",
"67",
"22",
"18",
"36",
"68",
"32",
"27",
"29",
"24",
"25",
"52",
"05",
"37",
"20",
"69",
"21",
"26",
"46",
"51",
"07",
"49",
"70",
"06"
],
"YE": [
"AB",
"BA",
"JA",
"MR",
"MW",
"HU",
"DH",
"IB",
"LA",
"MA",
"SH",
"TA",
"SD",
"SN",
"HJ",
"HD",
"AD"
],
"AR": [
"B",
"C",
"K",
"H",
"U",
"W",
"X",
"E",
"P",
"Y",
"L",
"F",
"M",
"N",
"Q",
"R",
"A",
"J",
"D",
"Z",
"S",
"G",
"V",
"T"
],
"BO": [
"H",
"C",
"B",
"L",
"O",
"N",
"P",
"S",
"T"
],
"BR": [
"AC",
"AL",
"AP",
"AM",
"BA",
"CE",
"DF",
"ES",
"GO",
"MA",
"MT",
"MS",
"MG",
"PR",
"PB",
"PA",
"PE",
"PI",
"RN",
"RS",
"RJ",
"R0",
"RR",
"SC",
"SE",
"SP",
"TO"
],
"CL": [
"AI",
"AN",
"AR",
"AT",
"BI",
"CO",
"LI",
"LL",
"MA",
"ML",
"RM",
"TA",
"VS"
],
"CO": [
"AMA",
"ANT",
"ARA",
"ATL",
"BOL",
"BOY",
"CAL",
"CAQ",
"CAS",
"CAU",
"CES",
"CHO",
"CUN",
"COR",
"DC",
"GUA",
"GUV",
"HUI",
"LAG",
"MAG",
"MET",
"NAR",
"NSA",
"PUT",
"QUI",
"RIS",
"SAP",
"SAN",
"SUC",
"TOL",
"VAC",
"VAU",
"VID"
],
"EC": [
"A",
"B",
"C",
"F",
"H",
"X",
"O",
"E",
"W",
"G",
"I",
"L",
"R",
"M",
"S",
"N",
"Y",
"P",
"U",
"T",
"Z"
],
"GY": [
"BA",
"CU",
"DE",
"EB",
"ES",
"MA",
"PM",
"PT",
"UD",
"UT"
],
"PE": [
"AMA",
"ANC",
"APU",
"ARE",
"AYA",
"CAJ",
"CUS",
"CAL",
"HUV",
"HUC",
"ICA",
"JUN",
"LAL",
"LAM",
"LIM",
"LOR",
"MDD",
"MOQ",
"PAS",
"PIU",
"PUN",
"SAM",
"TAC",
"TUM",
"UCA"
],
"PY": [
"16",
"10",
"13",
"ASU",
"19",
"5",
"6",
"14",
"11",
"1",
"3",
"4",
"7",
"8",
"12",
"9",
"15",
"2"
],
"SR": [
"BR",
"CM",
"CR",
"MA",
"NI",
"PR",
"PM",
"SA",
"SI",
"WA"
],
"UY": [
"AR",
"CA",
"CL",
"CO",
"DU",
"FS",
"FD",
"LA",
"MA",
"MO",
"PA",
"RV",
"RO",
"RN",
"SA",
"SJ",
"SO",
"TA",
"TT"
],
"VE": [
"Z",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"Y",
"W",
"A",
"I",
"J",
"K",
"M",
"N",
"L",
"O",
"P",
"R",
"T",
"S",
"U",
"V"
],
"BZ": [
"BZ",
"CY",
"CZL",
"OW",
"SC",
"TOL"
],
"CR": [
"A",
"C",
"G",
"H",
"L",
"P",
"SJ"
],
"GT": [
"AV",
"BV",
"CM",
"CQ",
"PR",
"ES",
"GU",
"HU",
"IZ",
"JA",
"JU",
"PE",
"QZ",
"QC",
"RE",
"SA",
"SM",
"SR",
"SO",
"SU",
"TO",
"ZA"
],
"HN": [
"AT",
"CH",
"CL",
"CM",
"CP",
"CR",
"EP",
"FM",
"GD",
"IN",
"IB",
"LP",
"LE",
"OC",
"OL",
"SB",
"VA",
"YO"
],
"NI": [
"BO",
"CA",
"CI",
"CO",
"ES",
"GR",
"JI",
"LE",
"MD",
"MN",
"MS",
"MT",
"NS",
"RI",
"SJ",
"ZE"
],
"PA": [
"1",
"4",
"2",
"3",
"0",
"5",
"6",
"7",
"8",
"9"
],
"SV": [
"AH",
"CA",
"CH",
"CU",
"LI",
"PA",
"UN",
"MO",
"SM",
"SS",
"SV",
"SA",
"SO",
"SU"
],
"BS": [
"AC",
"BI",
"CI",
"EX",
"FP",
"FC",
"GH",
"GT",
"HI",
"HR",
"IN",
"KB",
"LI",
"MH",
"MG",
"NP",
"NB",
"RI",
"RS",
"SR",
"SP"
],
"CU": [
"09",
"03",
"12",
"14",
"11",
"99",
"02",
"10",
"04",
"01",
"07",
"13",
"05"
],
"DO": [
"AZ",
"BR",
"BH",
"DA",
"DN",
"DU",
"SE",
"HM",
"IN",
"AL",
"EP",
"RO",
"VE",
"MT",
"MN",
"MC",
"MP",
"PN",
"PR",
"PP",
"SC",
"SM",
"CR",
"JU",
"PM",
"SZ",
"ST",
"SR",
"VA"
],
"HT": [
"AR",
"CE",
"GA",
"ND",
"NE",
"NO",
"OU",
"SD",
"SE"
],
"JM": [
"13",
"09",
"01",
"12",
"04",
"02",
"06",
"14",
"11",
"08",
"05",
"03",
"07",
"10"
],
"TT": [
"ARI",
"CHA",
"CTT",
"DMN",
"ETO",
"PED",
"PTF",
"POS",
"PRT",
"RCM",
"SFO",
"SJL",
"SGE",
"SIP",
"TUP",
"WTO"
],
"AO": [
"BGO",
"BGU",
"BIE",
"CAB",
"CCU",
"CNO",
"CUS",
"CNN",
"HUA",
"HUI",
"LUA",
"LNO",
"LSU",
"MAL",
"MOX",
"NAM",
"UIG",
"ZAI"
],
"BF": [
"BAL",
"BAM",
"BAN",
"BAZ",
"BGR",
"BLG",
"BLK",
"COM",
"GAN",
"GNA",
"GOU",
"HOU",
"IOB",
"KAD",
"KMD",
"KMP",
"KOS",
"KOP",
"KOT",
"KOW",
"KEN",
"LOR",
"LER",
"MOU",
"NAO",
"NAM",
"NAY",
"NOU",
"OUB",
"OUD",
"PAS",
"PON",
"SNG",
"SMT",
"SIS",
"SOM",
"SOR",
"SEN",
"TAP",
"TUI",
"YAG",
"YAT",
"ZIR",
"ZON",
"ZOU"
],
"BI": [
"BB",
"BJ",
"BR",
"CA",
"CI",
"GI",
"KR",
"KY",
"KI",
"MA",
"MU",
"MY",
"NG",
"RT",
"RY"
],
"BJ": [
"AK",
"AQ",
"BO",
"MO",
"OU",
"ZO"
],
"BW": [
"CE",
"CH",
"GH",
"KG",
"KL",
"KW",
"NG",
"NE",
"SE",
"SO"
],
"CD": [
"BN",
"BC",
"HC",
"KW",
"KE",
"KA",
"KN",
"MA",
"NK",
"SK",
"EQ"
],
"CF": [
"BB",
"BGF",
"BK",
"HM",
"HK",
"KG",
"LB",
"HS",
"MB",
"KB",
"NM",
"MP",
"UK",
"AC",
"OP",
"SE",
"VK"
],
"CG": [
"11",
"BZV",
"8",
"15",
"5",
"7",
"2",
"9",
"14",
"12",
"13"
],
"CI": [
"06",
"16",
"09",
"10",
"02",
"07",
"01",
"12",
"05",
"11",
"03",
"15",
"13",
"04",
"14",
"08"
],
"CM": [
"AD",
"CE",
"ES",
"EN",
"LT",
"NO",
"NW",
"SU",
"SW",
"OU"
],
"CV": [
"BV",
"BR",
"FO",
"B",
"S",
"MA",
"PA",
"PN",
"PR",
"RG",
"SL",
"CA",
"CR",
"SN",
"SV",
"TA"
],
"DJ": [
"AS",
"DI",
"DJ",
"OB",
"TA"
],
"DZ": [
"01",
"16",
"44",
"46",
"05",
"07",
"09",
"34",
"10",
"35",
"08",
"06",
"02",
"25",
"17",
"32",
"39",
"36",
"47",
"24",
"33",
"18",
"40",
"03",
"29",
"43",
"27",
"28",
"26",
"45",
"31",
"30",
"04",
"48",
"20",
"22",
"21",
"41",
"19",
"11",
"14",
"37",
"42",
"38",
"15",
"13",
"12"
],
"EG": [
"DK",
"BA",
"BH",
"FYM",
"GH",
"ALX",
"IS",
"GZ",
"MN",
"MNF",
"KB",
"C",
"WAD",
"SUZ",
"SHR",
"ASN",
"AST",
"BNS",
"PTS",
"DT",
"JS",
"KFS",
"MT",
"KN",
"SIN",
"SHG"
],
"ER": [
"AG",
"AS",
"BA",
"DE",
"GS",
"HA",
"SA",
"SM",
"SN",
"SR"
],
"ET": [
"AA",
"AF",
"AM",
"BE",
"GA",
"HA",
"OR",
"SO",
"SN",
"TI"
],
"GA": [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"
],
"GH": [
"AH",
"BA",
"CP",
"EP",
"AA",
"NP",
"UE",
"UW",
"TV",
"WP"
],
"GM": [
"B",
"L",
"M",
"N",
"U",
"W"
],
"GN": [
"B",
"BE",
"BF",
"BK",
"C",
"CO",
"DB",
"DL",
"DI",
"DU",
"FA",
"F",
"FO",
"FR",
"GA",
"GU",
"KA",
"K",
"KD",
"D",
"KS",
"KB",
"KO",
"KE",
"LA",
"L",
"LO",
"LE",
"MC",
"ML",
"MM",
"M",
"MD",
"NZ",
"N",
"PI",
"SI",
"TO",
"TE",
"YO"
],
"GQ": [
"AN",
"BN",
"BS",
"CS",
"KN",
"LI",
"C",
"I",
"WN"
],
"GW": [
"BA",
"BM",
"BS",
"BL",
"CA",
"GA",
"OI",
"QU"
],
"KE": [
"200",
"300",
"400",
"110",
"500",
"600",
"700",
"900"
],
"KM": [
"A",
"G",
"M"
],
"LR": [
"BM",
"BG",
"GB",
"CM",
"GG",
"GK",
"LO",
"MG",
"MY",
"MO",
"NI",
"RI",
"SI"
],
"LS": [
"D",
"B",
"C",
"E",
"A",
"F",
"J",
"H",
"G",
"K"
],
"LY": [
"BU",
"JA",
"JG",
"Ju",
"Wu",
"WA",
"ZA",
"BA",
"FA",
"MI",
"NA",
"SF",
"TB"
],
"MA": [
"AGD",
"HAO",
"HOC",
"ASZ",
"AZI",
"BAH",
"MEL",
"BES",
"BEM",
"BER",
"BOD",
"BOM",
"CAS",
"CE",
"CN",
"CS",
"CHE",
"CHI",
"HAJ",
"JDI",
"ERR",
"ESM",
"ESI",
"ES",
"FIG",
"FES",
"GUE",
"IFR",
"IRA",
"KES",
"KHE",
"KHN",
"KHO",
"KEN",
"LAA",
"LAR",
"MAR",
"MEK",
"NAD",
"NO",
"OUA",
"OUD",
"OUJ",
"RBA",
"SAF",
"SEF",
"SET",
"SIK",
"SU",
"TNT",
"TNG",
"TAO",
"TAR",
"TAT",
"TAZ",
"TS",
"TIZ",
"TET"
],
"MG": [
"T",
"D",
"F",
"M",
"A",
"U"
],
"ML": [
"BKO",
"7",
"1",
"8",
"2",
"5",
"3",
"4",
"6"
],
"MR": [
"07",
"03",
"05",
"08",
"04",
"10",
"01",
"02",
"12",
"NKC",
"09",
"11",
"06"
],
"MU": [
"AG",
"BR",
"BL",
"CC",
"CU",
"FL",
"GP",
"MO",
"PA",
"PW",
"PL",
"QB",
"RR",
"RO",
"SA",
"VP"
],
"MW": [
"BL",
"C",
"CK",
"CR",
"CT",
"DE",
"DO",
"KR",
"KS",
"LI",
"MH",
"MG",
"MC",
"MU",
"MW",
"MZ",
"NB",
"NK",
"N",
"NS",
"NU",
"NI",
"RU",
"SA",
"S",
"TH",
"ZO"
],
"MZ": [
"P",
"G",
"I",
"B",
"MPM",
"L",
"N",
"A",
"S",
"T",
"Q"
],
"NA": [
"CA",
"ER",
"HA",
"KA",
"KH",
"KU",
"OW",
"OK",
"OH",
"OS",
"ON",
"OT",
"OD"
],
"NE": [
"1",
"2",
"3",
"4",
"8",
"5",
"6",
"7"
],
"NG": [
"AB",
"FC",
"AD",
"AK",
"AN",
"BA",
"BE",
"BO",
"CR",
"DE",
"ED",
"EN",
"IM",
"JI",
"KD",
"KN",
"KT",
"KE",
"KO",
"KW",
"LA",
"NI",
"OG",
"ON",
"OS",
"OY",
"PL",
"RI",
"SO",
"TA",
"YO"
],
"RW": [
"C",
"I",
"E",
"D",
"G",
"B",
"J",
"F",
"K",
"L",
"M",
"H"
],
"SD": [
"26",
"18",
"07",
"03",
"06",
"22",
"04",
"08",
"24",
"01",
"23",
"17",
"14",
"12",
"10",
"16",
"11",
"13",
"20",
"05",
"15",
"02",
"09",
"19",
"25",
"21"
],
"SL": [
"E",
"N",
"S",
"W"
],
"SN": [
"DK",
"DB",
"FK",
"KL",
"KD",
"LG",
"SL",
"TC",
"TH",
"ZG"
],
"SO": [
"AW",
"BY",
"BK",
"BN",
"BR",
"GA",
"GE",
"HI",
"JD",
"JH",
"MU",
"NU",
"SA",
"SD",
"SH",
"SO",
"TO",
"WO"
],
"ST": [
"P",
"S"
],
"SZ": [
"HH",
"LU",
"MA",
"SH"
],
"TD": [
"BA",
"BI",
"BET",
"CB",
"GR",
"KA",
"LC",
"LO",
"LR",
"MK",
"MC",
"OD",
"SA",
"TA"
],
"TG": [
"C",
"K",
"M",
"P",
"S"
],
"TN": [
"13",
"23",
"31",
"81",
"71",
"32",
"41",
"42",
"73",
"12",
"33",
"53",
"82",
"52",
"21",
"61",
"43",
"34",
"51",
"83",
"72",
"11",
"22"
],
"TZ": [
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20",
"21",
"22",
"23",
"24",
"25"
],
"UG": [
"APA",
"ARU",
"BUN",
"BUS",
"GUL",
"HOI",
"IGA",
"JIN",
"KBL",
"KBR",
"KLG",
"KLA",
"KLI",
"KAP",
"KAS",
"KLE",
"KIB",
"KIS",
"KIT",
"KOT",
"KUM",
"LIR",
"LUW",
"MSK",
"MSI",
"MBL",
"MBR",
"MOR",
"MOY",
"MPI",
"MUB",
"MUK",
"NEB",
"NTU",
"PAL",
"RAK",
"RUK",
"SOR",
"TOR"
],
"ZA": [
"EC",
"FS",
"GT",
"NL",
"MP",
"NW",
"NC",
"NP",
"WC"
],
"ZM": [
"02",
"08",
"03",
"04",
"09",
"06",
"05",
"07",
"01"
],
"ZW": [
"BU",
"HA",
"MA",
"MC",
"ME",
"MW",
"MV",
"MN",
"MS",
"MI"
]
},
"meta": {
"managed_by_zonely": false
},
"created": 1587399600,
"updated": 1587399600
}
Request
POST v1/fulfillment/physical/zones
Body parameters
Name | Type | Status | Description |
---|---|---|---|
name |
string | required | Name of the zone |
countries.*.code |
string | required | A valid ISO-3166 country code that the zone applies to |
countries.*.subdivisions.* |
string | optional | A valid ISO-3166 subdivision code for each country, or |
meta |
object | optional | Optional metadata to store on the category |
Get fulfillment zone
Returns details for a specific fulfillment zone by its ID.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/fulfillment/physical/zones/zone_VNplJa1EaYwL60" \
--header "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/fulfillment/physical/zones/zone_VNplJa1EaYwL60"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/fulfillment/physical/zones/zone_VNplJa1EaYwL60'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"id": "zone_1ypbroE658n4ea",
"name": "International",
"countries": [
"CA",
"MX",
"NZ",
"AU",
"AS",
"CC",
"CK",
"CX",
"FJ",
"FM",
"GU",
"KI",
"MH",
"MP",
"NC",
"NF",
"NR",
"NU",
"PF",
"PG",
"PN",
"PW",
"SB",
"TK",
"TO",
"TV",
"VU",
"WF",
"WS",
"AE",
"AF",
"AM",
"AZ",
"BD",
"BH",
"BN",
"BT",
"CN",
"GE",
"HK",
"ID",
"IL",
"IN",
"IQ",
"IR",
"JO",
"JP",
"KG",
"KH",
"KP",
"KR",
"KW",
"KZ",
"LA",
"LB",
"LK",
"MM",
"MN",
"MO",
"MV",
"MY",
"NP",
"OM",
"PH",
"PK",
"PS",
"QA",
"SA",
"SG",
"SY",
"TH",
"TJ",
"TL",
"TM",
"TR",
"TW",
"UZ",
"VN",
"YE",
"AR",
"BO",
"BR",
"CL",
"CO",
"EC",
"FK",
"GF",
"GS",
"GY",
"PE",
"PY",
"SR",
"UY",
"VE",
"BM",
"BZ",
"CR",
"GT",
"HN",
"NI",
"PA",
"PM",
"SV",
"UM",
"AG",
"AI",
"AW",
"BB",
"BL",
"BS",
"CU",
"CW",
"DM",
"DO",
"GD",
"GP",
"HT",
"JM",
"KN",
"KY",
"LC",
"MF",
"MQ",
"MS",
"PR",
"SX",
"TC",
"TT",
"VC",
"VG",
"VI",
"AO",
"BF",
"BI",
"BJ",
"BW",
"CD",
"CF",
"CG",
"CI",
"CM",
"CV",
"DJ",
"DZ",
"EG",
"EH",
"ER",
"ET",
"GA",
"GH",
"GM",
"GN",
"GQ",
"GW",
"IO",
"KE",
"KM",
"LR",
"LS",
"LY",
"MA",
"MG",
"ML",
"MR",
"MU",
"MW",
"MZ",
"NA",
"NE",
"NG",
"RE",
"RW",
"SC",
"SD",
"SL",
"SN",
"SO",
"SS",
"ST",
"SZ",
"TD",
"TG",
"TN",
"TZ",
"UG",
"YT",
"ZA",
"ZM",
"ZW"
],
"subdivisions": {
"CA": [
"AB",
"BC",
"MB",
"NB",
"NL",
"NT",
"NS",
"NU",
"ON",
"PE",
"QC",
"SK",
"YT"
],
"MX": [
"AGU",
"BCN",
"BCS",
"CAM",
"CHP",
"CHH",
"COA",
"COL",
"DIF",
"DUR",
"GUA",
"GRO",
"HID",
"JAL",
"MIC",
"MOR",
"MEX",
"NAY",
"NLE",
"OAX",
"PUE",
"QUE",
"ROO",
"SLP",
"SIN",
"SON",
"TAB",
"TAM",
"TLA",
"VER",
"YUC",
"ZAC"
],
"NZ": [
"AUK",
"BOP",
"CAN",
"GIS",
"HKB",
"MWT",
"MBH",
"NSN",
"NTL",
"OTA",
"STL",
"TKI",
"TAS",
"WKO",
"WGN",
"WTC"
],
"AU": [
"ACT",
"NSW",
"NT",
"QLD",
"SA",
"TAS",
"VIC",
"WA"
],
"FJ": [
"C",
"E",
"N",
"R",
"W"
],
"FM": [
"KSA",
"PNI",
"YAP",
"TRK"
],
"KI": [
"G",
"L",
"P"
],
"MH": [
"ALL",
"ALK",
"ARN",
"AUR",
"EBO",
"ENI",
"JAL",
"KIL",
"KWA",
"LAE",
"LIB",
"LIK",
"MAJ",
"MAL",
"MEJ",
"MIL",
"NMK",
"NMU",
"L",
"T",
"RON",
"UJA",
"UJL",
"UTI",
"WTH",
"WTJ"
],
"PG": [
"CPM",
"CPK",
"EBR",
"ESW",
"EHG",
"EPW",
"GPK",
"MPM",
"MRL",
"MBA",
"MPL",
"NCD",
"NIK",
"NSA",
"NPP",
"SAN",
"SHM",
"WBK",
"WPD",
"WHM"
],
"SB": [
"CT",
"CE",
"GU",
"IS",
"MK",
"ML",
"TE",
"WE"
],
"VU": [
"MAP",
"PAM",
"SAM",
"SEE",
"TAE",
"TOB"
],
"WS": [
"AA",
"AL",
"AT",
"FA",
"GE",
"GI",
"PA",
"SA",
"TU",
"VF",
"VS"
],
"AE": [
"AZ",
"FU",
"SH",
"DU",
"RK",
"UQ",
"AJ"
],
"AF": [
"BDS",
"BGL",
"BAL",
"BDG",
"BAM",
"FRA",
"FYB",
"GHA",
"GHO",
"HEL",
"HER",
"JOW",
"KAB",
"KAN",
"KNR",
"KDZ",
"KAP",
"LAG",
"LOW",
"NAN",
"NIM",
"ORU",
"PKA",
"PIA",
"PAR",
"SAM",
"SAR",
"TAK",
"WAR",
"ZAB"
],
"AM": [
"AG",
"AR",
"AV",
"ER",
"GR",
"KT",
"LO",
"SU",
"TV",
"VD",
"SH"
],
"AZ": [
"ABS",
"AST",
"AGC",
"AGM",
"AGS",
"AGA",
"AGU",
"BAB",
"BA",
"BAL",
"BEY",
"BIL",
"BAR",
"CUL",
"CAB",
"CAL",
"DAS",
"DAV",
"FUZ",
"GOR",
"GAD",
"GA",
"GOY",
"HAC",
"IMI",
"ISM",
"KAL",
"KUR",
"LAC",
"LER",
"LAN",
"LA",
"MAS",
"MI",
"NA",
"MM",
"NEF",
"ORD",
"OGU",
"QAX",
"QAZ",
"QOB",
"QBA",
"QBI",
"QUS",
"QAB",
"SAT",
"SAB",
"SAL",
"SMX",
"SIY",
"SM",
"SAD",
"TOV",
"TAR",
"UCA",
"XA",
"XAN",
"XAC",
"XIZ",
"XCI",
"XVD",
"YAR",
"YEV",
"YE",
"ZAQ",
"ZAN",
"ZAR",
"AB",
"SAH",
"SMI",
"SUS",
"SS",
"SA",
"SAK",
"SKR",
"SAR"
],
"BD": [
"2A",
"1B",
"1",
"5C",
"2E",
"2D",
"2",
"2F",
"3G",
"3",
"5H",
"3I",
"3J",
"4K",
"4L",
"4",
"4M",
"3N",
"2O",
"5P",
"1Q",
"5R",
"5",
"5S",
"2T",
"3U"
],
"BH": [
"03",
"10",
"07",
"05",
"02",
"01",
"09",
"04",
"12",
"08",
"11",
"06"
],
"BN": [
"BE",
"BM",
"TE",
"TU"
],
"BT": [
"33",
"12",
"22",
"GA",
"13",
"44",
"42",
"11",
"43",
"23",
"45",
"14",
"31",
"15",
"TY",
"41",
"32",
"21",
"24",
"34"
],
"CN": [
"34",
"11",
"50",
"35",
"62",
"44",
"45",
"52",
"46",
"13",
"23",
"41",
"91",
"42",
"43",
"32",
"36",
"22",
"21",
"15",
"64",
"63",
"61",
"37",
"31",
"14",
"51",
"71",
"12",
"65",
"54",
"53",
"33"
],
"GE": [
"01",
"AJ",
"02",
"03",
"04",
"05",
"06",
"07",
"AB",
"08",
"09",
"BUS",
"10",
"11",
"12",
"13",
"CHI",
"14",
"15",
"16",
"GAG",
"17",
"18",
"GOR",
"19",
"20",
"21",
"22",
"23",
"24",
"26",
"33",
"KUT",
"25",
"27",
"28",
"29",
"30",
"31",
"32",
"34",
"35",
"36",
"37",
"38",
"39",
"40",
"41",
"42",
"43",
"44",
"PTI",
"45",
"46",
"RUS",
"47",
"48",
"49",
"50",
"51",
"52",
"SUI",
"53",
"TBS",
"54",
"55",
"56",
"57",
"TQI",
"TQV",
"58",
"59",
"60",
"TSQ",
"61",
"62",
"ZUG",
"63"
],
"ID": [
"PB",
"PA",
"JWU",
"JB",
"JT",
"JI",
"JK",
"YO",
"KAU",
"KB",
"KS",
"KT",
"KI",
"MAU",
"MA",
"NUU",
"BA",
"NB",
"NT",
"SLU",
"SN",
"ST",
"SG",
"SA",
"SMU",
"BE",
"JA",
"LA",
"RI",
"SB",
"SS",
"SU",
"AC",
"BT",
"GO",
"KU",
"BB",
"KR",
"SR"
],
"IL": [
"D",
"M",
"2",
"HA",
"TA",
"JM"
],
"IN": [
"AN",
"AP",
"AR",
"AS",
"BR",
"CH",
"DN",
"DD",
"DL",
"GA",
"GJ",
"HR",
"HP",
"JK",
"KA",
"KL",
"LD",
"MP",
"MH",
"MN",
"ML",
"MZ",
"NL",
"OR",
"PY",
"PB",
"RJ",
"SK",
"TN",
"TR",
"UP",
"WB"
],
"IQ": [
"AN",
"BA",
"MU",
"QA",
"NA",
"AR",
"SU",
"TS",
"BG",
"BB",
"DA",
"DQ",
"DI",
"KA",
"MA",
"NI",
"WA",
"SD"
],
"IR": [
"03",
"06",
"08",
"04",
"14",
"19",
"24",
"23",
"15",
"17",
"09",
"10",
"18",
"16",
"20",
"22",
"21",
"26",
"12",
"13",
"07",
"25",
"11",
"02",
"01",
"05"
],
"JO": [
"AQ",
"BA",
"KA",
"MA",
"AZ",
"AT",
"IR",
"JA",
"MN",
"MD",
"AJ",
"AM"
],
"JP": [
"23",
"05",
"02",
"38",
"21",
"10",
"34",
"01",
"18",
"40",
"07",
"28",
"08",
"17",
"03",
"37",
"46",
"14",
"43",
"26",
"39",
"24",
"04",
"45",
"20",
"42",
"29",
"15",
"33",
"47",
"41",
"11",
"25",
"22",
"12",
"36",
"09",
"31",
"16",
"13",
"30",
"06",
"35",
"19",
"44",
"27"
],
"KG": [
"C",
"J",
"N",
"O",
"T",
"Y"
],
"KH": [
"2",
"1",
"3",
"4",
"5",
"6",
"7",
"8",
"10",
"23",
"18",
"11",
"22",
"12",
"15",
"13",
"14",
"16",
"17",
"19",
"20",
"21"
],
"KP": [
"CHA",
"HAB",
"HAN",
"HWB",
"HWN",
"KAE",
"KAN",
"NAM",
"PYB",
"PYN",
"PYO",
"YAN"
],
"KR": [
"26",
"43",
"44",
"27",
"30",
"42",
"29",
"41",
"47",
"48",
"28",
"49",
"45",
"46",
"11",
"31"
],
"KW": [
"AH",
"FA",
"JA",
"KU",
"HA"
],
"KZ": [
"ALA",
"ALM",
"AKM",
"AKT",
"ATY",
"ZAP",
"BAY",
"MAN",
"YUZ",
"PAV",
"KAR",
"KUS",
"KZY",
"VOS",
"SEV",
"ZHA"
],
"LA": [
"AT",
"BK",
"BL",
"CH",
"HO",
"KH",
"LM",
"LP",
"OU",
"PH",
"SL",
"SV",
"VT",
"VI",
"XA",
"XI",
"XE"
],
"LB": [
"BA",
"BI",
"JL",
"AS",
"JA",
"NA"
],
"LK": [
"71",
"52",
"81",
"1",
"51",
"11",
"3",
"31",
"12",
"33",
"41",
"13",
"21",
"92",
"42",
"61",
"2",
"43",
"22",
"32",
"82",
"45",
"5",
"23",
"72",
"62",
"91",
"9",
"53",
"4",
"7",
"8",
"44",
"6"
],
"MM": [
"07",
"02",
"14",
"11",
"12",
"13",
"03",
"04",
"15",
"16",
"01",
"17",
"05",
"06"
],
"MN": [
"073",
"071",
"069",
"067",
"037",
"061",
"063",
"059",
"057",
"065",
"064",
"039",
"043",
"041",
"035",
"049",
"051",
"047",
"1",
"046",
"053",
"055"
],
"MV": [
"02",
"20",
"17",
"14",
"27",
"28",
"29",
"07",
"23",
"26",
"05",
"03",
"MLE",
"12",
"25",
"13",
"01",
"24",
"08",
"04"
],
"MY": [
"J",
"K",
"D",
"M",
"N",
"C",
"A",
"R",
"P",
"SA",
"SK",
"B",
"T",
"W",
"L"
],
"NP": [
"BA",
"BH",
"DH",
"GA",
"JA",
"KA",
"KO",
"LU",
"2",
"1",
"MA",
"ME",
"NA",
"3",
"4",
"RA",
"SA",
"SE",
"5"
],
"OM": [
"DA",
"BA",
"JA",
"WU",
"SH",
"ZA",
"MA",
"MU"
],
"PK": [
"JK",
"BA",
"TA",
"IS",
"NW",
"NA",
"PB",
"SD"
],
"QA": [
"DA",
"GH",
"JU",
"KH",
"WA",
"RA",
"JB",
"MS",
"US"
],
"SA": [
"11",
"12",
"03",
"05",
"08",
"O1",
"04",
"09",
"02",
"10",
"07",
"06",
"14"
],
"SY": [
"LA",
"QU",
"HA",
"RA",
"SU",
"DR",
"DY",
"DI",
"ID",
"RD",
"TA",
"HL",
"HM",
"HI"
],
"TH": [
"37",
"15",
"31",
"24",
"18",
"36",
"22",
"50",
"57",
"20",
"86",
"46",
"62",
"71",
"40",
"81",
"10",
"52",
"51",
"42",
"16",
"58",
"44",
"49",
"26",
"73",
"48",
"30",
"60",
"80",
"55",
"96",
"39",
"43",
"12",
"13",
"94",
"82",
"93",
"S",
"56",
"67",
"76",
"66",
"65",
"14",
"54",
"83",
"25",
"77",
"85",
"70",
"21",
"45",
"27",
"47",
"11",
"74",
"75",
"19",
"91",
"33",
"17",
"90",
"64",
"72",
"84",
"32",
"63",
"92",
"23",
"34",
"41",
"61",
"53",
"95",
"35"
],
"TJ": [
"GB",
"KR",
"KT",
"LN"
],
"TM": [
"A",
"B",
"D",
"L",
"M"
],
"TR": [
"01",
"02",
"03",
"68",
"05",
"06",
"07",
"75",
"08",
"09",
"04",
"10",
"74",
"72",
"69",
"11",
"12",
"13",
"14",
"15",
"16",
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28",
"29",
"30",
"31",
"32",
"76",
"46",
"78",
"70",
"36",
"37",
"38",
"79",
"41",
"42",
"43",
"39",
"71",
"40",
"44",
"4S",
"47",
"48",
"49",
"SO",
"51",
"52",
"53",
"54",
"SS",
"56",
"57",
"S8",
"59",
"60",
"61",
"62",
"64",
"65",
"77",
"66",
"67",
"17",
"18",
"19",
"34",
"35",
"33",
"63",
"73"
],
"TW": [
"CHA",
"CYI",
"HSZ",
"HUA",
"ILA",
"KHH",
"KEE",
"MIA",
"NAN",
"PEN",
"PIF",
"TXG",
"TNN",
"TPE",
"TTT",
"TAO",
"YUN"
],
"UZ": [
"AN",
"BU",
"FA",
"JI",
"KH",
"NG",
"NW",
"QA",
"QR",
"SA",
"SI",
"SU",
"TO"
],
"VN": [
"44",
"43",
"53",
"54",
"55",
"56",
"50",
"31",
"57",
"58",
"40",
"59",
"48",
"04",
"60",
"33",
"39",
"45",
"30",
"03",
"63",
"64",
"15",
"23",
"61",
"62",
"65",
"14",
"66",
"34",
"47",
"28",
"01",
"35",
"09",
"02",
"41",
"67",
"22",
"18",
"36",
"68",
"32",
"27",
"29",
"24",
"25",
"52",
"05",
"37",
"20",
"69",
"21",
"26",
"46",
"51",
"07",
"49",
"70",
"06"
],
"YE": [
"AB",
"BA",
"JA",
"MR",
"MW",
"HU",
"DH",
"IB",
"LA",
"MA",
"SH",
"TA",
"SD",
"SN",
"HJ",
"HD",
"AD"
],
"AR": [
"B",
"C",
"K",
"H",
"U",
"W",
"X",
"E",
"P",
"Y",
"L",
"F",
"M",
"N",
"Q",
"R",
"A",
"J",
"D",
"Z",
"S",
"G",
"V",
"T"
],
"BO": [
"H",
"C",
"B",
"L",
"O",
"N",
"P",
"S",
"T"
],
"BR": [
"AC",
"AL",
"AP",
"AM",
"BA",
"CE",
"DF",
"ES",
"GO",
"MA",
"MT",
"MS",
"MG",
"PR",
"PB",
"PA",
"PE",
"PI",
"RN",
"RS",
"RJ",
"R0",
"RR",
"SC",
"SE",
"SP",
"TO"
],
"CL": [
"AI",
"AN",
"AR",
"AT",
"BI",
"CO",
"LI",
"LL",
"MA",
"ML",
"RM",
"TA",
"VS"
],
"CO": [
"AMA",
"ANT",
"ARA",
"ATL",
"BOL",
"BOY",
"CAL",
"CAQ",
"CAS",
"CAU",
"CES",
"CHO",
"CUN",
"COR",
"DC",
"GUA",
"GUV",
"HUI",
"LAG",
"MAG",
"MET",
"NAR",
"NSA",
"PUT",
"QUI",
"RIS",
"SAP",
"SAN",
"SUC",
"TOL",
"VAC",
"VAU",
"VID"
],
"EC": [
"A",
"B",
"C",
"F",
"H",
"X",
"O",
"E",
"W",
"G",
"I",
"L",
"R",
"M",
"S",
"N",
"Y",
"P",
"U",
"T",
"Z"
],
"GY": [
"BA",
"CU",
"DE",
"EB",
"ES",
"MA",
"PM",
"PT",
"UD",
"UT"
],
"PE": [
"AMA",
"ANC",
"APU",
"ARE",
"AYA",
"CAJ",
"CUS",
"CAL",
"HUV",
"HUC",
"ICA",
"JUN",
"LAL",
"LAM",
"LIM",
"LOR",
"MDD",
"MOQ",
"PAS",
"PIU",
"PUN",
"SAM",
"TAC",
"TUM",
"UCA"
],
"PY": [
"16",
"10",
"13",
"ASU",
"19",
"5",
"6",
"14",
"11",
"1",
"3",
"4",
"7",
"8",
"12",
"9",
"15",
"2"
],
"SR": [
"BR",
"CM",
"CR",
"MA",
"NI",
"PR",
"PM",
"SA",
"SI",
"WA"
],
"UY": [
"AR",
"CA",
"CL",
"CO",
"DU",
"FS",
"FD",
"LA",
"MA",
"MO",
"PA",
"RV",
"RO",
"RN",
"SA",
"SJ",
"SO",
"TA",
"TT"
],
"VE": [
"Z",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"Y",
"W",
"A",
"I",
"J",
"K",
"M",
"N",
"L",
"O",
"P",
"R",
"T",
"S",
"U",
"V"
],
"BZ": [
"BZ",
"CY",
"CZL",
"OW",
"SC",
"TOL"
],
"CR": [
"A",
"C",
"G",
"H",
"L",
"P",
"SJ"
],
"GT": [
"AV",
"BV",
"CM",
"CQ",
"PR",
"ES",
"GU",
"HU",
"IZ",
"JA",
"JU",
"PE",
"QZ",
"QC",
"RE",
"SA",
"SM",
"SR",
"SO",
"SU",
"TO",
"ZA"
],
"HN": [
"AT",
"CH",
"CL",
"CM",
"CP",
"CR",
"EP",
"FM",
"GD",
"IN",
"IB",
"LP",
"LE",
"OC",
"OL",
"SB",
"VA",
"YO"
],
"NI": [
"BO",
"CA",
"CI",
"CO",
"ES",
"GR",
"JI",
"LE",
"MD",
"MN",
"MS",
"MT",
"NS",
"RI",
"SJ",
"ZE"
],
"PA": [
"1",
"4",
"2",
"3",
"0",
"5",
"6",
"7",
"8",
"9"
],
"SV": [
"AH",
"CA",
"CH",
"CU",
"LI",
"PA",
"UN",
"MO",
"SM",
"SS",
"SV",
"SA",
"SO",
"SU"
],
"BS": [
"AC",
"BI",
"CI",
"EX",
"FP",
"FC",
"GH",
"GT",
"HI",
"HR",
"IN",
"KB",
"LI",
"MH",
"MG",
"NP",
"NB",
"RI",
"RS",
"SR",
"SP"
],
"CU": [
"09",
"03",
"12",
"14",
"11",
"99",
"02",
"10",
"04",
"01",
"07",
"13",
"05"
],
"DO": [
"AZ",
"BR",
"BH",
"DA",
"DN",
"DU",
"SE",
"HM",
"IN",
"AL",
"EP",
"RO",
"VE",
"MT",
"MN",
"MC",
"MP",
"PN",
"PR",
"PP",
"SC",
"SM",
"CR",
"JU",
"PM",
"SZ",
"ST",
"SR",
"VA"
],
"HT": [
"AR",
"CE",
"GA",
"ND",
"NE",
"NO",
"OU",
"SD",
"SE"
],
"JM": [
"13",
"09",
"01",
"12",
"04",
"02",
"06",
"14",
"11",
"08",
"05",
"03",
"07",
"10"
],
"TT": [
"ARI",
"CHA",
"CTT",
"DMN",
"ETO",
"PED",
"PTF",
"POS",
"PRT",
"RCM",
"SFO",
"SJL",
"SGE",
"SIP",
"TUP",
"WTO"
],
"AO": [
"BGO",
"BGU",
"BIE",
"CAB",
"CCU",
"CNO",
"CUS",
"CNN",
"HUA",
"HUI",
"LUA",
"LNO",
"LSU",
"MAL",
"MOX",
"NAM",
"UIG",
"ZAI"
],
"BF": [
"BAL",
"BAM",
"BAN",
"BAZ",
"BGR",
"BLG",
"BLK",
"COM",
"GAN",
"GNA",
"GOU",
"HOU",
"IOB",
"KAD",
"KMD",
"KMP",
"KOS",
"KOP",
"KOT",
"KOW",
"KEN",
"LOR",
"LER",
"MOU",
"NAO",
"NAM",
"NAY",
"NOU",
"OUB",
"OUD",
"PAS",
"PON",
"SNG",
"SMT",
"SIS",
"SOM",
"SOR",
"SEN",
"TAP",
"TUI",
"YAG",
"YAT",
"ZIR",
"ZON",
"ZOU"
],
"BI": [
"BB",
"BJ",
"BR",
"CA",
"CI",
"GI",
"KR",
"KY",
"KI",
"MA",
"MU",
"MY",
"NG",
"RT",
"RY"
],
"BJ": [
"AK",
"AQ",
"BO",
"MO",
"OU",
"ZO"
],
"BW": [
"CE",
"CH",
"GH",
"KG",
"KL",
"KW",
"NG",
"NE",
"SE",
"SO"
],
"CD": [
"BN",
"BC",
"HC",
"KW",
"KE",
"KA",
"KN",
"MA",
"NK",
"SK",
"EQ"
],
"CF": [
"BB",
"BGF",
"BK",
"HM",
"HK",
"KG",
"LB",
"HS",
"MB",
"KB",
"NM",
"MP",
"UK",
"AC",
"OP",
"SE",
"VK"
],
"CG": [
"11",
"BZV",
"8",
"15",
"5",
"7",
"2",
"9",
"14",
"12",
"13"
],
"CI": [
"06",
"16",
"09",
"10",
"02",
"07",
"01",
"12",
"05",
"11",
"03",
"15",
"13",
"04",
"14",
"08"
],
"CM": [
"AD",
"CE",
"ES",
"EN",
"LT",
"NO",
"NW",
"SU",
"SW",
"OU"
],
"CV": [
"BV",
"BR",
"FO",
"B",
"S",
"MA",
"PA",
"PN",
"PR",
"RG",
"SL",
"CA",
"CR",
"SN",
"SV",
"TA"
],
"DJ": [
"AS",
"DI",
"DJ",
"OB",
"TA"
],
"DZ": [
"01",
"16",
"44",
"46",
"05",
"07",
"09",
"34",
"10",
"35",
"08",
"06",
"02",
"25",
"17",
"32",
"39",
"36",
"47",
"24",
"33",
"18",
"40",
"03",
"29",
"43",
"27",
"28",
"26",
"45",
"31",
"30",
"04",
"48",
"20",
"22",
"21",
"41",
"19",
"11",
"14",
"37",
"42",
"38",
"15",
"13",
"12"
],
"EG": [
"DK",
"BA",
"BH",
"FYM",
"GH",
"ALX",
"IS",
"GZ",
"MN",
"MNF",
"KB",
"C",
"WAD",
"SUZ",
"SHR",
"ASN",
"AST",
"BNS",
"PTS",
"DT",
"JS",
"KFS",
"MT",
"KN",
"SIN",
"SHG"
],
"ER": [
"AG",
"AS",
"BA",
"DE",
"GS",
"HA",
"SA",
"SM",
"SN",
"SR"
],
"ET": [
"AA",
"AF",
"AM",
"BE",
"GA",
"HA",
"OR",
"SO",
"SN",
"TI"
],
"GA": [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"
],
"GH": [
"AH",
"BA",
"CP",
"EP",
"AA",
"NP",
"UE",
"UW",
"TV",
"WP"
],
"GM": [
"B",
"L",
"M",
"N",
"U",
"W"
],
"GN": [
"B",
"BE",
"BF",
"BK",
"C",
"CO",
"DB",
"DL",
"DI",
"DU",
"FA",
"F",
"FO",
"FR",
"GA",
"GU",
"KA",
"K",
"KD",
"D",
"KS",
"KB",
"KO",
"KE",
"LA",
"L",
"LO",
"LE",
"MC",
"ML",
"MM",
"M",
"MD",
"NZ",
"N",
"PI",
"SI",
"TO",
"TE",
"YO"
],
"GQ": [
"AN",
"BN",
"BS",
"CS",
"KN",
"LI",
"C",
"I",
"WN"
],
"GW": [
"BA",
"BM",
"BS",
"BL",
"CA",
"GA",
"OI",
"QU"
],
"KE": [
"200",
"300",
"400",
"110",
"500",
"600",
"700",
"900"
],
"KM": [
"A",
"G",
"M"
],
"LR": [
"BM",
"BG",
"GB",
"CM",
"GG",
"GK",
"LO",
"MG",
"MY",
"MO",
"NI",
"RI",
"SI"
],
"LS": [
"D",
"B",
"C",
"E",
"A",
"F",
"J",
"H",
"G",
"K"
],
"LY": [
"BU",
"JA",
"JG",
"Ju",
"Wu",
"WA",
"ZA",
"BA",
"FA",
"MI",
"NA",
"SF",
"TB"
],
"MA": [
"AGD",
"HAO",
"HOC",
"ASZ",
"AZI",
"BAH",
"MEL",
"BES",
"BEM",
"BER",
"BOD",
"BOM",
"CAS",
"CE",
"CN",
"CS",
"CHE",
"CHI",
"HAJ",
"JDI",
"ERR",
"ESM",
"ESI",
"ES",
"FIG",
"FES",
"GUE",
"IFR",
"IRA",
"KES",
"KHE",
"KHN",
"KHO",
"KEN",
"LAA",
"LAR",
"MAR",
"MEK",
"NAD",
"NO",
"OUA",
"OUD",
"OUJ",
"RBA",
"SAF",
"SEF",
"SET",
"SIK",
"SU",
"TNT",
"TNG",
"TAO",
"TAR",
"TAT",
"TAZ",
"TS",
"TIZ",
"TET"
],
"MG": [
"T",
"D",
"F",
"M",
"A",
"U"
],
"ML": [
"BKO",
"7",
"1",
"8",
"2",
"5",
"3",
"4",
"6"
],
"MR": [
"07",
"03",
"05",
"08",
"04",
"10",
"01",
"02",
"12",
"NKC",
"09",
"11",
"06"
],
"MU": [
"AG",
"BR",
"BL",
"CC",
"CU",
"FL",
"GP",
"MO",
"PA",
"PW",
"PL",
"QB",
"RR",
"RO",
"SA",
"VP"
],
"MW": [
"BL",
"C",
"CK",
"CR",
"CT",
"DE",
"DO",
"KR",
"KS",
"LI",
"MH",
"MG",
"MC",
"MU",
"MW",
"MZ",
"NB",
"NK",
"N",
"NS",
"NU",
"NI",
"RU",
"SA",
"S",
"TH",
"ZO"
],
"MZ": [
"P",
"G",
"I",
"B",
"MPM",
"L",
"N",
"A",
"S",
"T",
"Q"
],
"NA": [
"CA",
"ER",
"HA",
"KA",
"KH",
"KU",
"OW",
"OK",
"OH",
"OS",
"ON",
"OT",
"OD"
],
"NE": [
"1",
"2",
"3",
"4",
"8",
"5",
"6",
"7"
],
"NG": [
"AB",
"FC",
"AD",
"AK",
"AN",
"BA",
"BE",
"BO",
"CR",
"DE",
"ED",
"EN",
"IM",
"JI",
"KD",
"KN",
"KT",
"KE",
"KO",
"KW",
"LA",
"NI",
"OG",
"ON",
"OS",
"OY",
"PL",
"RI",
"SO",
"TA",
"YO"
],
"RW": [
"C",
"I",
"E",
"D",
"G",
"B",
"J",
"F",
"K",
"L",
"M",
"H"
],
"SD": [
"26",
"18",
"07",
"03",
"06",
"22",
"04",
"08",
"24",
"01",
"23",
"17",
"14",
"12",
"10",
"16",
"11",
"13",
"20",
"05",
"15",
"02",
"09",
"19",
"25",
"21"
],
"SL": [
"E",
"N",
"S",
"W"
],
"SN": [
"DK",
"DB",
"FK",
"KL",
"KD",
"LG",
"SL",
"TC",
"TH",
"ZG"
],
"SO": [
"AW",
"BY",
"BK",
"BN",
"BR",
"GA",
"GE",
"HI",
"JD",
"JH",
"MU",
"NU",
"SA",
"SD",
"SH",
"SO",
"TO",
"WO"
],
"ST": [
"P",
"S"
],
"SZ": [
"HH",
"LU",
"MA",
"SH"
],
"TD": [
"BA",
"BI",
"BET",
"CB",
"GR",
"KA",
"LC",
"LO",
"LR",
"MK",
"MC",
"OD",
"SA",
"TA"
],
"TG": [
"C",
"K",
"M",
"P",
"S"
],
"TN": [
"13",
"23",
"31",
"81",
"71",
"32",
"41",
"42",
"73",
"12",
"33",
"53",
"82",
"52",
"21",
"61",
"43",
"34",
"51",
"83",
"72",
"11",
"22"
],
"TZ": [
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20",
"21",
"22",
"23",
"24",
"25"
],
"UG": [
"APA",
"ARU",
"BUN",
"BUS",
"GUL",
"HOI",
"IGA",
"JIN",
"KBL",
"KBR",
"KLG",
"KLA",
"KLI",
"KAP",
"KAS",
"KLE",
"KIB",
"KIS",
"KIT",
"KOT",
"KUM",
"LIR",
"LUW",
"MSK",
"MSI",
"MBL",
"MBR",
"MOR",
"MOY",
"MPI",
"MUB",
"MUK",
"NEB",
"NTU",
"PAL",
"RAK",
"RUK",
"SOR",
"TOR"
],
"ZA": [
"EC",
"FS",
"GT",
"NL",
"MP",
"NW",
"NC",
"NP",
"WC"
],
"ZM": [
"02",
"08",
"03",
"04",
"09",
"06",
"05",
"07",
"01"
],
"ZW": [
"BU",
"HA",
"MA",
"MC",
"ME",
"MW",
"MV",
"MN",
"MS",
"MI"
]
},
"meta": {
"managed_by_zonely": false
},
"created": 1587399600,
"updated": 1587399600
}
Request
GET v1/fulfillment/physical/zones/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | The fulfillment zone ID |
Update fulfillment zone
Update an existing fulfillment zone for the current merchant.
Example request:
curl --request PUT \
"https://api.chec.io/v1/fulfillment/physical/zones/{id}" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"name\": \"United States\"
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/fulfillment/physical/zones/{id}"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/fulfillment/physical/zones/{id}'
payload = {
"name": "United States"
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"id": "zone_1ypbroE658n4ea",
"name": "International",
"countries": [
"CA",
"MX",
"NZ",
"AU",
"AS",
"CC",
"CK",
"CX",
"FJ",
"FM",
"GU",
"KI",
"MH",
"MP",
"NC",
"NF",
"NR",
"NU",
"PF",
"PG",
"PN",
"PW",
"SB",
"TK",
"TO",
"TV",
"VU",
"WF",
"WS",
"AE",
"AF",
"AM",
"AZ",
"BD",
"BH",
"BN",
"BT",
"CN",
"GE",
"HK",
"ID",
"IL",
"IN",
"IQ",
"IR",
"JO",
"JP",
"KG",
"KH",
"KP",
"KR",
"KW",
"KZ",
"LA",
"LB",
"LK",
"MM",
"MN",
"MO",
"MV",
"MY",
"NP",
"OM",
"PH",
"PK",
"PS",
"QA",
"SA",
"SG",
"SY",
"TH",
"TJ",
"TL",
"TM",
"TR",
"TW",
"UZ",
"VN",
"YE",
"AR",
"BO",
"BR",
"CL",
"CO",
"EC",
"FK",
"GF",
"GS",
"GY",
"PE",
"PY",
"SR",
"UY",
"VE",
"BM",
"BZ",
"CR",
"GT",
"HN",
"NI",
"PA",
"PM",
"SV",
"UM",
"AG",
"AI",
"AW",
"BB",
"BL",
"BS",
"CU",
"CW",
"DM",
"DO",
"GD",
"GP",
"HT",
"JM",
"KN",
"KY",
"LC",
"MF",
"MQ",
"MS",
"PR",
"SX",
"TC",
"TT",
"VC",
"VG",
"VI",
"AO",
"BF",
"BI",
"BJ",
"BW",
"CD",
"CF",
"CG",
"CI",
"CM",
"CV",
"DJ",
"DZ",
"EG",
"EH",
"ER",
"ET",
"GA",
"GH",
"GM",
"GN",
"GQ",
"GW",
"IO",
"KE",
"KM",
"LR",
"LS",
"LY",
"MA",
"MG",
"ML",
"MR",
"MU",
"MW",
"MZ",
"NA",
"NE",
"NG",
"RE",
"RW",
"SC",
"SD",
"SL",
"SN",
"SO",
"SS",
"ST",
"SZ",
"TD",
"TG",
"TN",
"TZ",
"UG",
"YT",
"ZA",
"ZM",
"ZW"
],
"subdivisions": {
"CA": [
"AB",
"BC",
"MB",
"NB",
"NL",
"NT",
"NS",
"NU",
"ON",
"PE",
"QC",
"SK",
"YT"
],
"MX": [
"AGU",
"BCN",
"BCS",
"CAM",
"CHP",
"CHH",
"COA",
"COL",
"DIF",
"DUR",
"GUA",
"GRO",
"HID",
"JAL",
"MIC",
"MOR",
"MEX",
"NAY",
"NLE",
"OAX",
"PUE",
"QUE",
"ROO",
"SLP",
"SIN",
"SON",
"TAB",
"TAM",
"TLA",
"VER",
"YUC",
"ZAC"
],
"NZ": [
"AUK",
"BOP",
"CAN",
"GIS",
"HKB",
"MWT",
"MBH",
"NSN",
"NTL",
"OTA",
"STL",
"TKI",
"TAS",
"WKO",
"WGN",
"WTC"
],
"AU": [
"ACT",
"NSW",
"NT",
"QLD",
"SA",
"TAS",
"VIC",
"WA"
],
"FJ": [
"C",
"E",
"N",
"R",
"W"
],
"FM": [
"KSA",
"PNI",
"YAP",
"TRK"
],
"KI": [
"G",
"L",
"P"
],
"MH": [
"ALL",
"ALK",
"ARN",
"AUR",
"EBO",
"ENI",
"JAL",
"KIL",
"KWA",
"LAE",
"LIB",
"LIK",
"MAJ",
"MAL",
"MEJ",
"MIL",
"NMK",
"NMU",
"L",
"T",
"RON",
"UJA",
"UJL",
"UTI",
"WTH",
"WTJ"
],
"PG": [
"CPM",
"CPK",
"EBR",
"ESW",
"EHG",
"EPW",
"GPK",
"MPM",
"MRL",
"MBA",
"MPL",
"NCD",
"NIK",
"NSA",
"NPP",
"SAN",
"SHM",
"WBK",
"WPD",
"WHM"
],
"SB": [
"CT",
"CE",
"GU",
"IS",
"MK",
"ML",
"TE",
"WE"
],
"VU": [
"MAP",
"PAM",
"SAM",
"SEE",
"TAE",
"TOB"
],
"WS": [
"AA",
"AL",
"AT",
"FA",
"GE",
"GI",
"PA",
"SA",
"TU",
"VF",
"VS"
],
"AE": [
"AZ",
"FU",
"SH",
"DU",
"RK",
"UQ",
"AJ"
],
"AF": [
"BDS",
"BGL",
"BAL",
"BDG",
"BAM",
"FRA",
"FYB",
"GHA",
"GHO",
"HEL",
"HER",
"JOW",
"KAB",
"KAN",
"KNR",
"KDZ",
"KAP",
"LAG",
"LOW",
"NAN",
"NIM",
"ORU",
"PKA",
"PIA",
"PAR",
"SAM",
"SAR",
"TAK",
"WAR",
"ZAB"
],
"AM": [
"AG",
"AR",
"AV",
"ER",
"GR",
"KT",
"LO",
"SU",
"TV",
"VD",
"SH"
],
"AZ": [
"ABS",
"AST",
"AGC",
"AGM",
"AGS",
"AGA",
"AGU",
"BAB",
"BA",
"BAL",
"BEY",
"BIL",
"BAR",
"CUL",
"CAB",
"CAL",
"DAS",
"DAV",
"FUZ",
"GOR",
"GAD",
"GA",
"GOY",
"HAC",
"IMI",
"ISM",
"KAL",
"KUR",
"LAC",
"LER",
"LAN",
"LA",
"MAS",
"MI",
"NA",
"MM",
"NEF",
"ORD",
"OGU",
"QAX",
"QAZ",
"QOB",
"QBA",
"QBI",
"QUS",
"QAB",
"SAT",
"SAB",
"SAL",
"SMX",
"SIY",
"SM",
"SAD",
"TOV",
"TAR",
"UCA",
"XA",
"XAN",
"XAC",
"XIZ",
"XCI",
"XVD",
"YAR",
"YEV",
"YE",
"ZAQ",
"ZAN",
"ZAR",
"AB",
"SAH",
"SMI",
"SUS",
"SS",
"SA",
"SAK",
"SKR",
"SAR"
],
"BD": [
"2A",
"1B",
"1",
"5C",
"2E",
"2D",
"2",
"2F",
"3G",
"3",
"5H",
"3I",
"3J",
"4K",
"4L",
"4",
"4M",
"3N",
"2O",
"5P",
"1Q",
"5R",
"5",
"5S",
"2T",
"3U"
],
"BH": [
"03",
"10",
"07",
"05",
"02",
"01",
"09",
"04",
"12",
"08",
"11",
"06"
],
"BN": [
"BE",
"BM",
"TE",
"TU"
],
"BT": [
"33",
"12",
"22",
"GA",
"13",
"44",
"42",
"11",
"43",
"23",
"45",
"14",
"31",
"15",
"TY",
"41",
"32",
"21",
"24",
"34"
],
"CN": [
"34",
"11",
"50",
"35",
"62",
"44",
"45",
"52",
"46",
"13",
"23",
"41",
"91",
"42",
"43",
"32",
"36",
"22",
"21",
"15",
"64",
"63",
"61",
"37",
"31",
"14",
"51",
"71",
"12",
"65",
"54",
"53",
"33"
],
"GE": [
"01",
"AJ",
"02",
"03",
"04",
"05",
"06",
"07",
"AB",
"08",
"09",
"BUS",
"10",
"11",
"12",
"13",
"CHI",
"14",
"15",
"16",
"GAG",
"17",
"18",
"GOR",
"19",
"20",
"21",
"22",
"23",
"24",
"26",
"33",
"KUT",
"25",
"27",
"28",
"29",
"30",
"31",
"32",
"34",
"35",
"36",
"37",
"38",
"39",
"40",
"41",
"42",
"43",
"44",
"PTI",
"45",
"46",
"RUS",
"47",
"48",
"49",
"50",
"51",
"52",
"SUI",
"53",
"TBS",
"54",
"55",
"56",
"57",
"TQI",
"TQV",
"58",
"59",
"60",
"TSQ",
"61",
"62",
"ZUG",
"63"
],
"ID": [
"PB",
"PA",
"JWU",
"JB",
"JT",
"JI",
"JK",
"YO",
"KAU",
"KB",
"KS",
"KT",
"KI",
"MAU",
"MA",
"NUU",
"BA",
"NB",
"NT",
"SLU",
"SN",
"ST",
"SG",
"SA",
"SMU",
"BE",
"JA",
"LA",
"RI",
"SB",
"SS",
"SU",
"AC",
"BT",
"GO",
"KU",
"BB",
"KR",
"SR"
],
"IL": [
"D",
"M",
"2",
"HA",
"TA",
"JM"
],
"IN": [
"AN",
"AP",
"AR",
"AS",
"BR",
"CH",
"DN",
"DD",
"DL",
"GA",
"GJ",
"HR",
"HP",
"JK",
"KA",
"KL",
"LD",
"MP",
"MH",
"MN",
"ML",
"MZ",
"NL",
"OR",
"PY",
"PB",
"RJ",
"SK",
"TN",
"TR",
"UP",
"WB"
],
"IQ": [
"AN",
"BA",
"MU",
"QA",
"NA",
"AR",
"SU",
"TS",
"BG",
"BB",
"DA",
"DQ",
"DI",
"KA",
"MA",
"NI",
"WA",
"SD"
],
"IR": [
"03",
"06",
"08",
"04",
"14",
"19",
"24",
"23",
"15",
"17",
"09",
"10",
"18",
"16",
"20",
"22",
"21",
"26",
"12",
"13",
"07",
"25",
"11",
"02",
"01",
"05"
],
"JO": [
"AQ",
"BA",
"KA",
"MA",
"AZ",
"AT",
"IR",
"JA",
"MN",
"MD",
"AJ",
"AM"
],
"JP": [
"23",
"05",
"02",
"38",
"21",
"10",
"34",
"01",
"18",
"40",
"07",
"28",
"08",
"17",
"03",
"37",
"46",
"14",
"43",
"26",
"39",
"24",
"04",
"45",
"20",
"42",
"29",
"15",
"33",
"47",
"41",
"11",
"25",
"22",
"12",
"36",
"09",
"31",
"16",
"13",
"30",
"06",
"35",
"19",
"44",
"27"
],
"KG": [
"C",
"J",
"N",
"O",
"T",
"Y"
],
"KH": [
"2",
"1",
"3",
"4",
"5",
"6",
"7",
"8",
"10",
"23",
"18",
"11",
"22",
"12",
"15",
"13",
"14",
"16",
"17",
"19",
"20",
"21"
],
"KP": [
"CHA",
"HAB",
"HAN",
"HWB",
"HWN",
"KAE",
"KAN",
"NAM",
"PYB",
"PYN",
"PYO",
"YAN"
],
"KR": [
"26",
"43",
"44",
"27",
"30",
"42",
"29",
"41",
"47",
"48",
"28",
"49",
"45",
"46",
"11",
"31"
],
"KW": [
"AH",
"FA",
"JA",
"KU",
"HA"
],
"KZ": [
"ALA",
"ALM",
"AKM",
"AKT",
"ATY",
"ZAP",
"BAY",
"MAN",
"YUZ",
"PAV",
"KAR",
"KUS",
"KZY",
"VOS",
"SEV",
"ZHA"
],
"LA": [
"AT",
"BK",
"BL",
"CH",
"HO",
"KH",
"LM",
"LP",
"OU",
"PH",
"SL",
"SV",
"VT",
"VI",
"XA",
"XI",
"XE"
],
"LB": [
"BA",
"BI",
"JL",
"AS",
"JA",
"NA"
],
"LK": [
"71",
"52",
"81",
"1",
"51",
"11",
"3",
"31",
"12",
"33",
"41",
"13",
"21",
"92",
"42",
"61",
"2",
"43",
"22",
"32",
"82",
"45",
"5",
"23",
"72",
"62",
"91",
"9",
"53",
"4",
"7",
"8",
"44",
"6"
],
"MM": [
"07",
"02",
"14",
"11",
"12",
"13",
"03",
"04",
"15",
"16",
"01",
"17",
"05",
"06"
],
"MN": [
"073",
"071",
"069",
"067",
"037",
"061",
"063",
"059",
"057",
"065",
"064",
"039",
"043",
"041",
"035",
"049",
"051",
"047",
"1",
"046",
"053",
"055"
],
"MV": [
"02",
"20",
"17",
"14",
"27",
"28",
"29",
"07",
"23",
"26",
"05",
"03",
"MLE",
"12",
"25",
"13",
"01",
"24",
"08",
"04"
],
"MY": [
"J",
"K",
"D",
"M",
"N",
"C",
"A",
"R",
"P",
"SA",
"SK",
"B",
"T",
"W",
"L"
],
"NP": [
"BA",
"BH",
"DH",
"GA",
"JA",
"KA",
"KO",
"LU",
"2",
"1",
"MA",
"ME",
"NA",
"3",
"4",
"RA",
"SA",
"SE",
"5"
],
"OM": [
"DA",
"BA",
"JA",
"WU",
"SH",
"ZA",
"MA",
"MU"
],
"PK": [
"JK",
"BA",
"TA",
"IS",
"NW",
"NA",
"PB",
"SD"
],
"QA": [
"DA",
"GH",
"JU",
"KH",
"WA",
"RA",
"JB",
"MS",
"US"
],
"SA": [
"11",
"12",
"03",
"05",
"08",
"O1",
"04",
"09",
"02",
"10",
"07",
"06",
"14"
],
"SY": [
"LA",
"QU",
"HA",
"RA",
"SU",
"DR",
"DY",
"DI",
"ID",
"RD",
"TA",
"HL",
"HM",
"HI"
],
"TH": [
"37",
"15",
"31",
"24",
"18",
"36",
"22",
"50",
"57",
"20",
"86",
"46",
"62",
"71",
"40",
"81",
"10",
"52",
"51",
"42",
"16",
"58",
"44",
"49",
"26",
"73",
"48",
"30",
"60",
"80",
"55",
"96",
"39",
"43",
"12",
"13",
"94",
"82",
"93",
"S",
"56",
"67",
"76",
"66",
"65",
"14",
"54",
"83",
"25",
"77",
"85",
"70",
"21",
"45",
"27",
"47",
"11",
"74",
"75",
"19",
"91",
"33",
"17",
"90",
"64",
"72",
"84",
"32",
"63",
"92",
"23",
"34",
"41",
"61",
"53",
"95",
"35"
],
"TJ": [
"GB",
"KR",
"KT",
"LN"
],
"TM": [
"A",
"B",
"D",
"L",
"M"
],
"TR": [
"01",
"02",
"03",
"68",
"05",
"06",
"07",
"75",
"08",
"09",
"04",
"10",
"74",
"72",
"69",
"11",
"12",
"13",
"14",
"15",
"16",
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28",
"29",
"30",
"31",
"32",
"76",
"46",
"78",
"70",
"36",
"37",
"38",
"79",
"41",
"42",
"43",
"39",
"71",
"40",
"44",
"4S",
"47",
"48",
"49",
"SO",
"51",
"52",
"53",
"54",
"SS",
"56",
"57",
"S8",
"59",
"60",
"61",
"62",
"64",
"65",
"77",
"66",
"67",
"17",
"18",
"19",
"34",
"35",
"33",
"63",
"73"
],
"TW": [
"CHA",
"CYI",
"HSZ",
"HUA",
"ILA",
"KHH",
"KEE",
"MIA",
"NAN",
"PEN",
"PIF",
"TXG",
"TNN",
"TPE",
"TTT",
"TAO",
"YUN"
],
"UZ": [
"AN",
"BU",
"FA",
"JI",
"KH",
"NG",
"NW",
"QA",
"QR",
"SA",
"SI",
"SU",
"TO"
],
"VN": [
"44",
"43",
"53",
"54",
"55",
"56",
"50",
"31",
"57",
"58",
"40",
"59",
"48",
"04",
"60",
"33",
"39",
"45",
"30",
"03",
"63",
"64",
"15",
"23",
"61",
"62",
"65",
"14",
"66",
"34",
"47",
"28",
"01",
"35",
"09",
"02",
"41",
"67",
"22",
"18",
"36",
"68",
"32",
"27",
"29",
"24",
"25",
"52",
"05",
"37",
"20",
"69",
"21",
"26",
"46",
"51",
"07",
"49",
"70",
"06"
],
"YE": [
"AB",
"BA",
"JA",
"MR",
"MW",
"HU",
"DH",
"IB",
"LA",
"MA",
"SH",
"TA",
"SD",
"SN",
"HJ",
"HD",
"AD"
],
"AR": [
"B",
"C",
"K",
"H",
"U",
"W",
"X",
"E",
"P",
"Y",
"L",
"F",
"M",
"N",
"Q",
"R",
"A",
"J",
"D",
"Z",
"S",
"G",
"V",
"T"
],
"BO": [
"H",
"C",
"B",
"L",
"O",
"N",
"P",
"S",
"T"
],
"BR": [
"AC",
"AL",
"AP",
"AM",
"BA",
"CE",
"DF",
"ES",
"GO",
"MA",
"MT",
"MS",
"MG",
"PR",
"PB",
"PA",
"PE",
"PI",
"RN",
"RS",
"RJ",
"R0",
"RR",
"SC",
"SE",
"SP",
"TO"
],
"CL": [
"AI",
"AN",
"AR",
"AT",
"BI",
"CO",
"LI",
"LL",
"MA",
"ML",
"RM",
"TA",
"VS"
],
"CO": [
"AMA",
"ANT",
"ARA",
"ATL",
"BOL",
"BOY",
"CAL",
"CAQ",
"CAS",
"CAU",
"CES",
"CHO",
"CUN",
"COR",
"DC",
"GUA",
"GUV",
"HUI",
"LAG",
"MAG",
"MET",
"NAR",
"NSA",
"PUT",
"QUI",
"RIS",
"SAP",
"SAN",
"SUC",
"TOL",
"VAC",
"VAU",
"VID"
],
"EC": [
"A",
"B",
"C",
"F",
"H",
"X",
"O",
"E",
"W",
"G",
"I",
"L",
"R",
"M",
"S",
"N",
"Y",
"P",
"U",
"T",
"Z"
],
"GY": [
"BA",
"CU",
"DE",
"EB",
"ES",
"MA",
"PM",
"PT",
"UD",
"UT"
],
"PE": [
"AMA",
"ANC",
"APU",
"ARE",
"AYA",
"CAJ",
"CUS",
"CAL",
"HUV",
"HUC",
"ICA",
"JUN",
"LAL",
"LAM",
"LIM",
"LOR",
"MDD",
"MOQ",
"PAS",
"PIU",
"PUN",
"SAM",
"TAC",
"TUM",
"UCA"
],
"PY": [
"16",
"10",
"13",
"ASU",
"19",
"5",
"6",
"14",
"11",
"1",
"3",
"4",
"7",
"8",
"12",
"9",
"15",
"2"
],
"SR": [
"BR",
"CM",
"CR",
"MA",
"NI",
"PR",
"PM",
"SA",
"SI",
"WA"
],
"UY": [
"AR",
"CA",
"CL",
"CO",
"DU",
"FS",
"FD",
"LA",
"MA",
"MO",
"PA",
"RV",
"RO",
"RN",
"SA",
"SJ",
"SO",
"TA",
"TT"
],
"VE": [
"Z",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"Y",
"W",
"A",
"I",
"J",
"K",
"M",
"N",
"L",
"O",
"P",
"R",
"T",
"S",
"U",
"V"
],
"BZ": [
"BZ",
"CY",
"CZL",
"OW",
"SC",
"TOL"
],
"CR": [
"A",
"C",
"G",
"H",
"L",
"P",
"SJ"
],
"GT": [
"AV",
"BV",
"CM",
"CQ",
"PR",
"ES",
"GU",
"HU",
"IZ",
"JA",
"JU",
"PE",
"QZ",
"QC",
"RE",
"SA",
"SM",
"SR",
"SO",
"SU",
"TO",
"ZA"
],
"HN": [
"AT",
"CH",
"CL",
"CM",
"CP",
"CR",
"EP",
"FM",
"GD",
"IN",
"IB",
"LP",
"LE",
"OC",
"OL",
"SB",
"VA",
"YO"
],
"NI": [
"BO",
"CA",
"CI",
"CO",
"ES",
"GR",
"JI",
"LE",
"MD",
"MN",
"MS",
"MT",
"NS",
"RI",
"SJ",
"ZE"
],
"PA": [
"1",
"4",
"2",
"3",
"0",
"5",
"6",
"7",
"8",
"9"
],
"SV": [
"AH",
"CA",
"CH",
"CU",
"LI",
"PA",
"UN",
"MO",
"SM",
"SS",
"SV",
"SA",
"SO",
"SU"
],
"BS": [
"AC",
"BI",
"CI",
"EX",
"FP",
"FC",
"GH",
"GT",
"HI",
"HR",
"IN",
"KB",
"LI",
"MH",
"MG",
"NP",
"NB",
"RI",
"RS",
"SR",
"SP"
],
"CU": [
"09",
"03",
"12",
"14",
"11",
"99",
"02",
"10",
"04",
"01",
"07",
"13",
"05"
],
"DO": [
"AZ",
"BR",
"BH",
"DA",
"DN",
"DU",
"SE",
"HM",
"IN",
"AL",
"EP",
"RO",
"VE",
"MT",
"MN",
"MC",
"MP",
"PN",
"PR",
"PP",
"SC",
"SM",
"CR",
"JU",
"PM",
"SZ",
"ST",
"SR",
"VA"
],
"HT": [
"AR",
"CE",
"GA",
"ND",
"NE",
"NO",
"OU",
"SD",
"SE"
],
"JM": [
"13",
"09",
"01",
"12",
"04",
"02",
"06",
"14",
"11",
"08",
"05",
"03",
"07",
"10"
],
"TT": [
"ARI",
"CHA",
"CTT",
"DMN",
"ETO",
"PED",
"PTF",
"POS",
"PRT",
"RCM",
"SFO",
"SJL",
"SGE",
"SIP",
"TUP",
"WTO"
],
"AO": [
"BGO",
"BGU",
"BIE",
"CAB",
"CCU",
"CNO",
"CUS",
"CNN",
"HUA",
"HUI",
"LUA",
"LNO",
"LSU",
"MAL",
"MOX",
"NAM",
"UIG",
"ZAI"
],
"BF": [
"BAL",
"BAM",
"BAN",
"BAZ",
"BGR",
"BLG",
"BLK",
"COM",
"GAN",
"GNA",
"GOU",
"HOU",
"IOB",
"KAD",
"KMD",
"KMP",
"KOS",
"KOP",
"KOT",
"KOW",
"KEN",
"LOR",
"LER",
"MOU",
"NAO",
"NAM",
"NAY",
"NOU",
"OUB",
"OUD",
"PAS",
"PON",
"SNG",
"SMT",
"SIS",
"SOM",
"SOR",
"SEN",
"TAP",
"TUI",
"YAG",
"YAT",
"ZIR",
"ZON",
"ZOU"
],
"BI": [
"BB",
"BJ",
"BR",
"CA",
"CI",
"GI",
"KR",
"KY",
"KI",
"MA",
"MU",
"MY",
"NG",
"RT",
"RY"
],
"BJ": [
"AK",
"AQ",
"BO",
"MO",
"OU",
"ZO"
],
"BW": [
"CE",
"CH",
"GH",
"KG",
"KL",
"KW",
"NG",
"NE",
"SE",
"SO"
],
"CD": [
"BN",
"BC",
"HC",
"KW",
"KE",
"KA",
"KN",
"MA",
"NK",
"SK",
"EQ"
],
"CF": [
"BB",
"BGF",
"BK",
"HM",
"HK",
"KG",
"LB",
"HS",
"MB",
"KB",
"NM",
"MP",
"UK",
"AC",
"OP",
"SE",
"VK"
],
"CG": [
"11",
"BZV",
"8",
"15",
"5",
"7",
"2",
"9",
"14",
"12",
"13"
],
"CI": [
"06",
"16",
"09",
"10",
"02",
"07",
"01",
"12",
"05",
"11",
"03",
"15",
"13",
"04",
"14",
"08"
],
"CM": [
"AD",
"CE",
"ES",
"EN",
"LT",
"NO",
"NW",
"SU",
"SW",
"OU"
],
"CV": [
"BV",
"BR",
"FO",
"B",
"S",
"MA",
"PA",
"PN",
"PR",
"RG",
"SL",
"CA",
"CR",
"SN",
"SV",
"TA"
],
"DJ": [
"AS",
"DI",
"DJ",
"OB",
"TA"
],
"DZ": [
"01",
"16",
"44",
"46",
"05",
"07",
"09",
"34",
"10",
"35",
"08",
"06",
"02",
"25",
"17",
"32",
"39",
"36",
"47",
"24",
"33",
"18",
"40",
"03",
"29",
"43",
"27",
"28",
"26",
"45",
"31",
"30",
"04",
"48",
"20",
"22",
"21",
"41",
"19",
"11",
"14",
"37",
"42",
"38",
"15",
"13",
"12"
],
"EG": [
"DK",
"BA",
"BH",
"FYM",
"GH",
"ALX",
"IS",
"GZ",
"MN",
"MNF",
"KB",
"C",
"WAD",
"SUZ",
"SHR",
"ASN",
"AST",
"BNS",
"PTS",
"DT",
"JS",
"KFS",
"MT",
"KN",
"SIN",
"SHG"
],
"ER": [
"AG",
"AS",
"BA",
"DE",
"GS",
"HA",
"SA",
"SM",
"SN",
"SR"
],
"ET": [
"AA",
"AF",
"AM",
"BE",
"GA",
"HA",
"OR",
"SO",
"SN",
"TI"
],
"GA": [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"
],
"GH": [
"AH",
"BA",
"CP",
"EP",
"AA",
"NP",
"UE",
"UW",
"TV",
"WP"
],
"GM": [
"B",
"L",
"M",
"N",
"U",
"W"
],
"GN": [
"B",
"BE",
"BF",
"BK",
"C",
"CO",
"DB",
"DL",
"DI",
"DU",
"FA",
"F",
"FO",
"FR",
"GA",
"GU",
"KA",
"K",
"KD",
"D",
"KS",
"KB",
"KO",
"KE",
"LA",
"L",
"LO",
"LE",
"MC",
"ML",
"MM",
"M",
"MD",
"NZ",
"N",
"PI",
"SI",
"TO",
"TE",
"YO"
],
"GQ": [
"AN",
"BN",
"BS",
"CS",
"KN",
"LI",
"C",
"I",
"WN"
],
"GW": [
"BA",
"BM",
"BS",
"BL",
"CA",
"GA",
"OI",
"QU"
],
"KE": [
"200",
"300",
"400",
"110",
"500",
"600",
"700",
"900"
],
"KM": [
"A",
"G",
"M"
],
"LR": [
"BM",
"BG",
"GB",
"CM",
"GG",
"GK",
"LO",
"MG",
"MY",
"MO",
"NI",
"RI",
"SI"
],
"LS": [
"D",
"B",
"C",
"E",
"A",
"F",
"J",
"H",
"G",
"K"
],
"LY": [
"BU",
"JA",
"JG",
"Ju",
"Wu",
"WA",
"ZA",
"BA",
"FA",
"MI",
"NA",
"SF",
"TB"
],
"MA": [
"AGD",
"HAO",
"HOC",
"ASZ",
"AZI",
"BAH",
"MEL",
"BES",
"BEM",
"BER",
"BOD",
"BOM",
"CAS",
"CE",
"CN",
"CS",
"CHE",
"CHI",
"HAJ",
"JDI",
"ERR",
"ESM",
"ESI",
"ES",
"FIG",
"FES",
"GUE",
"IFR",
"IRA",
"KES",
"KHE",
"KHN",
"KHO",
"KEN",
"LAA",
"LAR",
"MAR",
"MEK",
"NAD",
"NO",
"OUA",
"OUD",
"OUJ",
"RBA",
"SAF",
"SEF",
"SET",
"SIK",
"SU",
"TNT",
"TNG",
"TAO",
"TAR",
"TAT",
"TAZ",
"TS",
"TIZ",
"TET"
],
"MG": [
"T",
"D",
"F",
"M",
"A",
"U"
],
"ML": [
"BKO",
"7",
"1",
"8",
"2",
"5",
"3",
"4",
"6"
],
"MR": [
"07",
"03",
"05",
"08",
"04",
"10",
"01",
"02",
"12",
"NKC",
"09",
"11",
"06"
],
"MU": [
"AG",
"BR",
"BL",
"CC",
"CU",
"FL",
"GP",
"MO",
"PA",
"PW",
"PL",
"QB",
"RR",
"RO",
"SA",
"VP"
],
"MW": [
"BL",
"C",
"CK",
"CR",
"CT",
"DE",
"DO",
"KR",
"KS",
"LI",
"MH",
"MG",
"MC",
"MU",
"MW",
"MZ",
"NB",
"NK",
"N",
"NS",
"NU",
"NI",
"RU",
"SA",
"S",
"TH",
"ZO"
],
"MZ": [
"P",
"G",
"I",
"B",
"MPM",
"L",
"N",
"A",
"S",
"T",
"Q"
],
"NA": [
"CA",
"ER",
"HA",
"KA",
"KH",
"KU",
"OW",
"OK",
"OH",
"OS",
"ON",
"OT",
"OD"
],
"NE": [
"1",
"2",
"3",
"4",
"8",
"5",
"6",
"7"
],
"NG": [
"AB",
"FC",
"AD",
"AK",
"AN",
"BA",
"BE",
"BO",
"CR",
"DE",
"ED",
"EN",
"IM",
"JI",
"KD",
"KN",
"KT",
"KE",
"KO",
"KW",
"LA",
"NI",
"OG",
"ON",
"OS",
"OY",
"PL",
"RI",
"SO",
"TA",
"YO"
],
"RW": [
"C",
"I",
"E",
"D",
"G",
"B",
"J",
"F",
"K",
"L",
"M",
"H"
],
"SD": [
"26",
"18",
"07",
"03",
"06",
"22",
"04",
"08",
"24",
"01",
"23",
"17",
"14",
"12",
"10",
"16",
"11",
"13",
"20",
"05",
"15",
"02",
"09",
"19",
"25",
"21"
],
"SL": [
"E",
"N",
"S",
"W"
],
"SN": [
"DK",
"DB",
"FK",
"KL",
"KD",
"LG",
"SL",
"TC",
"TH",
"ZG"
],
"SO": [
"AW",
"BY",
"BK",
"BN",
"BR",
"GA",
"GE",
"HI",
"JD",
"JH",
"MU",
"NU",
"SA",
"SD",
"SH",
"SO",
"TO",
"WO"
],
"ST": [
"P",
"S"
],
"SZ": [
"HH",
"LU",
"MA",
"SH"
],
"TD": [
"BA",
"BI",
"BET",
"CB",
"GR",
"KA",
"LC",
"LO",
"LR",
"MK",
"MC",
"OD",
"SA",
"TA"
],
"TG": [
"C",
"K",
"M",
"P",
"S"
],
"TN": [
"13",
"23",
"31",
"81",
"71",
"32",
"41",
"42",
"73",
"12",
"33",
"53",
"82",
"52",
"21",
"61",
"43",
"34",
"51",
"83",
"72",
"11",
"22"
],
"TZ": [
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20",
"21",
"22",
"23",
"24",
"25"
],
"UG": [
"APA",
"ARU",
"BUN",
"BUS",
"GUL",
"HOI",
"IGA",
"JIN",
"KBL",
"KBR",
"KLG",
"KLA",
"KLI",
"KAP",
"KAS",
"KLE",
"KIB",
"KIS",
"KIT",
"KOT",
"KUM",
"LIR",
"LUW",
"MSK",
"MSI",
"MBL",
"MBR",
"MOR",
"MOY",
"MPI",
"MUB",
"MUK",
"NEB",
"NTU",
"PAL",
"RAK",
"RUK",
"SOR",
"TOR"
],
"ZA": [
"EC",
"FS",
"GT",
"NL",
"MP",
"NW",
"NC",
"NP",
"WC"
],
"ZM": [
"02",
"08",
"03",
"04",
"09",
"06",
"05",
"07",
"01"
],
"ZW": [
"BU",
"HA",
"MA",
"MC",
"ME",
"MW",
"MV",
"MN",
"MS",
"MI"
]
},
"meta": {
"managed_by_zonely": false
},
"created": 1587399600,
"updated": 1587399600
}
Request
PUT v1/fulfillment/physical/zones/{id}
Body parameters
Name | Type | Status | Description |
---|---|---|---|
name |
string | required | Name of the zone |
countries.*.code |
string | required | A valid ISO-3166 country code that the zone applies to |
countries.*.subdivisions.* |
string | optional | A valid ISO-3166 subdivision code for each country, or |
meta |
object | optional | Optional metadata to store on the category |
Delete fulfillment zone
Deletes a fulfillment zone by its ID.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/fulfillment/physical/zones/zone_VNplJa1EaYwL60" \
--header "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/fulfillment/physical/zones/zone_VNplJa1EaYwL60"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/fulfillment/physical/zones/zone_VNplJa1EaYwL60'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/fulfillment/physical/zones/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | The fulfillment zone ID |
List rates for a zone
Returns a list of a rates for the specified fulfillment zone.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/fulfillment/physical/zones/zone_VNplJa1EaYwL60/rates" \
--header "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/fulfillment/physical/zones/zone_VNplJa1EaYwL60/rates"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/fulfillment/physical/zones/zone_VNplJa1EaYwL60/rates'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"data": [
{
"id": "rate_1ypbroE658n4ea",
"name": "International",
"type": "native_standard_v1",
"rate": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"meta": [],
"created": 1587399600,
"updated": 1587399600
},
{
"id": "rate_1ypbroE658n4ea",
"name": "International",
"type": "native_standard_v1",
"rate": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"meta": [],
"created": 1587399600,
"updated": 1587399600
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 2,
"current_page": 1,
"total_pages": 1,
"links": {}
}
}
}
Request
GET v1/fulfillment/physical/zones/{zone_id}/rates
URL parameters
Name | Status | Description |
---|---|---|
zone_id |
required | The fulfillment zone ID |
Create rate for zone
Create a new rate for the specified fulfillment zone.
Example request:
curl --request POST \
"https://api.chec.io/v1/fulfillment/physical/zones/zone_VNplJa1EaYwL60/rates" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"name\": \"Express\",
\"rate\": 19.95
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/fulfillment/physical/zones/zone_VNplJa1EaYwL60/rates"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/fulfillment/physical/zones/zone_VNplJa1EaYwL60/rates'
payload = {
"name": "Express",
"rate": 19.95
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"id": "rate_1ypbroE658n4ea",
"name": "International",
"type": "native_standard_v1",
"rate": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"meta": [],
"created": 1587399600,
"updated": 1587399600
}
Request
POST v1/fulfillment/physical/zones/{zone_id}/rates
URL parameters
Name | Status | Description |
---|---|---|
zone_id |
required | The fulfillment zone ID |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
name |
string | optional | Name of the rate |
rate |
number | required | Amount for the fulfillment rate |
meta |
object | optional | Optional metadata to store on the category |
Get rate for zone
Returns details for a specific fulfillment zone by its ID.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/fulfillment/physical/zones/zone_VNplJa1EaYwL60/rates/rate_B7ZQobNDa4AgNn" \
--header "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/fulfillment/physical/zones/zone_VNplJa1EaYwL60/rates/rate_B7ZQobNDa4AgNn"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/fulfillment/physical/zones/zone_VNplJa1EaYwL60/rates/rate_B7ZQobNDa4AgNn'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"id": "rate_1ypbroE658n4ea",
"name": "International",
"type": "native_standard_v1",
"rate": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"meta": [],
"created": 1587399600,
"updated": 1587399600
}
Request
GET v1/fulfillment/physical/zones/{zone_id}/rates/{rate_id}
URL parameters
Name | Status | Description |
---|---|---|
zone_id |
required | The fulfillment zone ID |
rate_id |
required | The rate ID |
Update rate for zone
Update an existing rate for the specified fulfillment zone.
Example request:
curl --request PUT \
"https://api.chec.io/v1/fulfillment/physical/zones/zone_VNplJa1EaYwL60/rates/rate_VNplJa1EaYwL60" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"name\": \"Express\",
\"rate\": 19.95
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/fulfillment/physical/zones/zone_VNplJa1EaYwL60/rates/rate_VNplJa1EaYwL60"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/fulfillment/physical/zones/zone_VNplJa1EaYwL60/rates/rate_VNplJa1EaYwL60'
payload = {
"name": "Express",
"rate": 19.95
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"id": "rate_1ypbroE658n4ea",
"name": "International",
"type": "native_standard_v1",
"rate": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"meta": [],
"created": 1587399600,
"updated": 1587399600
}
Request
PUT v1/fulfillment/physical/zones/{zone_id}/rates/{rate_id}
URL parameters
Name | Status | Description |
---|---|---|
zone_id |
required | The fulfillment zone ID |
rate_id |
required | The rate ID |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
name |
string | optional | Name of the rate |
rate |
number | optional | Amount for the fulfillment rate |
meta |
object | optional | Optional metadata to store on the category |
Delete rate
Deletes a rate for the specified fulfillment zone.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/fulfillment/physical/zones/zone_VNplJa1EaYwL60/rates/rate_B7ZQobNDa4AgNn" \
--header "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/fulfillment/physical/zones/zone_VNplJa1EaYwL60/rates/rate_B7ZQobNDa4AgNn"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/fulfillment/physical/zones/zone_VNplJa1EaYwL60/rates/rate_B7ZQobNDa4AgNn'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/fulfillment/physical/zones/{zone_id}/rates/{rate_id}
URL parameters
Name | Status | Description |
---|---|---|
zone_id |
required | The fulfillment zone ID |
rate_id |
required | The rate 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 --request GET \
--get "https://api.chec.io/v1/orders?limit=10" \
--header "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"
);
const params = {
"limit": "10",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.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": "[email protected]"
},
"extrafields": [
{
"id": "extr_7RyWOwmK5nEa2V",
"name": "Test",
"value": "Test",
"required": true
},
{
"id": "extr_1ypbroE658n4ea",
"name": "Website",
"value": "commercejs.com",
"required": false
}
],
"shipping": {
"name": "John Doe",
"street": "123 Fake St",
"town_city": "San Francisco",
"county_state": "CA",
"postal_zip_code": "94103",
"country": "US"
},
"billing": null,
"order": {
"line_items": [
{
"id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_4VPvL5zRQ5AQkX",
"product_name": "Cart Debug Digital + Physical",
"quantity": 1,
"price": {
"raw": 1,
"formatted": "1.00",
"formatted_with_symbol": "$1.00",
"formatted_with_code": "1.00 USD"
},
"line_total": {
"raw": 31,
"formatted": "31.00",
"formatted_with_symbol": "$31.00",
"formatted_with_code": "31.00 USD"
},
"variants": [
{
"variant_id": "vrnt_kpnNwAyBrwmXB3",
"option_id": "optn_PAYrQlWDbwnbR4",
"variant_name": "Variant #2",
"option_name": "Option 2",
"price": {
"raw": 20,
"formatted": "20.00",
"formatted_with_symbol": "20.00",
"formatted_with_code": "20.00 "
}
},
{
"variant_id": "vrnt_Kvg9l6Apq51bB7",
"option_id": "optn_r31q0o3E8lDdjR",
"variant_name": "Variant #1",
"option_name": "Option 2",
"price": {
"raw": 10,
"formatted": "10.00",
"formatted_with_symbol": "10.00",
"formatted_with_code": "10.00 "
}
}
],
"is_taxable": true,
"taxable_amount": {
"raw": 31,
"formatted": "31.00",
"formatted_with_symbol": "$31.00",
"formatted_with_code": "31.00 USD"
},
"tax_rate": 0.0875,
"tax_rate_percentage": "8.75%",
"tax_amount": {
"raw": 2.72,
"formatted": "2.72",
"formatted_with_symbol": "$2.72",
"formatted_with_code": "2.72 USD"
},
"tax_lines": [
{
"amount": {
"raw": 1.94,
"formatted": "1.94",
"formatted_with_symbol": "$1.94",
"formatted_with_code": "1.94 USD"
},
"rate": 0.0625,
"rate_percentage": "6.25%",
"type": "state"
},
{
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"rate": 0,
"rate_percentage": "0%",
"type": "city"
},
{
"amount": {
"raw": 0.08,
"formatted": "0.08",
"formatted_with_symbol": "$0.08",
"formatted_with_code": "0.08 USD"
},
"rate": 0.0025,
"rate_percentage": "0.25%",
"type": "county"
},
{
"amount": {
"raw": 0.7,
"formatted": "0.70",
"formatted_with_symbol": "$0.70",
"formatted_with_code": "0.70 USD"
},
"rate": 0.0225,
"rate_percentage": "2.25%",
"type": "district"
}
]
},
{
"id": "item_1ypbroE658n4ea",
"product_id": "prod_2yA6nldRBoEWbz",
"product_name": "Cart Debug W/ Shipping",
"quantity": 1,
"price": {
"raw": 11,
"formatted": "11.00",
"formatted_with_symbol": "$11.00",
"formatted_with_code": "11.00 USD"
},
"line_total": {
"raw": 11,
"formatted": "11.00",
"formatted_with_symbol": "$11.00",
"formatted_with_code": "11.00 USD"
},
"variants": [],
"is_taxable": true,
"taxable_amount": {
"raw": 11,
"formatted": "11.00",
"formatted_with_symbol": "$11.00",
"formatted_with_code": "11.00 USD"
},
"tax_rate": 0.0875,
"tax_rate_percentage": "8.75%",
"tax_amount": {
"raw": 0.97,
"formatted": "0.97",
"formatted_with_symbol": "$0.97",
"formatted_with_code": "0.97 USD"
},
"tax_lines": [
{
"amount": {
"raw": 0.69,
"formatted": "0.69",
"formatted_with_symbol": "$0.69",
"formatted_with_code": "0.69 USD"
},
"rate": 0.0625,
"rate_percentage": "6.25%",
"type": "state"
},
{
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"rate": 0,
"rate_percentage": "0%",
"type": "city"
},
{
"amount": {
"raw": 0.03,
"formatted": "0.03",
"formatted_with_symbol": "$0.03",
"formatted_with_code": "0.03 USD"
},
"rate": 0.0025,
"rate_percentage": "0.25%",
"type": "county"
},
{
"amount": {
"raw": 0.25,
"formatted": "0.25",
"formatted_with_symbol": "$0.25",
"formatted_with_code": "0.25 USD"
},
"rate": 0.0225,
"rate_percentage": "2.25%",
"type": "district"
}
]
},
{
"id": "item_dKvg9l6vl1bB76",
"product_id": "prod_Ekd6Ll2KYwV2mj",
"product_name": "Cart Debug",
"quantity": 1,
"price": {
"raw": 12,
"formatted": "12.00",
"formatted_with_symbol": "$12.00",
"formatted_with_code": "12.00 USD"
},
"line_total": {
"raw": 12,
"formatted": "12.00",
"formatted_with_symbol": "$12.00",
"formatted_with_code": "12.00 USD"
},
"variants": [],
"is_taxable": false,
"taxable_amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"tax_rate": null,
"tax_rate_percentage": null,
"tax_amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"tax_lines": null
}
],
"subtotal": {
"raw": 54,
"formatted": "54.00",
"formatted_with_symbol": "$54.00",
"formatted_with_code": "54.00 USD"
},
"discount": [],
"shipping": {
"id": "ship_31q0o3e21lDdjR",
"description": "USPS",
"price": {
"raw": 0.99,
"formatted": "0.99",
"formatted_with_symbol": "$0.99",
"formatted_with_code": "0.99 USD"
}
},
"tax": {
"amount": {
"raw": 3.69,
"formatted": "3.69",
"formatted_with_symbol": "$3.69",
"formatted_with_code": "3.69 USD"
},
"included_in_price": false,
"breakdown": [
{
"amount": {
"raw": 2.63,
"formatted": "2.63",
"formatted_with_symbol": "$2.63",
"formatted_with_code": "2.63 USD"
},
"rate": 0.0625,
"rate_percentage": "6.25%",
"type": "state"
},
{
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"rate": 0,
"rate_percentage": "0%",
"type": "city"
},
{
"amount": {
"raw": 0.11,
"formatted": "0.11",
"formatted_with_symbol": "$0.11",
"formatted_with_code": "0.11 USD"
},
"rate": 0.0025,
"rate_percentage": "0.25%",
"type": "county"
},
{
"amount": {
"raw": 0.95,
"formatted": "0.95",
"formatted_with_symbol": "$0.95",
"formatted_with_code": "0.95 USD"
},
"rate": 0.0225,
"rate_percentage": "2.25%",
"type": "district"
}
],
"zone": {
"country": "US",
"region": "CA",
"postal_zip_code": "94103",
"ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
}
},
"total": {
"raw": 54.99,
"formatted": "54.99",
"formatted_with_symbol": "$54.99",
"formatted_with_code": "54.99 USD"
},
"total_with_tax": {
"raw": 58.68,
"formatted": "58.68",
"formatted_with_symbol": "$58.68",
"formatted_with_code": "58.68 USD"
},
"pay_what_you_want": {
"enabled": true,
"minimum": {
"raw": 58.68,
"formatted": "58.68",
"formatted_with_symbol": "$58.68",
"formatted_with_code": "58.68 USD"
},
"customer_set_price": {
"raw": 100,
"formatted": "100.00",
"formatted_with_symbol": "$100.00",
"formatted_with_code": "100.00 USD"
}
}
},
"tax": {
"provider": "chec",
"provider_type": "native",
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"included_in_price": false,
"breakdown": [
{
"amount": {
"raw": 2.63,
"formatted": "2.63",
"formatted_with_symbol": "$2.63",
"formatted_with_code": "2.63 USD"
},
"rate": 0.0625,
"rate_percentage": "6.25%",
"type": "state"
},
{
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"rate": 0,
"rate_percentage": "0%",
"type": "city"
},
{
"amount": {
"raw": 0.11,
"formatted": "0.11",
"formatted_with_symbol": "$0.11",
"formatted_with_code": "0.11 USD"
},
"rate": 0.0025,
"rate_percentage": "0.25%",
"type": "county"
},
{
"amount": {
"raw": 0.95,
"formatted": "0.95",
"formatted_with_symbol": "$0.95",
"formatted_with_code": "0.95 USD"
},
"rate": 0.0225,
"rate_percentage": "2.25%",
"type": "district"
}
],
"zone": {
"country": "US",
"region": "CA",
"postal_zip_code": "94103",
"ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
}
},
"payments": [
{
"id": "pymnt_20icw2ZVLRq4",
"gateway_transaction_id": "ch_19HLUQDm0vyxCdYanLOHURDE",
"created": 1479510590,
"type": "card",
"kind": "sale",
"gateway": "stripe",
"reference": 4242,
"amount": {
"raw": 100,
"formatted": "100.00",
"formatted_with_symbol": "$100.00",
"formatted_with_code": "100.00 USD"
},
"currency": {
"code": "USD",
"symbol": "$"
},
"is_refunded": false,
"refund_date": null,
"payment_source": {
"brand": "Visa",
"country": "US",
"billing_zip_postal_code": "12345",
"tax_billing_country": "US"
}
}
],
"refunds": [],
"fulfillment": {
"shipping": {
"id": "ful_j0YnEoq65e7P61",
"description": "USPS",
"price": {
"raw": 0.99,
"formatted": "0.99",
"formatted_with_symbol": "$0.99",
"formatted_with_code": "0.99 USD"
},
"shipping_method_id": "ship_31q0o3e21lDdjR",
"provider": "chec",
"provider_type": "native_shipping",
"shipped_on": null,
"carrier": null,
"tracking_number": null,
"tracking_url": null
},
"digital": [
{
"provider": "chec",
"provider_type": "native_digital",
"line_item_id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_4VPvL5zRQ5AQkX",
"product_name": "Cart Debug Digital + Physical",
"packages": [
{
"id": "ful_Ekd6Ll2zlV2mjK",
"name": "commerce-js-example.html",
"access_link": "http://api.chec.dev/fulfill/ord_p7ZAMo1xwNJ4xX/ful_Ekd6Ll2zlV2mjK",
"ext": "HTML",
"size": "10.44 KB",
"size_in_bytes": "10694"
}
],
"lifespan": {
"expires": false,
"expiry_date": null,
"duration": null,
"period": null,
"download_limit": "unlimited",
"human": "Download links do not expire, and can be accessed unlimited time(s)"
},
"is_expired": false,
"is_access_revoked": false,
"remaining_attempts": null
}
]
},
"conditionals": {
"collected_fullname": false,
"collected_shipping_address": true,
"collected_billing_address": false,
"collected_extrafields": true,
"collected_tax": true,
"collected_eu_vat_moss_evidence": false,
"has_physical_fulfillent": true,
"has_digital_fulfillment": true,
"has_extend_fulfillment": false,
"has_webhook_fulfillment": false,
"has_extend_apps": false,
"has_pay_what_you_want": true,
"has_discounts": false,
"has_subscription_items": true,
"is_free": false,
"is_fulfilled": false,
"is_refunded": false
},
"client_details": {
"ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb",
"country_code": "US",
"country_name": "United States",
"region_code": "CA",
"region_name": "California",
"city": "San Francisco",
"postal_zip_code": "94103"
},
"metadata": []
}
],
"meta": {
"pagination": {
"total": 21,
"count": 1,
"per_page": 1,
"current_page": 1,
"total_pages": 21,
"links": {
"next": "http://api.chec.dev/v1/orders?limit=1&page=2"
}
}
}
}
Request
GET v1/orders
Query parameters
Name | Status | Description |
---|---|---|
limit |
optional | A limit on the number of orders to be returned. Limit can range between 1 and 100 items (default: 20). |
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. |
Get order
Returns a specific order from your merchant account.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX" \
--header "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"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.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": "[email protected]"
},
"extra_fields": [
{
"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": {
"raw": 0.99,
"formatted": "0.99",
"formatted_with_symbol": "$0.99",
"formatted_with_code": "0.99 USD"
}
},
"tax": {
"amount": {
"raw": 3.69,
"formatted": "3.69",
"formatted_with_symbol": "$3.69",
"formatted_with_code": "3.69 USD"
},
"included_in_price": false,
"breakdown": [
{
"amount": {
"raw": 2.63,
"formatted": "2.63",
"formatted_with_symbol": "$2.63",
"formatted_with_code": "2.63 USD"
},
"rate": 0.0625,
"rate_percentage": "6.25%",
"type": "state"
},
{
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"rate": 0,
"rate_percentage": "0%",
"type": "city"
},
{
"amount": {
"raw": 0.11,
"formatted": "0.11",
"formatted_with_symbol": "$0.11",
"formatted_with_code": "0.11 USD"
},
"rate": 0.0025,
"rate_percentage": "0.25%",
"type": "county"
},
{
"amount": {
"raw": 0.95,
"formatted": "0.95",
"formatted_with_symbol": "$0.95",
"formatted_with_code": "0.95 USD"
},
"rate": 0.0225,
"rate_percentage": "2.25%",
"type": "district"
}
],
"zone": {
"country": "US",
"region": "CA",
"postal_zip_code": "94103",
"ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
}
},
"total": {
"raw": 54.99,
"formatted": "54.99",
"formatted_with_symbol": "$54.99",
"formatted_with_code": "54.99 USD"
},
"total_with_tax": {
"raw": 58.68,
"formatted": "58.68",
"formatted_with_symbol": "$58.68",
"formatted_with_code": "58.68 USD"
},
"pay_what_you_want": {
"enabled": true,
"minimum": {
"raw": 58.68,
"formatted": "58.68",
"formatted_with_symbol": "$58.68",
"formatted_with_code": "58.68 USD"
},
"customer_set_price": {
"raw": 100,
"formatted": "100.00",
"formatted_with_symbol": "$100.00",
"formatted_with_code": "100.00 USD"
}
}
},
"tax": {
"provider": "chec",
"provider_type": "native",
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"included_in_price": false,
"breakdown": [
{
"amount": {
"raw": 2.63,
"formatted": "2.63",
"formatted_with_symbol": "$2.63",
"formatted_with_code": "2.63 USD"
},
"rate": 0.0625,
"rate_percentage": "6.25%",
"type": "state"
},
{
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"rate": 0,
"rate_percentage": "0%",
"type": "city"
},
{
"amount": {
"raw": 0.11,
"formatted": "0.11",
"formatted_with_symbol": "$0.11",
"formatted_with_code": "0.11 USD"
},
"rate": 0.0025,
"rate_percentage": "0.25%",
"type": "county"
},
{
"amount": {
"raw": 0.95,
"formatted": "0.95",
"formatted_with_symbol": "$0.95",
"formatted_with_code": "0.95 USD"
},
"rate": 0.0225,
"rate_percentage": "2.25%",
"type": "district"
}
],
"zone": {
"country": "US",
"region": "CA",
"postal_zip_code": "94103",
"ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
}
},
"payments": [
{
"id": "pymnt_20icw2ZVLRq4",
"gateway_transaction_id": "ch_19HLUQDm0vyxCdYanLOHURDE",
"created": 1479510590,
"type": "card",
"kind": "sale",
"gateway": "stripe",
"reference": 4242,
"amount": {
"raw": 100,
"formatted": "100.00",
"formatted_with_symbol": "$100.00",
"formatted_with_code": "100.00 USD"
},
"currency": {
"code": "USD",
"symbol": "$"
},
"is_refunded": false,
"refund_date": null,
"payment_source": {
"brand": "Visa",
"country": "US",
"billing_zip_postal_code": "12345",
"tax_billing_country": "US"
}
}
],
"refunds": [],
"fulfillment": {
"shipping": {
"id": "ful_j0YnEoq65e7P61",
"description": "USPS",
"price": {
"raw": 0.99,
"formatted": "0.99",
"formatted_with_symbol": "$0.99",
"formatted_with_code": "0.99 USD"
},
"shipping_method_id": "ship_31q0o3e21lDdjR",
"provider": "chec",
"provider_type": "native_shipping",
"shipped_on": null,
"carrier": null,
"tracking_number": null,
"tracking_url": null
},
"digital": [
{
"provider": "chec",
"provider_type": "native_digital",
"line_item_id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_4VPvL5zRQ5AQkX",
"product_name": "Cart Debug Digital + Physical",
"packages": [
{
"id": "ful_Ekd6Ll2zlV2mjK",
"name": "commerce-js-example.html",
"access_link": "http://api.chec.dev/fulfill/ord_p7ZAMo1xwNJ4xX/ful_Ekd6Ll2zlV2mjK",
"ext": "HTML",
"size": "10.44 KB",
"size_in_bytes": "10694"
}
],
"lifespan": {
"expires": false,
"expiry_date": null,
"duration": null,
"period": null,
"download_limit": "unlimited",
"human": "Download links do not expire, and can be accessed unlimited time(s)"
},
"is_expired": false,
"is_access_revoked": false,
"remaining_attempts": null
}
]
},
"conditionals": {
"collected_fullname": false,
"collected_shipping_address": true,
"collected_billing_address": false,
"collected_extrafields": true,
"collected_tax": true,
"collected_eu_vat_moss_evidence": false,
"has_physical_fulfillent": true,
"has_digital_fulfillment": true,
"has_extend_fulfillment": false,
"has_webhook_fulfillment": false,
"has_extend_apps": false,
"has_pay_what_you_want": true,
"has_discounts": false,
"has_subscription_items": true,
"is_free": false,
"is_fulfilled": false,
"is_refunded": false
},
"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": []
}
Request
GET v1/orders/{order_id}
URL parameters
Name | Status | Description |
---|---|---|
order_id |
required | The order ID (or reference) to retrieve |
Query parameters
Name | Status | Description |
---|---|---|
type |
optional | The identifier type to use for the lookup: |
Update order
Updates part of an existing order: customer information, shipping or billing addresses, extra fields, and conditionals. You cannot update any financial information for an existing order.
When you provide new data for an order, the appropriate conditionals will also be updated to reflect the changes.
For example, updating the customer's name will also set conditionals.collects_fullname: true
.
Example request:
curl --request PUT \
"https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"customer_reference\": \"ABC-123-ZYX\"
}"
// 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"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX'
payload = {
"customer_reference": "ABC-123-ZYX"
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
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": {
"firstname": "Johnny",
"lastname": "Doe",
"email": "[email protected]"
},
"extrafields": [
{
"id": "extr_Kvg9l6zvnl1bB7",
"name": "Phone number",
"value": "415-111-2222",
"required": true
},
{
"id": "extr_bWZ3l8zLNokpEQ",
"name": "Website",
"value": "google.com",
"required": false
}
],
"shipping": {
"name": "Johnny Doe",
"street": "123 Fake St",
"town_city": "San Francisco",
"county_state": "CA",
"postal_zip_code": "94103",
"country": "US"
},
"billing": {
"name": "Johnny Doe",
"street": "234 Fake St",
"town_city": "San Francisco",
"county_state": "CA",
"postal_zip_code": "94103",
"country": "US"
},
"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": {
"collects_fullname": true,
"collects_shipping_address": true,
"collects_billing_address": true,
"collects_extrafields": true,
"collects_tax": true,
"collects_eu_vat_moss_evidence": false,
"has_physical_fulfillent": true,
"has_digital_fulfillment": true,
"has_extend_fulfillment": false,
"has_webhook_fulfillment": false,
"has_extend_apps": false,
"has_pay_what_you_want": true,
"has_discounts": false,
"has_subscription_items": true,
"is_free": false,
"is_fulfilled": false,
"is_refunded": false
},
"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": []
}
Request
PUT v1/orders/{order_id}
URL parameters
Name | Status | Description |
---|---|---|
order_id |
required | The order ID to update |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
customer_reference |
string | optional | The order's customer reference, must be unique |
customer.firstname |
string | optional | Customer's first name |
customer.lastname |
string | optional | Customer's last name |
customer.email |
string | optional | 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) |
billing.name |
string | optional | The customer's billing 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) |
extra_fields.extr_Kvg9l6zvnl1bB7 |
string | optional | The new data for the extra field |
extra_fields.extr_bWZ3l8zLNokpEQ |
string | optional | The new data for the extra field |
meta |
object | optional | Optional metadata to store on the order |
Refund an order
Fully refunds the provided order ID.
Example request:
curl --request POST \
"https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/actions/refund" \
--header "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/actions/refund"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/actions/refund'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('POST', url, headers=headers)
response.json()
Example response (200):
{
"success": true,
"action": "refund.full",
"details": {
"amount": {
"raw": 100,
"formatted": "100.00",
"formatted_with_symbol": "$100.00",
"formatted_with_code": "100.00 USD"
},
"refunded_transaction_id": "EXAM-RFND-1234",
"gateway_response": {}
}
}
Request
POST v1/orders/{order_id}/actions/refund
URL parameters
Name | Status | Description |
---|---|---|
order_id |
required | The order ID to retrieve |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
revokeDigitalDownloads |
boolean | optional | Whether access to digital downloads for with this order will be revoked. Default: true. |
Cancel an order
Cancel the provided order by ID.
Example request:
curl --request POST \
"https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/actions/cancel" \
--header "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/actions/cancel"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/actions/cancel'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('POST', url, headers=headers)
response.json()
Request
POST v1/orders/{order_id}/actions/cancel
URL parameters
Name | Status | Description |
---|---|---|
order_id |
required | The order ID to retrieve |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
revokeDigitalDownloads |
boolean | optional | Whether access to digital downloads for with this order will be revoked. Default: true. |
Update a transaction
Updates a transaction for an order. The merchant editable notes can always be updated on a transaction, but most other options can only be set when the transaction is pending. Specifically, the status of a completed transaction cannot be updated.
The available statuses are complete
, pending
, cancelled
, and failed
.
The status_reason
is required when the status is not being set to complete
. Currently available reasons are:
- Status:
pending
awaiting_charge_date
- The transaction should not be completed until the configured charge date has passedawaiting_fulfillment
- The transaction should only be completed when an associated order has been fulfilledawaiting_authorization
- The transaction has initiated, but needs to be authorized by the buyer. For example, a bank transfer payment has been requested, but the buyer has not yet initiated the transfer.awaiting_capture
- The transaction has started, but needs to be confirmed/captured. For example, a card has been authorized, but not captured
- Status:
cancelled
order_cancelled
- The order was cancelled before the transaction was completed.
- Status:
failed
gateway_failure
- The payment gateway returned an unexpected error while processing a payment/refund for the transactioncard_declined
- The credit card used to pay the value of the transaction was declinedcard_expired
- The credit card used to pay the value of the transaction was expired
Example request:
curl --request PUT \
"https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/transactions/trns_wEGyl2WXagveZx" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"notes\": \"non\",
\"status\": \"non\",
\"status_reason\": \"non\",
\"charge_date\": 3,
\"gateway_transaction_id\": 3,
\"gateway_reference\": 2
}"
// 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/transactions/trns_wEGyl2WXagveZx"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/transactions/trns_wEGyl2WXagveZx'
payload = {
"notes": "non",
"status": "non",
"status_reason": "non",
"charge_date": 3,
"gateway_transaction_id": 3,
"gateway_reference": 2
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()
Request
PUT v1/orders/{order_id}/transactions/{transaction_id}
URL parameters
Name | Status | Description |
---|---|---|
order_id |
required | The order ID (or reference) where the transaction is |
transaction_id |
required | The transaction ID to update |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
notes |
string | optional | The notes to set on the transaction |
status |
string | optional | The new status for the transaction (only applicable for pending transactions) |
status_reason |
string | optional | The new status "reason" for the transaction (only applicable for pending transactions) |
charge_date |
integer | optional | A timestamp when this transaction was charged (only applicable for pending transactions) |
gateway_transaction_id |
integer | optional | An ID for the transaction provided by the gateway (only applicable for pending transactions) |
gateway_reference |
integer | optional | An arbitrary reference the gateway may provide for the transaction (only applicable for pending transactions) |
Retrieve fulfillments
Returns a list of fulfillments for an order.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/fulfillment" \
--header "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/fulfillment"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/fulfillment'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"order_id": "ord_p7ZAMo1xwNJ4xX",
"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
}
]
}
Request
GET v1/orders/{order_id}/fulfillment
URL parameters
Name | Status | Description |
---|---|---|
order_id |
required | The order ID |
Create physical fulfillment
Creates a physical fulfillment (shipment) for the provided order.
Example request:
curl --request POST \
"https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/fulfillments/physical/shipments" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"carrier\": \"USPS\",
\"tracking_number\": \"1234-ABCD\",
\"tracking_url\": \"https:\\/\\/example.com\\/track\\/order123\"
}"
// 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/fulfillments/physical/shipments"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/fulfillments/physical/shipments'
payload = {
"carrier": "USPS",
"tracking_number": "1234-ABCD",
"tracking_url": "https:\/\/example.com\/track\/order123"
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"order_id": "ord_p7ZAMo1xwNJ4xX",
"id": "ful_j0YnEoq65e7P62",
"shipped_on": 1571769401,
"provider": "chec",
"provider_type": "native",
"carrier": "usps",
"carrier_name": "USPS",
"tracking_number": "1234-ABCD",
"tracking_url": "https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=1234-ABCD",
"line_items": [
{
"id": "item_7RyWOwmK5nEa2V",
"quantity": 1
},
{
"id": "item_1ypbroE658n4ea",
"quantity": 1
},
{
"id": "item_dKvg9l6vl1bB76",
"quantity": 1
}
],
"created": "1571769400",
"metadata": {
"foo-example": "bar"
}
}
Request
POST v1/orders/{order_id}/fulfillments/physical/shipments
URL parameters
Name | Status | Description |
---|---|---|
order_id |
required | The order ID to retrieve |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
line_items.*.id |
string | optional | Line item ID to ship. If not provided, all line items will be shipped. |
line_items.*.quantity |
integer | optional | Line item quantity to ship. If not provided, all line items will be shipped. |
carrier |
string | optional | The carrier to use for shipping |
tracking_number |
string | optional | The tracking number to attach to the fulfillment |
tracking_url |
string | optional | Only when using |
shipped_on |
integer | optional | The unix timestamp for when the shipment was created (default: now) |
meta |
object | optional | Optional metadata to store on the fulfillment |
Retrieve physical fulfillment
Returns detailed information for a specific physical fullfillment/shipment associated with an order.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/fulfillments/physical/shipments/ful_j0YnEoq65e7P61" \
--header "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/fulfillments/physical/shipments/ful_j0YnEoq65e7P61"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/fulfillments/physical/shipments/ful_j0YnEoq65e7P61'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"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,
"ship_to": {
"name": "Johnny Doe",
"street": "123 Fake St",
"town_city": "San Francisco",
"county_state": "CA",
"postal_zip_code": "94103",
"country": "US"
},
"bill_to": {
"name": "Johnny Doe",
"street": "234 Fake St",
"town_city": "San Francisco",
"county_state": "CA",
"postal_zip_code": "94103",
"country": "US"
},
"order_customer_reference": "TSTNC-21",
"order_fulfillment_status": "fulfilled"
}
Request
GET v1/orders/{order_id}/fulfillments/physical/shipments/{shipment_id}
URL parameters
Name | Status | Description |
---|---|---|
order_id |
required | The order ID |
shipment_id |
required | The physical shipment ID |
List digital packages in an order
Returns a list of digital fulfillment packages/downloads for the provided order.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/fulfillments/digital/packages" \
--header "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/fulfillments/digital/packages"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/fulfillments/digital/packages'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"data": [
{
"id": "ful_VNplJa1EaYwL60",
"name": "Mona Lisa copy",
"access_link": "https://api.chec.io/fulfill/ord_VNplJa1EaYwL60/ful_VNplJa1EaYwL60",
"ext": "PNG",
"size": "203 KB",
"size_in_bytes": 208000,
"remaining_downloads": 2,
"access_expires": 1582338142,
"is_access_revoked": false
}
]
}
Request
GET v1/orders/{order_id}/fulfillments/digital/packages
URL parameters
Name | Status | Description |
---|---|---|
order_id |
required | The order ID |
Get digital package
Get a digital fulfillment package/download for the provided order.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/fulfillments/digital/packages/ful_VNplJa1EaYwL60" \
--header "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/fulfillments/digital/packages/ful_VNplJa1EaYwL60"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/fulfillments/digital/packages/ful_VNplJa1EaYwL60'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"id": "ful_VNplJa1EaYwL60",
"name": "Mona Lisa copy",
"access_link": "https://api.chec.io/fulfill/ord_VNplJa1EaYwL60/ful_VNplJa1EaYwL60",
"ext": "PNG",
"size": "203 KB",
"size_in_bytes": 208000,
"remaining_downloads": 2,
"access_expires": 1582338142,
"is_access_revoked": false
}
Request
GET v1/orders/{order_id}/fulfillments/digital/packages/{package_id}
URL parameters
Name | Status | Description |
---|---|---|
order_id |
required | The order ID |
package_id |
required | The digital package ID |
Revoke digital package
Revoke further access to a digital fulfillment package/download for the provided order.
Example request:
curl --request POST \
"https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/fulfillments/digital/packages/ful_VNplJa1EaYwL60/revoke" \
--header "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/fulfillments/digital/packages/ful_VNplJa1EaYwL60/revoke"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/fulfillments/digital/packages/ful_VNplJa1EaYwL60/revoke'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('POST', url, headers=headers)
response.json()
Example response (200):
{
"id": "ful_VNplJa1EaYwL60",
"name": "Mona Lisa copy",
"access_link": "https://api.chec.io/fulfill/ord_VNplJa1EaYwL60/ful_VNplJa1EaYwL60",
"ext": "PNG",
"size": "203 KB",
"size_in_bytes": 208000,
"remaining_downloads": 50,
"access_expires": 1582338142,
"is_access_revoked": true
}
Request
POST v1/orders/{order_id}/fulfillments/digital/packages/{package_id}/revoke
URL parameters
Name | Status | Description |
---|---|---|
order_id |
required | The order ID |
package_id |
required | The digital package ID |
Enable digital package
Enable (or re-enable) further access to a digital fulfillment package/download for the provided order. You may also adjust the number of remaining downloads, and the time the package will expire.
Example request:
curl --request POST \
"https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/fulfillments/digital/packages/ful_VNplJa1EaYwL60/enable" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"remaining_downloads\": 5,
\"access_expires\": \"2020-02-22 14:22:22\"
}"
// 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/fulfillments/digital/packages/ful_VNplJa1EaYwL60/enable"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/fulfillments/digital/packages/ful_VNplJa1EaYwL60/enable'
payload = {
"remaining_downloads": 5,
"access_expires": "2020-02-22 14:22:22"
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"id": "ful_VNplJa1EaYwL60",
"name": "Mona Lisa copy",
"access_link": "https://api.chec.io/fulfill/ord_VNplJa1EaYwL60/ful_VNplJa1EaYwL60",
"ext": "PNG",
"size": "203 KB",
"size_in_bytes": 208000,
"remaining_downloads": 50,
"access_expires": 2281623620,
"is_access_revoked": false
}
Request
POST v1/orders/{order_id}/fulfillments/digital/packages/{package_id}/enable
URL parameters
Name | Status | Description |
---|---|---|
order_id |
required | The order ID |
package_id |
required | The digital package ID |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
remaining_downloads |
integer | optional | The number of times the package may be downloaded. If null is provided, the remaining downloads will be set to unlimited. |
access_expires |
string | optional | The date the package should expire in the format |
List notes for order
Returns a paginated list of private (merchant only) notes for the provided order.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/orders/ord_K1YDR2qy29Qem6/notes" \
--header "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_K1YDR2qy29Qem6/notes"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/orders/ord_K1YDR2qy29Qem6/notes'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"data": [
{
"id": "note_VNplJa1EaYwL60",
"content": "Customer has been refunded for the shipping amount",
"meta": {
"signed_off_by": "Charlie in accounts"
},
"created": 1577934245,
"updated": 1577937906
},
{
"id": "note_B7ZQobNDa4AgNn",
"content": "2020 was a write off, bring on the new year.",
"meta": [],
"created": 1577934245,
"updated": 1577937906
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 20,
"current_page": 1,
"total_pages": 1,
"links": []
}
}
}
Request
GET v1/orders/{order_id}/notes
URL parameters
Name | Status | Description |
---|---|---|
order_id |
required | The order's ID |
Get note for order
Returns a single private (merchant only) note for the provided order.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/orders/ord_K1YDR2qy29Qem6/notes/note_7RyWOwmK5nEa2V" \
--header "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_K1YDR2qy29Qem6/notes/note_7RyWOwmK5nEa2V"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/orders/ord_K1YDR2qy29Qem6/notes/note_7RyWOwmK5nEa2V'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"id": "note_VNplJa1EaYwL60",
"content": "Customer has been refunded for the shipping amount",
"meta": {
"signed_off_by": "Charlie in accounts"
},
"created": 1577934245,
"updated": 1577937906
}
Request
GET v1/orders/{order_id}/notes/{note_id}
URL parameters
Name | Status | Description |
---|---|---|
order_id |
required | The order's ID |
note_id |
required | The note ID to retrieve |
Create note for order
Create a new note and assign it to the provided order.
Example request:
curl --request POST \
"https://api.chec.io/v1/orders/ord_K1YDR2qy29Qem6/notes" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"content\": \"Today was a good day\"
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/orders/ord_K1YDR2qy29Qem6/notes"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/orders/ord_K1YDR2qy29Qem6/notes'
payload = {
"content": "Today was a good day"
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"id": "note_VNplJa1EaYwL60",
"content": "Customer has been refunded for the shipping amount",
"meta": {
"signed_off_by": "Charlie in accounts"
},
"created": 1577934245,
"updated": 1577937906
}
Request
POST v1/orders/{order_id}/notes
URL parameters
Name | Status | Description |
---|---|---|
order_id |
required | The order's ID |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
content |
string | required | The content of the note |
meta |
string[] | optional | An optional array of metadata to store on the note |
Update note for order
Updates a specific note for the provided order.
Example request:
curl --request PUT \
"https://api.chec.io/v1/orders/ord_K1YDR2qy29Qem6/notes/note_7RyWOwmK5nEa2V" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"content\": \"Today was a good day\"
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/orders/ord_K1YDR2qy29Qem6/notes/note_7RyWOwmK5nEa2V"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/orders/ord_K1YDR2qy29Qem6/notes/note_7RyWOwmK5nEa2V'
payload = {
"content": "Today was a good day"
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"id": "note_VNplJa1EaYwL60",
"content": "Customer has been refunded for the shipping amount",
"meta": {
"signed_off_by": "Charlie in accounts"
},
"created": 1577934245,
"updated": 1577937906
}
Request
PUT v1/orders/{order_id}/notes/{note_id}
URL parameters
Name | Status | Description |
---|---|---|
order_id |
required | The order's ID |
note_id |
required | The note ID to retrieve |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
content |
string | required | The content of the note |
meta |
string[] | optional | An optional array of metadata to store on the note |
Delete note for order
Deletes a note from the provided order.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/orders/ord_K1YDR2qy29Qem6/notes/note_7RyWOwmK5nEa2V" \
--header "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_K1YDR2qy29Qem6/notes/note_7RyWOwmK5nEa2V"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/orders/ord_K1YDR2qy29Qem6/notes/note_7RyWOwmK5nEa2V'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/orders/{order_id}/notes/{note_id}
URL parameters
Name | Status | Description |
---|---|---|
order_id |
required | The order's ID |
note_id |
required | The note ID to retrieve |
Resend receipt
Resend the order receipt to the customer. Note that if you have disabled your customer receipt emails then this API will not send anything, but will still return a successful response. This API will return the order object in its response. If an email was sent, the response code will be 201, otherwise it will be 200.
Example request:
curl --request POST \
"https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/actions/resend-receipt" \
--header "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/actions/resend-receipt"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/orders/ord_p7ZAMo1xwNJ4xX/actions/resend-receipt'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('POST', url, headers=headers)
response.json()
Example response (201):
{
"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": "[email protected]"
},
"extra_fields": [
{
"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": {
"raw": 0.99,
"formatted": "0.99",
"formatted_with_symbol": "$0.99",
"formatted_with_code": "0.99 USD"
}
},
"tax": {
"amount": {
"raw": 3.69,
"formatted": "3.69",
"formatted_with_symbol": "$3.69",
"formatted_with_code": "3.69 USD"
},
"included_in_price": false,
"breakdown": [
{
"amount": {
"raw": 2.63,
"formatted": "2.63",
"formatted_with_symbol": "$2.63",
"formatted_with_code": "2.63 USD"
},
"rate": 0.0625,
"rate_percentage": "6.25%",
"type": "state"
},
{
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"rate": 0,
"rate_percentage": "0%",
"type": "city"
},
{
"amount": {
"raw": 0.11,
"formatted": "0.11",
"formatted_with_symbol": "$0.11",
"formatted_with_code": "0.11 USD"
},
"rate": 0.0025,
"rate_percentage": "0.25%",
"type": "county"
},
{
"amount": {
"raw": 0.95,
"formatted": "0.95",
"formatted_with_symbol": "$0.95",
"formatted_with_code": "0.95 USD"
},
"rate": 0.0225,
"rate_percentage": "2.25%",
"type": "district"
}
],
"zone": {
"country": "US",
"region": "CA",
"postal_zip_code": "94103",
"ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
}
},
"total": {
"raw": 54.99,
"formatted": "54.99",
"formatted_with_symbol": "$54.99",
"formatted_with_code": "54.99 USD"
},
"total_with_tax": {
"raw": 58.68,
"formatted": "58.68",
"formatted_with_symbol": "$58.68",
"formatted_with_code": "58.68 USD"
},
"pay_what_you_want": {
"enabled": true,
"minimum": {
"raw": 58.68,
"formatted": "58.68",
"formatted_with_symbol": "$58.68",
"formatted_with_code": "58.68 USD"
},
"customer_set_price": {
"raw": 100,
"formatted": "100.00",
"formatted_with_symbol": "$100.00",
"formatted_with_code": "100.00 USD"
}
}
},
"tax": {
"provider": "chec",
"provider_type": "native",
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"included_in_price": false,
"breakdown": [
{
"amount": {
"raw": 2.63,
"formatted": "2.63",
"formatted_with_symbol": "$2.63",
"formatted_with_code": "2.63 USD"
},
"rate": 0.0625,
"rate_percentage": "6.25%",
"type": "state"
},
{
"amount": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"rate": 0,
"rate_percentage": "0%",
"type": "city"
},
{
"amount": {
"raw": 0.11,
"formatted": "0.11",
"formatted_with_symbol": "$0.11",
"formatted_with_code": "0.11 USD"
},
"rate": 0.0025,
"rate_percentage": "0.25%",
"type": "county"
},
{
"amount": {
"raw": 0.95,
"formatted": "0.95",
"formatted_with_symbol": "$0.95",
"formatted_with_code": "0.95 USD"
},
"rate": 0.0225,
"rate_percentage": "2.25%",
"type": "district"
}
],
"zone": {
"country": "US",
"region": "CA",
"postal_zip_code": "94103",
"ip_address": "2604:5500:12:2ff:240b:b205:dce8:79cb"
}
},
"payments": [
{
"id": "pymnt_20icw2ZVLRq4",
"gateway_transaction_id": "ch_19HLUQDm0vyxCdYanLOHURDE",
"created": 1479510590,
"type": "card",
"kind": "sale",
"gateway": "stripe",
"reference": 4242,
"amount": {
"raw": 100,
"formatted": "100.00",
"formatted_with_symbol": "$100.00",
"formatted_with_code": "100.00 USD"
},
"currency": {
"code": "USD",
"symbol": "$"
},
"is_refunded": false,
"refund_date": null,
"payment_source": {
"brand": "Visa",
"country": "US",
"billing_zip_postal_code": "12345",
"tax_billing_country": "US"
}
}
],
"refunds": [],
"fulfillment": {
"shipping": {
"id": "ful_j0YnEoq65e7P61",
"description": "USPS",
"price": {
"raw": 0.99,
"formatted": "0.99",
"formatted_with_symbol": "$0.99",
"formatted_with_code": "0.99 USD"
},
"shipping_method_id": "ship_31q0o3e21lDdjR",
"provider": "chec",
"provider_type": "native_shipping",
"shipped_on": null,
"carrier": null,
"tracking_number": null,
"tracking_url": null
},
"digital": [
{
"provider": "chec",
"provider_type": "native_digital",
"line_item_id": "item_7RyWOwmK5nEa2V",
"product_id": "prod_4VPvL5zRQ5AQkX",
"product_name": "Cart Debug Digital + Physical",
"packages": [
{
"id": "ful_Ekd6Ll2zlV2mjK",
"name": "commerce-js-example.html",
"access_link": "http://api.chec.dev/fulfill/ord_p7ZAMo1xwNJ4xX/ful_Ekd6Ll2zlV2mjK",
"ext": "HTML",
"size": "10.44 KB",
"size_in_bytes": "10694"
}
],
"lifespan": {
"expires": false,
"expiry_date": null,
"duration": null,
"period": null,
"download_limit": "unlimited",
"human": "Download links do not expire, and can be accessed unlimited time(s)"
},
"is_expired": false,
"is_access_revoked": false,
"remaining_attempts": null
}
]
},
"conditionals": {
"collected_fullname": false,
"collected_shipping_address": true,
"collected_billing_address": false,
"collected_extrafields": true,
"collected_tax": true,
"collected_eu_vat_moss_evidence": false,
"has_physical_fulfillent": true,
"has_digital_fulfillment": true,
"has_extend_fulfillment": false,
"has_webhook_fulfillment": false,
"has_extend_apps": false,
"has_pay_what_you_want": true,
"has_discounts": false,
"has_subscription_items": true,
"is_free": false,
"is_fulfilled": false,
"is_refunded": false
},
"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": []
}
Request
POST v1/orders/{order_id}/actions/resend-receipt
URL parameters
Name | Status | Description |
---|---|---|
order_id |
required | The order ID to retrieve |
Products
List all products
Returns a list of product details for the current merchant. You may filter this by the optional query parameters listed below.
Please note that using the products list call will only return currently active products. Inactive products will not be included in the response unless your secret API key is used.
This API may be filtered by a key-value list of attributes. Attribute values may be a string, null, or an array of strings to match. All specified attribute filters must match. When an array of values for an attribute is provided, any value will match. This allows for AND/OR style attribute filtering.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/products?limit=25" \
--header "X-Authorization: {token}"
// Fetch all products
Commerce.products.list().then(response => response.data);
// Fetch products specifying some additional parameters
const limit = 50;
const categorySlug = 'shoes';
Commerce.products.list({
limit: limit,
category_slug: categorySlug,
}).then(response => response.data);
const url = new URL(
"https://api.chec.io/v1/products"
);
const params = {
"limit": "25",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/products'
params = {
'limit': '25',
}
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()
Example response (200):
{
"data": [
{
"id": "prod_1ypbroE658n4ea",
"created": 1658849854,
"updated": 1658849859,
"active": true,
"permalink": "ABC123",
"name": "Commerce.js lapel pin",
"description": "<p>Simply attach these pins to instantly wear a suit!</p>",
"price": {
"raw": 10,
"formatted": "10.00",
"formatted_with_symbol": "$10.00",
"formatted_with_code": "10.00 USD"
},
"inventory": {
"managed": false,
"available": 0
},
"sku": "CJS-PIN-WTE",
"sort_order": 7,
"seo": {
"title": null,
"description": null
},
"thank_you_url": null,
"meta": null,
"conditionals": {
"is_active": true,
"is_tax_exempt": false,
"is_pay_what_you_want": false,
"is_inventory_managed": false,
"is_sold_out": false,
"has_digital_delivery": false,
"has_physical_delivery": true,
"has_images": false,
"collects_fullname": false,
"collects_shipping_address": false,
"collects_billing_address": false,
"collects_extra_fields": true
},
"is": {
"active": true,
"tax_exempt": false,
"pay_what_you_want": false,
"inventory_managed": false,
"sold_out": false
},
"has": {
"digital_delivery": false,
"physical_delivery": true,
"images": false
},
"collects": {
"fullname": false,
"shipping_address": false,
"billing_address": false,
"extra_fields": true
},
"checkout_url": {
"checkout": "https://checkout.chec.io/ABC123?checkout=true",
"display": "https://checkout.chec.io/ABC123"
},
"categories": [],
"image": null
},
{
"id": "prod_1ypbroE658n4ea",
"created": 1658849854,
"updated": 1658849859,
"active": true,
"permalink": "ABC123",
"name": "Commerce.js lapel pin",
"description": "<p>Simply attach these pins to instantly wear a suit!</p>",
"price": {
"raw": 10,
"formatted": "10.00",
"formatted_with_symbol": "$10.00",
"formatted_with_code": "10.00 USD"
},
"inventory": {
"managed": false,
"available": 0
},
"sku": "CJS-PIN-WTE",
"sort_order": 7,
"seo": {
"title": null,
"description": null
},
"thank_you_url": null,
"meta": null,
"conditionals": {
"is_active": true,
"is_tax_exempt": false,
"is_pay_what_you_want": false,
"is_inventory_managed": false,
"is_sold_out": false,
"has_digital_delivery": false,
"has_physical_delivery": true,
"has_images": false,
"collects_fullname": false,
"collects_shipping_address": false,
"collects_billing_address": false,
"collects_extra_fields": true
},
"is": {
"active": true,
"tax_exempt": false,
"pay_what_you_want": false,
"inventory_managed": false,
"sold_out": false
},
"has": {
"digital_delivery": false,
"physical_delivery": true,
"images": false
},
"collects": {
"fullname": false,
"shipping_address": false,
"billing_address": false,
"extra_fields": true
},
"checkout_url": {
"checkout": "https://checkout.chec.io/ABC123?checkout=true",
"display": "https://checkout.chec.io/ABC123"
},
"categories": [],
"image": null
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 2,
"current_page": 1,
"total_pages": 1,
"links": {}
}
}
}
Request
GET v1/products
Query parameters
Name | Status | Description |
---|---|---|
category_slug |
optional | Filter by a category slug, or array of category slugs. If using an array, all values must apply to the product. |
category_id |
optional | Filter by a category ID, or array of category IDs. If using an array, all values must apply to the product. |
query |
optional | Filter by a term that will be matched against the product's ID (exactly), permalink, and name |
price.above |
optional | Filter by products that have a price higher than this value |
price.below |
optional | Filter by products that have a price lower than this value |
active |
optional | Filter products by their active status (either 1 or 0) |
include |
optional | Include additional fields within the product objects. Valid options are |
is.pay_what_you_want |
optional | Filter by products that do or do not have "pay what you want" pricing enabled |
is.inventory_managed |
optional | Filter by products that do or do not have managed inventory |
is.tax_exempt |
optional | Filter by products that are or are not exempt from tax calculation |
attributes.attr_VNplJa1EaYwL60 |
optional | Filter by an attribute. Values may be a string, null, or an array of strings. |
limit |
optional | The maximum number of products that will be returned (default: 20, maximum: 200) |
page |
optional | The page number to return (default: 1) |
sortBy |
optional | The column to sort by. Valid options are |
sortDirection |
optional | The direction to sort in, either |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The product ID |
created |
integer | A unix timestamp when the product was initially created |
updated |
integer | A unix timestamp when the product was last updated |
active |
boolean | Whether this product is "active" |
permalink |
string | The configured "permalink" for this product |
name |
string | The given name for the product |
description |
string | A description for the product |
price |
Price | The base price for the product |
inventory.managed |
boolean | Whether inventory (stock levels) for this product are managed |
inventory.available |
integer | The remaining inventory quantity for the product. If the product has variants, their inventory takes priority |
sku |
string | The configured stock keeping unit (SKU) for the product |
sort_order |
integer | A numeric sort order for products |
seo.title |
string | Meta title for SEO |
seo.description |
string | Meta description for SEO |
thank_you_url |
string | A URL to send your customers to after purchasing this product |
meta |
object | Miscellaneous "meta" data for the product |
conditionals.is_active |
boolean | Whether this product is "active" |
conditionals.is_free |
boolean | Whether this product is free (at it's base price) |
conditionals.is_tax_exempt |
boolean | Whether this product should not have tax applied |
conditionals.is_pay_what_you_want |
boolean | Whether the customer can choose how much to pay for this product |
conditionals.is_inventory_managed |
boolean | Whether inventory for this product is managed (if not, unlimited) |
conditionals.is_sold_out |
boolean | Whether this product "is_inventory_managed" and has no remaining quantity |
conditionals.has_digital_delivery |
boolean | Whether this product has configured digital fulfilment options |
conditionals.has_physical_delivery |
boolean | Whether this product has configured physical fulfilment options |
conditionals.has_images |
boolean | Whether this product has uploaded assets that are images |
conditionals.collects_fullname |
boolean | Whether this product requires a customers full name to complete a sale |
conditionals.collects_shipping_address |
boolean | Whether this product requires the customers shipping address to complete a sale |
conditionals.collects_billing_address |
boolean | Whether this product requires the customers billing address to complete a sale |
conditionals.collects_extra_fields |
boolean | Whether this product has configured extra fields |
conditionals.is.active |
boolean | Whether this product is "active" |
conditionals.is.free |
boolean | Whether this product is free (at it's base price) |
conditionals.is.tax_exempt |
boolean | Whether this product should not have tax applied |
conditionals.is.pay_what_you_want |
boolean | Whether the customer can choose how much to pay for this product |
conditionals.is.inventory_managed |
boolean | Whether inventory for this product is managed (if not, unlimited) |
conditionals.is.sold_out |
boolean | Whether this product "is_inventory_managed" and has no remaining quantity |
conditionals.has.digital_delivery |
boolean | Whether this product has configured digital fulfilment options |
conditionals.has.physical_delivery |
boolean | Whether this product has configured physical fulfilment options |
conditionals.has.images |
boolean | Whether this product has uploaded assets that are images |
conditionals.has.videos |
boolean | Whether this product has uploaded assets that are videos |
conditionals.collects.fullname |
boolean | Whether this product requires a customers full name to complete a sale |
conditionals.collects.shipping_address |
boolean | Whether this product requires the customers shipping address to complete a sale |
conditionals.collects.billing_address |
boolean | Whether this product requires the customers billing address to complete a sale |
conditionals.collects.extra_fields |
boolean | Whether this product has configured extra fields |
checkout_url.checkout |
string | A URL for an embeddable store that sells just this product |
checkout_url.display |
string | A URL for an embeddable store that sells just this product |
categories.*.id |
string | The category ID |
categories.*.slug |
string | A given "slug" for the category. Should be URL safe. |
categories.*.name |
string | A given name for the category |
image.*.id |
string | The asset ID |
image.*.url |
string | The asset URL that you may use to serve the asset |
image.*.description |
string | A description of the asset |
image.*.is_image |
boolean | Whether the asset is an image |
image.*.filename |
string | The original filename that the file was uploaded with |
image.*.file_extension |
string | The file extension for the asset |
image.*.file_size |
integer | The file size in bytes |
image.*.image_dimensions.width |
integer | The width in pixels (if the asset is an image) |
image.*.image_dimensions.height |
integer | The height in pixels (if the asset is an image) |
image.*.meta |
object | A given array or keyed object with metadata |
image.*.created_at |
integer | A unix timestamp when the asset was originally uploaded |
related_products.*.id |
integer | The product ID |
related_products.*.name |
string | The given name for the product |
related_products.*.sku |
string | The configured stock keeping unit (SKU) for the product |
related_products.*.permalink |
string | The configured "permalink" for this product |
related_products.*.description |
string | A description for the product |
related_products.*.price |
Price | The base price for the product |
related_products.*.quantity |
integer | The remaining quantity of the product |
assets.*.id |
string | The asset ID |
assets.*.url |
string | The asset URL that you may use to serve the asset |
assets.*.description |
string | A description of the asset |
assets.*.is_image |
boolean | Whether the asset is an image |
assets.*.filename |
string | The original filename that the file was uploaded with |
assets.*.file_extension |
string | The file extension for the asset |
assets.*.file_size |
integer | The file size in bytes |
assets.*.image_dimensions.width |
integer | The width in pixels (if the asset is an image) |
assets.*.image_dimensions.height |
integer | The height in pixels (if the asset is an image) |
assets.*.meta |
object | A given array or keyed object with metadata |
assets.*.created_at |
integer | A unix timestamp when the asset was originally uploaded |
Get product
Returns a product's details by either its id
or permalink
.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/products/prod_f89398fs489g?type=id" \
--header "X-Authorization: {token}"
// Retrieve a product by it's ID
const productId = 'prod_1ypbroE658n4ea';
Commerce.products.retrieve(productId).then(product => console.log(product));
// Retrieve a product by it's permalink
const productPermalink = 'YfFoyi';
Commerce.products.retrieve(productPermalink, { type: 'permalink' }).then(product => console.log(product));
const url = new URL(
"https://api.chec.io/v1/products/prod_f89398fs489g"
);
const params = {
"type": "id",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/products/prod_f89398fs489g'
params = {
'type': 'id',
}
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()
Example response (200):
{
"id": "prod_1ypbroE658n4ea",
"created": 1658849854,
"updated": 1658849859,
"active": true,
"permalink": "ABC123",
"name": "Commerce.js lapel pin",
"description": "<p>Simply attach these pins to instantly wear a suit!</p>",
"price": {
"raw": 10,
"formatted": "10.00",
"formatted_with_symbol": "$10.00",
"formatted_with_code": "10.00 USD"
},
"inventory": {
"managed": false,
"available": 0
},
"sku": "CJS-PIN-WTE",
"sort_order": 7,
"seo": {
"title": null,
"description": null
},
"thank_you_url": null,
"meta": null,
"conditionals": {
"is_active": true,
"is_tax_exempt": false,
"is_pay_what_you_want": false,
"is_inventory_managed": false,
"is_sold_out": false,
"has_digital_delivery": false,
"has_physical_delivery": true,
"has_images": false,
"collects_fullname": false,
"collects_shipping_address": false,
"collects_billing_address": false,
"collects_extra_fields": true
},
"is": {
"active": true,
"tax_exempt": false,
"pay_what_you_want": false,
"inventory_managed": false,
"sold_out": false
},
"has": {
"digital_delivery": false,
"physical_delivery": true,
"images": false
},
"collects": {
"fullname": false,
"shipping_address": false,
"billing_address": false,
"extra_fields": true
},
"checkout_url": {
"checkout": "https://checkout.chec.io/ABC123?checkout=true",
"display": "https://checkout.chec.io/ABC123"
},
"categories": [],
"image": null
}
Request
GET v1/products/{product_id}
URL parameters
Name | Status | Description |
---|---|---|
product_id |
required | The product ID |
Query parameters
Name | Status | Description |
---|---|---|
type |
optional |
|
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The product ID |
created |
integer | A unix timestamp when the product was initially created |
updated |
integer | A unix timestamp when the product was last updated |
active |
boolean | Whether this product is "active" |
permalink |
string | The configured "permalink" for this product |
name |
string | The given name for the product |
description |
string | A description for the product |
price |
Price | The base price for the product |
inventory.managed |
boolean | Whether inventory (stock levels) for this product are managed |
inventory.available |
integer | The remaining inventory quantity for the product. If the product has variants, their inventory takes priority |
sku |
string | The configured stock keeping unit (SKU) for the product |
sort_order |
integer | A numeric sort order for products |
seo.title |
string | Meta title for SEO |
seo.description |
string | Meta description for SEO |
thank_you_url |
string | A URL to send your customers to after purchasing this product |
meta |
object | Miscellaneous "meta" data for the product |
conditionals.is_active |
boolean | Whether this product is "active" |
conditionals.is_free |
boolean | Whether this product is free (at it's base price) |
conditionals.is_tax_exempt |
boolean | Whether this product should not have tax applied |
conditionals.is_pay_what_you_want |
boolean | Whether the customer can choose how much to pay for this product |
conditionals.is_inventory_managed |
boolean | Whether inventory for this product is managed (if not, unlimited) |
conditionals.is_sold_out |
boolean | Whether this product "is_inventory_managed" and has no remaining quantity |
conditionals.has_digital_delivery |
boolean | Whether this product has configured digital fulfilment options |
conditionals.has_physical_delivery |
boolean | Whether this product has configured physical fulfilment options |
conditionals.has_images |
boolean | Whether this product has uploaded assets that are images |
conditionals.collects_fullname |
boolean | Whether this product requires a customers full name to complete a sale |
conditionals.collects_shipping_address |
boolean | Whether this product requires the customers shipping address to complete a sale |
conditionals.collects_billing_address |
boolean | Whether this product requires the customers billing address to complete a sale |
conditionals.collects_extra_fields |
boolean | Whether this product has configured extra fields |
conditionals.is.active |
boolean | Whether this product is "active" |
conditionals.is.free |
boolean | Whether this product is free (at it's base price) |
conditionals.is.tax_exempt |
boolean | Whether this product should not have tax applied |
conditionals.is.pay_what_you_want |
boolean | Whether the customer can choose how much to pay for this product |
conditionals.is.inventory_managed |
boolean | Whether inventory for this product is managed (if not, unlimited) |
conditionals.is.sold_out |
boolean | Whether this product "is_inventory_managed" and has no remaining quantity |
conditionals.has.digital_delivery |
boolean | Whether this product has configured digital fulfilment options |
conditionals.has.physical_delivery |
boolean | Whether this product has configured physical fulfilment options |
conditionals.has.images |
boolean | Whether this product has uploaded assets that are images |
conditionals.has.videos |
boolean | Whether this product has uploaded assets that are videos |
conditionals.collects.fullname |
boolean | Whether this product requires a customers full name to complete a sale |
conditionals.collects.shipping_address |
boolean | Whether this product requires the customers shipping address to complete a sale |
conditionals.collects.billing_address |
boolean | Whether this product requires the customers billing address to complete a sale |
conditionals.collects.extra_fields |
boolean | Whether this product has configured extra fields |
checkout_url.checkout |
string | A URL for an embeddable store that sells just this product |
checkout_url.display |
string | A URL for an embeddable store that sells just this product |
categories.*.id |
string | The category ID |
categories.*.slug |
string | A given "slug" for the category. Should be URL safe. |
categories.*.name |
string | A given name for the category |
image.*.id |
string | The asset ID |
image.*.url |
string | The asset URL that you may use to serve the asset |
image.*.description |
string | A description of the asset |
image.*.is_image |
boolean | Whether the asset is an image |
image.*.filename |
string | The original filename that the file was uploaded with |
image.*.file_extension |
string | The file extension for the asset |
image.*.file_size |
integer | The file size in bytes |
image.*.image_dimensions.width |
integer | The width in pixels (if the asset is an image) |
image.*.image_dimensions.height |
integer | The height in pixels (if the asset is an image) |
image.*.meta |
object | A given array or keyed object with metadata |
image.*.created_at |
integer | A unix timestamp when the asset was originally uploaded |
related_products.*.id |
integer | The product ID |
related_products.*.name |
string | The given name for the product |
related_products.*.sku |
string | The configured stock keeping unit (SKU) for the product |
related_products.*.permalink |
string | The configured "permalink" for this product |
related_products.*.description |
string | A description for the product |
related_products.*.price |
Price | The base price for the product |
related_products.*.quantity |
integer | The remaining quantity of the product |
assets.*.id |
string | The asset ID |
assets.*.url |
string | The asset URL that you may use to serve the asset |
assets.*.description |
string | A description of the asset |
assets.*.is_image |
boolean | Whether the asset is an image |
assets.*.filename |
string | The original filename that the file was uploaded with |
assets.*.file_extension |
string | The file extension for the asset |
assets.*.file_size |
integer | The file size in bytes |
assets.*.image_dimensions.width |
integer | The width in pixels (if the asset is an image) |
assets.*.image_dimensions.height |
integer | The height in pixels (if the asset is an image) |
assets.*.meta |
object | A given array or keyed object with metadata |
assets.*.created_at |
integer | A unix timestamp when the asset was originally uploaded |
List variants
Returns a list of available variants for the specified product. The list is paginated, however it has a higher default page size (100) compared with other paginated API endpoints.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variants" \
--header "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variants"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variants'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"data": [
{
"id": "vrnt_dKvg9l6vl1bB76",
"sku": "ABC-123-XYZ",
"description": "Small red T-shirt",
"inventory": 75,
"price": {
"raw": 19.95,
"formatted": "19.95",
"formatted_with_symbol": "$19.95",
"formatted_with_code": "19.95 USD"
},
"is_valid": true,
"invalid_reason_code": null,
"meta": null,
"created": 1616526522,
"updated": 1616526522,
"options": {
"vgrp_bWZ3l83Ke5kpEQ": "optn_VPvL5z6O95AQkX",
"vgrp_QG375vPzLwrMOg": "optn_9BAmwJp7E5eXdn"
},
"assets": []
},
{
"id": "vrnt_GNqKE50NwdgBLV",
"sku": "ABC-123-XYZ",
"description": "Small blue T-shirt",
"inventory": 75,
"price": {
"raw": 19.95,
"formatted": "19.95",
"formatted_with_symbol": "$19.95",
"formatted_with_code": "19.95 USD"
},
"is_valid": true,
"invalid_reason_code": null,
"meta": null,
"created": 1616526545,
"updated": 1616526545,
"options": {
"vgrp_bWZ3l83Ke5kpEQ": "optn_nPEVlNK7Lwa7dM",
"vgrp_QG375vPzLwrMOg": "optn_9BAmwJp7E5eXdn"
},
"assets": []
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 100,
"current_page": 1,
"total_pages": 1,
"links": {}
}
}
}
Request
GET v1/products/{product_id}/variants
URL parameters
Name | Status | Description |
---|---|---|
product_id |
required | ID of the product |
Query parameters
Name | Status | Description |
---|---|---|
option_ids.* |
optional | Filter by an array of option IDs, where all options apply to the variant |
is_valid |
optional | Filter variants by their |
Get variant
Returns the specified variant, belonging to the specified product.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variants/1" \
--header "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variants/1"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variants/1'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"id": "vrnt_dKvg9l6vl1bB76",
"sku": "ABC-123-XYZ",
"description": "Small red T-shirt",
"inventory": 75,
"price": {
"raw": 19.95,
"formatted": "19.95",
"formatted_with_symbol": "$19.95",
"formatted_with_code": "19.95 USD"
},
"is_valid": true,
"invalid_reason_code": null,
"meta": null,
"created": 1616526522,
"updated": 1616526522,
"options": {
"vgrp_bWZ3l83Ke5kpEQ": "optn_VPvL5z6O95AQkX",
"vgrp_QG375vPzLwrMOg": "optn_9BAmwJp7E5eXdn"
},
"assets": []
}
Request
GET v1/products/{product_id}/variants/{variant_id}
URL parameters
Name | Status | Description |
---|---|---|
product_id |
required | ID of the product |
List variant groups for product
Returns a list of variant groups that belong to the specified product ID, as well as any variant options that belong to each group.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variant_groups" \
--header "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variant_groups"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variant_groups'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"data": [
{
"id": "vgrp_8XO3wpMPWoYAzQ",
"name": "Size",
"meta": null,
"created": 1616416200,
"updated": 1616416320,
"options": [
{
"id": "optn_RyWOwmnKAonEa2",
"name": "Small",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"assets": [],
"meta": null,
"created": 1616243400,
"updated": 1616243400
},
{
"id": "optn_ypbroEvqP58n4e",
"name": "Medium",
"price": {
"raw": 5,
"formatted": "5.00",
"formatted_with_symbol": "$5.00",
"formatted_with_code": "5.00 USD"
},
"assets": [],
"meta": null,
"created": 1616243400,
"updated": 1616243400
}
]
}
],
"meta": {
"pagination": {
"total": 1,
"count": 1,
"per_page": 20,
"current_page": 1,
"total_pages": 1,
"links": {}
}
}
}
Request
GET v1/products/{product_id}/variant_groups
URL parameters
Name | Status | Description |
---|---|---|
product_id |
required | ID of the product |
Get variant group for product
Returns a variant group by its ID, that belongs to the specified product ID, as well as any variant options that belong to it.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variant_groups/1" \
--header "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variant_groups/1"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variant_groups/1'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"id": "vgrp_8XO3wpMPWoYAzQ",
"name": "Size",
"meta": null,
"created": 1616416200,
"updated": 1616416320,
"options": [
{
"id": "optn_RyWOwmnKAonEa2",
"name": "Small",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"assets": [],
"meta": null,
"created": 1616243400,
"updated": 1616243400
},
{
"id": "optn_ypbroEvqP58n4e",
"name": "Medium",
"price": {
"raw": 5,
"formatted": "5.00",
"formatted_with_symbol": "$5.00",
"formatted_with_code": "5.00 USD"
},
"assets": [],
"meta": null,
"created": 1616243400,
"updated": 1616243400
}
]
}
Request
GET v1/products/{product_id}/variant_groups/{group_id}
URL parameters
Name | Status | Description |
---|---|---|
product_id |
required | ID of the product |
Create product
Create a new product for your merchant, using the provided request data. This endpoint returns the product object (the same as you would get from "Get product"), and links to retrieve related details.
There is a wide range of related product data that you may also provide with your request, such as extra fields, digital and physical shipping options, product variant groups and options, and product meta data.
Request
Extra product data can be added to the product object using the product.meta
attribute while creating
or updating your product.
For example, your meta value might be an object like { season: 'summer' }
, an array of internal IDs, etc.
Example request:
curl --request POST \
"https://api.chec.io/v1/products" \
--header "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/products"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/products'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('POST', url, headers=headers)
response.json()
Example response (201):
{
"id": "prod_sh9r3g98gs",
"urls": {
"product": "/v1/products/prod_sh9r3g98gs"
}
}
Example response (422):
{
"error": {
"type": "unprocessable_entity",
"message": "The given data was invalid.",
"errors": {
"product.price": [
"The product.price must be a number."
],
"product.quantity": [
"The product.quantity must be an integer."
],
"product.permalink": [
"The product.permalink may only contain letters, numbers, and dashes.",
"Provided permalink is already in use."
],
"product.thank_you_url": [
"The product.thank_you_url format is invalid."
],
"variant.0.name": [
"The variant.0.name field must be a string."
],
"variant.0.options.0.price": [
"The variant.0.options.0.price must be a number."
],
"variant.0.options.1.quantity": [
"The variant.0.options.1.quantity must be an integer."
],
"extra_field.1.required": [
"The extra_field.1.required field must be true or false."
],
"delivery.shipping_zones.0.zone_id": [
"The selected delivery.shipping_zones.0.zone_id is invalid."
]
}
},
"status_code": 422
}
Request
POST v1/products
Body parameters
Name | Type | Status | Description |
---|---|---|---|
product.name |
string | required | Product name |
product.sku |
string | optional | A stock keeping unit (SKU) that can be used as a custom unique identifier for your product |
product.price |
number | required | Numeric price value of your product (in your merchant's configured currency) |
product.description |
string | optional | Description of your product |
product.inventory.managed |
boolean | optional | Whether inventory levels should be tracked, or false for unlimited |
product.inventory.available |
integer | optional | Inventory number available |
product.permalink |
string | optional | Permalink for your product. If not provided, one will be auto-generated. |
product.pay_what_you_want |
boolean | optional | If enabled, "Pay What You Want" allows customers to choose their purchase price |
product.tax_exempt |
boolean | optional | If enabled, This product will be tax exempt, and not included in any tax calculations |
product.thank_you_url |
string | optional | URL for the "thank you" page when the product is ordered |
product.category_id |
string | optional | Hash ID of a category to assign this product to. Use |
product.meta |
object | optional | Optional metadata to associate with the product |
product.active |
boolean | optional | Whether the product is considered "active" |
product.sort_order |
number | optional | Desired sort order for the product (low numbers are returned earlier, higher numbers are returned later). Default: 0 |
seo.title |
string | optional | A meta title for SEO |
seo.description |
string | optional | A meta description for SEO |
collect.shipping |
boolean | optional | Whether this product requires shipping information to be collected at checkout |
collect.billing |
boolean | optional | Whether this product requires billing information to be collected at checkout |
collect.fullname |
boolean | optional | Whether this product requires the customer's full name to be collected at checkout |
collect.extra_fields |
boolean | optional | Whether this product has extra fields. If false, existing fields will be deleted |
variant_groups.*.name |
string | optional | Name for a product variant, if configuring one |
variant_groups.*.options.*.description |
string | optional | Description of a variant's option |
variant_groups.*.options.*.price |
number | optional | Price adjustment to apply when this option is selected |
variant_groups.*.options.*.assets.* |
string | optional | A list of asset IDs to associate with the variant option |
extra_field.*.name |
string | optional | An extra field's name |
extra_field.*.required |
boolean | optional | Whether the extra field is required at checkout |
extra_field.*.type |
string | optional | Type for the extra field, one of |
extra_field.*.options.* |
string | optional | If the |
extra_field.*.meta |
object | optional | Optional metadata to attach to the extra field |
delivery.enabled.digital |
boolean | optional | Whether digital delivery is enabled |
delivery.digital.assets.* |
string | optional | Provide a list of asset IDs for this product's digital delivery. These must be valid - see "Assets" for more information. |
delivery.digital.access_window.expires |
boolean | optional | Whether digital delivery expires |
delivery.digital.access_window.duration |
integer | optional | Number of days for digital delivery to be enabled for |
delivery.digital.access_window.period |
integer | optional | The period for the |
delivery.digital.access_window.limit |
string | optional | Maximum number (integer) of times the file can be downloaded, or |
delivery.enabled.shipping_native_v1 |
boolean | optional | Whether physical delivery is enabled |
delivery.shipping_zones.*.zone_id |
integer | optional | ID of the desired shipping zone for your merchant |
delivery.shipping_zones.*.rates.*.base_rate_id |
integer | optional | Base rate ID for your shipping rate |
delivery.shipping_zones.*.rates.*.on_own |
number | optional | Shipping price for when this product is shipped on its own |
delivery.shipping_zones.*.rates.*.with_others |
number | optional | Shipping price for when this product is shipped in combination with other products |
discount.*.id |
string | optional | An associated discount ID to associate and/or update |
discount.*.code |
string | optional | The discount code to use |
discount.*.value |
number | optional | The value of the discount |
discount.*.type |
string | optional |
|
discount.*.quantity |
integer | optional | The number of times the discount may be used, or |
assets.*.id |
string | optional | The asset ID to associate |
assets.*.sort_order |
integer | optional | Desired sort order for each asset |
categories.*.id |
string | optional | A list of category IDs to associate with the product |
related_products.* |
string | optional | A list of related product IDs to associate with the product |
attributes.*.id |
string | optional | If provided along with other attribute data, the specified attribute will be updated |
attributes.*.value |
mixed | optional | Values may be a string, null, or an array of strings depending on the attribute type. |
Set assets for a product
Replaces all associates for a product with those provided in the request. You may provide an empty request body in order to delete all asset associations. Note that the assets themselves will not be removed, only the link to the product.
Example request:
curl --request PUT \
"https://api.chec.io/v1/products/prod_VNplJa1EaYwL60/assets" \
--header "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/products/prod_VNplJa1EaYwL60/assets"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/products/prod_VNplJa1EaYwL60/assets'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('PUT', url, headers=headers)
response.json()
Example response (200):
{
"success": true
}
Request
PUT v1/products/{product_id}/assets
URL parameters
Name | Status | Description |
---|---|---|
product_id |
required | The product ID to associate assets with |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
assets.*.id |
string | optional | The asset ID to associate |
assets.*.sort_order |
integer | optional | Desired sort order for each asset |
Add asset to product
Associates an asset or list of assets to a product. This request will append to the end of the list by default.
You may optionally specify a sort_order
value, which will help to control the order that assets are
returned in when requesting product data.
Example request:
curl --request POST \
"https://api.chec.io/v1/products/prod_VNplJa1EaYwL60/assets" \
--header "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/products/prod_VNplJa1EaYwL60/assets"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/products/prod_VNplJa1EaYwL60/assets'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('POST', url, headers=headers)
response.json()
Example response (200):
{
"success": true
}
Request
POST v1/products/{product_id}/assets
URL parameters
Name | Status | Description |
---|---|---|
product_id |
required | The product ID to associate assets with |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
assets.*.id |
string | required | The asset ID to associate |
assets.*.sort_order |
integer | optional | Desired sort order for each asset |
Update product
This endpoint allows you to update a product's information, including nested relationship data.
Be aware that if you provide some relationship data, the existing relationships will be deleted and the new
data will be appended in its place. If you want to keep some data you can provide a corresponding
id
attribute for the resource that should be retained, in which case it will be updated rather than replaced.
All input attributes for this route are the same as for "Create product", with the following exceptions which are only for this endpoint. Note that if these attributes are provided in your request, they must be valid. Invalid IDs will return 422 validation errors.
The response will be the updated product object.
Example request:
curl --request PUT \
"https://api.chec.io/v1/products/prod_sh9r3g98gs" \
--header "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/products/prod_sh9r3g98gs"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/products/prod_sh9r3g98gs'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('PUT', url, headers=headers)
response.json()
Example response (200):
{
"id": "prod_sh9r3g98gs",
"urls": {
"product": "/v1/products/prod_sh9r3g98gs"
}
}
Example response (422):
{
"error": {
"type": "unprocessable_entity",
"message": "The given data was invalid.",
"errors": {
"product.price": [
"The product.price must be a number."
],
"product.quantity": [
"The product.quantity must be an integer."
],
"product.permalink": [
"The product.permalink may only contain letters, numbers, and dashes.",
"Provided permalink is already in use."
],
"product.thank_you_url": [
"The product.thank_you_url format is invalid."
],
"variant.0.name": [
"The variant.0.name field must be a string."
],
"variant.0.options.0.price": [
"The variant.0.options.0.price must be a number."
],
"variant.0.options.1.quantity": [
"The variant.0.options.1.quantity must be an integer."
],
"extra_field.1.required": [
"The extra_field.1.required field must be true or false."
],
"delivery.shipping_zones.0.zone_id": [
"The selected delivery.shipping_zones.0.zone_id is invalid."
]
}
},
"status_code": 422
}
Request
PUT v1/products/{product_id}
URL parameters
Name | Status | Description |
---|---|---|
product_id |
required | The product ID to update |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
attributes.*.id |
string | optional | If provided along with other attribute data, the specified attribute will be updated |
attributes.*.value |
mixed | optional | Values may be a string, null, or an array of strings depending on the attribute type. |
variant_groups.*.id |
string | optional | If provided along with other variant data, the specified variant will be updated rather than recreated |
variant_groups.*.options.*.id |
string | optional | Variant's option ID to target for update (as above) |
delivery.shipping_zones.*.rates.*.id |
string | optional | Shipping rate ID to target for update (as above) |
Delete product
Removes a product from your merchant account.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/products/prod_sh9r3g98gs" \
--header "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/products/prod_sh9r3g98gs"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/products/prod_sh9r3g98gs'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/products/{product_id}
URL parameters
Name | Status | Description |
---|---|---|
product_id |
required | Product ID |
Remove asset from product
Removes the association of an asset from a product. This will not delete the asset, only the relationship to the product.
If you need to delete all assets at once, you can use PUT /v1/products/prod_123/assets
("Set assets
for a product") with an empty payload.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/products/prod_VNplJa1EaYwL60/assets/ast_VNplJa1EaYwL60" \
--header "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/products/prod_VNplJa1EaYwL60/assets/ast_VNplJa1EaYwL60"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/products/prod_VNplJa1EaYwL60/assets/ast_VNplJa1EaYwL60'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/products/{product_id}/assets/{asset_id}
URL parameters
Name | Status | Description |
---|---|---|
product_id |
required | The product ID to un-associate the asset from |
asset_id |
required | The asset ID to un-associate from the product |
Create variant
Create a new variant, along with options and assets, and assign it to the specified product. This API also
accepts the same payload in a nested variants
array, and will behave as a "create multiple variants" API
for bulk operations.
A variant is a specific variation of your product, which is made up of a number of variant options. For example, if your product was a T-shirt, your variant groups might be "size" and "color", and each of those may have options such as "small", "medium", etc and "red", "blue", etc. You may have a number of variants, for small + red, small + blue, medium + red, medium + blue, etc.
You may only have one variant for each combination of variant options (e.g. only one small + red variant).
When you create a variant, its validity (see is_valid
) will be calculated. A variant will be marked as invalid
if it does not contain all of the necessary variant options, or if it contains the same options as another
variant. If this happens, a invalid_reason_code
will be attached to the response. Reason codes may be one of:
duplicate_option_config
: There are other variants for this product with the same set of variant optionsincomplete_option_config
: This variant does not have all required variant options assigned to it
Example request:
curl --request POST \
"https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variants" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"sku\": \"ABC-123-XYZ\",
\"description\": \"Small red T-shirt\",
\"inventory\": 75,
\"price\": 19.95
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variants"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variants'
payload = {
"sku": "ABC-123-XYZ",
"description": "Small red T-shirt",
"inventory": 75,
"price": 19.95
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (201):
{
"id": "vrnt_dKvg9l6vl1bB76",
"sku": "ABC-123-XYZ",
"description": "Small red T-shirt",
"inventory": 75,
"price": {
"raw": 19.95,
"formatted": "19.95",
"formatted_with_symbol": "$19.95",
"formatted_with_code": "19.95 USD"
},
"is_valid": true,
"invalid_reason_code": null,
"meta": null,
"created": 1616526522,
"updated": 1616526522,
"options": {
"vgrp_bWZ3l83Ke5kpEQ": "optn_VPvL5z6O95AQkX",
"vgrp_QG375vPzLwrMOg": "optn_9BAmwJp7E5eXdn"
},
"assets": []
}
Request
POST v1/products/{product_id}/variants
URL parameters
Name | Status | Description |
---|---|---|
product_id |
required | ID of the product |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
sku |
string | optional | A SKU for this variant |
description |
string | optional | An optional description for this variant |
inventory |
integer | optional | An inventory level for this variant, if applicable. If not provided then the variant will have unlimited inventory |
price |
number | optional | A fixed price for this variant, if applicable. If not provided then the calculated price will be the base product price plus any price adjustments from variant options |
options.* |
string | required | A list of all variant option IDs that make up this variant |
assets.* |
string | optional | An optional list of asset IDs to associate with this particular variant |
meta |
string[] | optional | Optional metadata to store on the variant |
Update multiple variants
Updates multiple variants at once, using the same request structure as "Update variant" nested within a
variants
array in the request arguments.
Example request:
curl --request PUT \
"https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variants" \
--header "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/products/prod_4WJvlK66B5bYV1/variants"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variants'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('PUT', url, headers=headers)
response.json()
Example response (200):
{
"data": [
{
"id": "vrnt_dKvg9l6vl1bB76",
"sku": "ABC-123-XYZ",
"inventory": 75,
"price": {
"raw": 19.95,
"formatted": "19.95",
"formatted_with_symbol": "$19.95",
"formatted_with_code": "19.95 USD"
},
"meta": null,
"description": "Small red T-shirt",
"created": 1616526522,
"updated": 1616526522,
"options": {
"vgrp_bWZ3l83Ke5kpEQ": "optn_VPvL5z6O95AQkX",
"vgrp_QG375vPzLwrMOg": "optn_9BAmwJp7E5eXdn"
},
"assets": []
},
{
"id": "vrnt_GNqKE50NwdgBLV",
"sku": "ABC-123-XYZ",
"inventory": 75,
"price": {
"raw": 19.95,
"formatted": "19.95",
"formatted_with_symbol": "$19.95",
"formatted_with_code": "19.95 USD"
},
"meta": null,
"description": "Small blue T-shirt",
"created": 1616526545,
"updated": 1616526545,
"options": {
"vgrp_bWZ3l83Ke5kpEQ": "optn_nPEVlNK7Lwa7dM",
"vgrp_QG375vPzLwrMOg": "optn_9BAmwJp7E5eXdn"
},
"assets": []
}
]
}
Request
PUT v1/products/{product_id}/variants
URL parameters
Name | Status | Description |
---|---|---|
product_id |
required | ID of the product |
Update variant
Updates an existing variant. See "Update multiple variants" to update more than one at a time.
The request arguments for this API are the same as for "create variant".
Whenever a variant is updated and options are changed, its validity will be recalculated. See "Create variant" for a description of this process, and a list of possible invalid reason codes that may be returned by the API.
Example request:
curl --request PUT \
"https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variants/1" \
--header "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/products/prod_4WJvlK66B5bYV1/variants/1"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variants/1'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('PUT', url, headers=headers)
response.json()
Example response (200):
{
"id": "vrnt_dKvg9l6vl1bB76",
"sku": "ABC-123-XYZ",
"description": "Small red T-shirt",
"inventory": 75,
"price": {
"raw": 19.95,
"formatted": "19.95",
"formatted_with_symbol": "$19.95",
"formatted_with_code": "19.95 USD"
},
"is_valid": true,
"invalid_reason_code": null,
"meta": null,
"created": 1616526522,
"updated": 1616526522,
"options": {
"vgrp_bWZ3l83Ke5kpEQ": "optn_VPvL5z6O95AQkX",
"vgrp_QG375vPzLwrMOg": "optn_9BAmwJp7E5eXdn"
},
"assets": []
}
Request
PUT v1/products/{product_id}/variants/{variant_id}
URL parameters
Name | Status | Description |
---|---|---|
product_id |
required | ID of the product |
Delete variant
Deletes a single variant from the specified product.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variants/vrnt_dKvg9l6vl1bB76" \
--header "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/products/prod_4WJvlK66B5bYV1/variants/vrnt_dKvg9l6vl1bB76"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variants/vrnt_dKvg9l6vl1bB76'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/products/{product_id}/variants/{variant_id}
URL parameters
Name | Status | Description |
---|---|---|
product_id |
required | ID of the product |
variant_id |
required | ID of the variant to delete |
Delete multiple variants
Deletes multiple variants at once from the specified product, by providing an array of variant IDs
in the variants
request parameter.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variants" \
--header "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/products/prod_4WJvlK66B5bYV1/variants"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variants'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/products/{product_id}/variants
URL parameters
Name | Status | Description |
---|---|---|
product_id |
required | ID of the product |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
variants.* |
string | required | List of variant IDs to delete |
Create variant group for product
Creates a new variant group for the specified product ID. A variant group is a way of categorising your product options, for example "Color" or "Size". Within each variant group, you can specify "options" which represent each of the choices a customer may selct from, for example: "red", "blue", "green", or "small", "medium", "large".
When creating a variant group, you must also provide a list of options for it.
Options may have a price adjustment, which will be added to the product's base price, and to any other option prices that are selected, in order to determine the final purchase price for the item in cart. Note that if a specific variant (combination of each of these options) has been defined with a price, then the variant price will take priority over any of the prices defined on these options.
Assets may also be associated with variant options. This can be useful if you want to attach a list of product photos that show your product in a specific color, for example a list of photos of the red option. If providing an asset ID that doesn't already belong to the product, it will also be added to the product's assets list.
Example request:
curl --request POST \
"https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variant_groups" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"name\": \"Size\"
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variant_groups"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variant_groups'
payload = {
"name": "Size"
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (201):
{
"id": "vgrp_8XO3wpMPWoYAzQ",
"name": "Size",
"meta": null,
"created": 1616416200,
"updated": 1616416320,
"options": [
{
"id": "optn_RyWOwmnKAonEa2",
"name": "Small",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"assets": [],
"meta": null,
"created": 1616243400,
"updated": 1616243400
},
{
"id": "optn_ypbroEvqP58n4e",
"name": "Medium",
"price": {
"raw": 5,
"formatted": "5.00",
"formatted_with_symbol": "$5.00",
"formatted_with_code": "5.00 USD"
},
"assets": [],
"meta": null,
"created": 1616243400,
"updated": 1616243400
}
]
}
Request
POST v1/products/{product_id}/variant_groups
URL parameters
Name | Status | Description |
---|---|---|
product_id |
required | ID of the product |
Body parameters
Name | Type | Status | Description |
---|---|---|---|
name |
string | required | Name for the group |
options.*.name |
string | required | Name for each of the group's options |
options.*.price |
number | optional | A price adjustment for this option, e.g. if certain options cost a little more |
options.*.assets.* |
string | optional | Asset IDs to associate with each option, is necessary |
options.*.meta |
string[] | optional | Optional metadata to store on each option |
meta |
string[] | optional | Optional metadata to store on the group |
Update variant group for product
Updates an existing variant group, belonging to the specified product ID. The request arguments for this API are the same as for "Create variant group for product", except no fields are required.
Note that when updating a variant group, if you provide a list of options then they will replace any existing options previously assigned to the group.
Example request:
curl --request PUT \
"https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variant_groups/1" \
--header "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/products/prod_4WJvlK66B5bYV1/variant_groups/1"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variant_groups/1'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('PUT', url, headers=headers)
response.json()
Example response (200):
{
"id": "vgrp_8XO3wpMPWoYAzQ",
"name": "Size",
"meta": null,
"created": 1616416200,
"updated": 1616416320,
"options": [
{
"id": "optn_RyWOwmnKAonEa2",
"name": "Small",
"price": {
"raw": 0,
"formatted": "0.00",
"formatted_with_symbol": "$0.00",
"formatted_with_code": "0.00 USD"
},
"assets": [],
"meta": null,
"created": 1616243400,
"updated": 1616243400
},
{
"id": "optn_ypbroEvqP58n4e",
"name": "Medium",
"price": {
"raw": 5,
"formatted": "5.00",
"formatted_with_symbol": "$5.00",
"formatted_with_code": "5.00 USD"
},
"assets": [],
"meta": null,
"created": 1616243400,
"updated": 1616243400
}
]
}
Request
PUT v1/products/{product_id}/variant_groups/{group_id}
URL parameters
Name | Status | Description |
---|---|---|
product_id |
required | ID of the product |
Delete variant group for product
Deletes a variant group from the specified product ID. This will also delete the options associated with it, and any variants that have those variant options as part of their configuration.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variant_groups/1" \
--header "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/products/prod_4WJvlK66B5bYV1/variant_groups/1"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/products/prod_4WJvlK66B5bYV1/variant_groups/1'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/products/{product_id}/variant_groups/{group_id}
URL parameters
Name | Status | Description |
---|---|---|
product_id |
required | ID of the product |
Tax
Get the tax configuration
Retrieve the current tax configuration settings.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/tax" \
--header "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/tax"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/tax'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"enabled": true,
"prices_include_tax": false,
"eu_vat_moss": true,
"address": {
"street": "301-318 Homer St",
"town_city": "Vancouver",
"county_state": "BC",
"postal_zip_code": "V6B2V2",
"country": "CA"
}
}
Request
GET v1/tax
Response
Response fields
Name | Type | Description |
---|---|---|
enabled |
boolean | Is tax active Example: true |
prices_include_tax |
boolean | Whether prices include tax Example: true |
eu_vat_moss |
boolean | Whether EU Vat Moss is enabled Example: true |
address.street |
string | Tax configuration street Example: 1001 Mariposa St |
address.town_city |
string | Tax configuration city Example: San Francisco |
address.county_state |
string | Tax configuration region Example: California |
address.postal_zip_code |
string | Tax configuration postal/zip code Example: 94107 |
address.country |
string | Tax configuration country Example: US |
Update the tax configuration
Use this to update the tax configuration on your account.
Example request:
curl --request PUT \
"https://api.chec.io/v1/tax" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"enabled\": true,
\"prices_include_tax\": true,
\"eu_vat_moss\": true
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/tax"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/tax'
payload = {
"enabled": true,
"prices_include_tax": true,
"eu_vat_moss": true
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"enabled": true,
"prices_include_tax": false,
"eu_vat_moss": true,
"address": {
"street": "301-318 Homer St",
"town_city": "Vancouver",
"county_state": "BC",
"postal_zip_code": "V6B2V2",
"country": "CA"
}
}
Request
PUT v1/tax
Body parameters
Name | Type | Status | Description |
---|---|---|---|
enabled |
boolean | optional | Is tax active |
prices_include_tax |
boolean | optional | Whether prices include tax |
eu_vat_moss |
boolean | optional | Whether EU Vat Moss is enabled |
address.street |
string | optional | Tax configuration street |
address.town_city |
string | optional | Tax configuration city |
address.county_state |
string | optional | Tax configuration region |
address.postal_zip_code |
string | optional | Tax configuration postal/zip code |
address.country |
string | optional | Tax configuration country |
Response
Response fields
Name | Type | Description |
---|---|---|
enabled |
boolean | Is tax active Example: true |
prices_include_tax |
boolean | Whether prices include tax Example: true |
eu_vat_moss |
boolean | Whether EU Vat Moss is enabled Example: true |
address.street |
string | Tax configuration street Example: 1001 Mariposa St |
address.town_city |
string | Tax configuration city Example: San Francisco |
address.county_state |
string | Tax configuration region Example: California |
address.postal_zip_code |
string | Tax configuration postal/zip code Example: 94107 |
address.country |
string | Tax configuration country Example: US |
List tax zones
Returns a list of all configured tax zones for your account.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/tax/zones" \
--header "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/tax/zones"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/tax/zones'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"data": [
{
"id": "txzn_1ypbroE658n4ea",
"country_code": "US",
"type": "nexus",
"calculate_automatically": true,
"country_standard_rate": "0",
"country_digital_rate": "0",
"meta": null,
"created": 1658849859,
"updated": 1658849859,
"rates": [],
"nexus": [
{
"zipcode": "90621",
"state": "CA",
"town_city": "Buena Park"
},
{
"zipcode": "92804",
"state": "CA",
"town_city": "Anaheim"
},
{
"zipcode": "94110",
"state": "CA",
"town_city": "San Francisco"
},
{
"zipcode": "91505",
"state": "CA",
"town_city": "Burbank"
},
{
"zipcode": "94107",
"state": "CA",
"town_city": "San Francisco"
},
{
"zipcode": "80001",
"state": "CO",
"town_city": "Arvada"
}
]
},
{
"id": "txzn_1ypbroE658n4ea",
"country_code": "US",
"type": "nexus",
"calculate_automatically": true,
"country_standard_rate": "0",
"country_digital_rate": "0",
"meta": null,
"created": 1658849859,
"updated": 1658849859,
"rates": [],
"nexus": [
{
"zipcode": "90621",
"state": "CA",
"town_city": "Buena Park"
},
{
"zipcode": "92804",
"state": "CA",
"town_city": "Anaheim"
},
{
"zipcode": "94110",
"state": "CA",
"town_city": "San Francisco"
},
{
"zipcode": "91505",
"state": "CA",
"town_city": "Burbank"
},
{
"zipcode": "94107",
"state": "CA",
"town_city": "San Francisco"
},
{
"zipcode": "80001",
"state": "CO",
"town_city": "Arvada"
}
]
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 2,
"current_page": 1,
"total_pages": 1,
"links": {}
}
}
}
Request
GET v1/tax/zones
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The tax zone ID |
country_code |
string | The ISO-3166 country code for this zone |
type |
string | One of: "country", "regional", "nexus" |
calculate_automatically |
boolean | Whether rates are calculated automatically, or specified manually |
country_standard_rate |
number | Country level tax rate for standard (physical) items |
country_digital_rate |
number | Country level tax rate for digital items |
meta |
object | Optional metadata attached to this tax zone |
rates.region_code |
string | An ISO-3166 region code for this rate |
rates.standard_rate |
number | Regional tax rate for standard (physical) items |
rates.digital_rate |
number | Regional tax rate for digital items |
rates.calculate |
string | Either "add", "compound", or "override", when referring to the regional rates versus the base country rates |
rates.meta |
object | Optional metadata attached to this regional rate |
nexus.zipcode |
string | The US zip code |
nexus.state |
string | The US state |
nexus.town_city |
string | The name of the US town/city for this Nexus rate |
Get tax zone
Retrieve a specific tax zone by its ID.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/tax/zones/txzn_K1YDR2qy29Qem6" \
--header "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/tax/zones/txzn_K1YDR2qy29Qem6"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/tax/zones/txzn_K1YDR2qy29Qem6'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"id": "txzn_1ypbroE658n4ea",
"country_code": "US",
"type": "nexus",
"calculate_automatically": true,
"country_standard_rate": "0",
"country_digital_rate": "0",
"meta": null,
"created": 1658849859,
"updated": 1658849859,
"rates": [],
"nexus": [
{
"zipcode": "90621",
"state": "CA",
"town_city": "Buena Park"
},
{
"zipcode": "92804",
"state": "CA",
"town_city": "Anaheim"
},
{
"zipcode": "94110",
"state": "CA",
"town_city": "San Francisco"
},
{
"zipcode": "91505",
"state": "CA",
"town_city": "Burbank"
},
{
"zipcode": "94107",
"state": "CA",
"town_city": "San Francisco"
},
{
"zipcode": "80001",
"state": "CO",
"town_city": "Arvada"
}
]
}
Request
GET v1/tax/zones/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | The tax zone ID |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
string | The tax zone ID |
country_code |
string | The ISO-3166 country code for this zone |
type |
string | One of: "country", "regional", "nexus" |
calculate_automatically |
boolean | Whether rates are calculated automatically, or specified manually |
country_standard_rate |
number | Country level tax rate for standard (physical) items |
country_digital_rate |
number | Country level tax rate for digital items |
meta |
object | Optional metadata attached to this tax zone |
rates.region_code |
string | An ISO-3166 region code for this rate |
rates.standard_rate |
number | Regional tax rate for standard (physical) items |
rates.digital_rate |
number | Regional tax rate for digital items |
rates.calculate |
string | Either "add", "compound", or "override", when referring to the regional rates versus the base country rates |
rates.meta |
object | Optional metadata attached to this regional rate |
nexus.zipcode |
string | The US zip code |
nexus.state |
string | The US state |
nexus.town_city |
string | The name of the US town/city for this Nexus rate |
Create tax zone
Create a new tax zone. If using Canada (CA) or the United States of America (US), you can provide rates
for
regional tax rates. For the US only, you can also set calculate_automatically
to true, and provide nexus
for US Nexus tax rates. All other countries support only country-level tax at this time.
Example request:
curl --request POST \
"https://api.chec.io/v1/tax/zones" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"country_code\": \"US\",
\"calculate_automatically\": false,
\"country_standard_rate\": 12.5,
\"country_digital_rate\": 5
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/tax/zones"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/tax/zones'
payload = {
"country_code": "US",
"calculate_automatically": false,
"country_standard_rate": 12.5,
"country_digital_rate": 5
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (201):
{
"id": "txzn_GNqKE50415dgBL",
"country_code": "US",
"type": "regional",
"calculate_automatically": false,
"country_standard_rate": 10,
"country_digital_rate": 5,
"meta": null,
"created": 1626821313,
"updated": 1626821313,
"rates": [
{
"region_code": "CA",
"standard_rate": 1,
"digital_rate": 0,
"calculate": "add",
"meta": null
}
]
}
Request
POST v1/tax/zones
Body parameters
Name | Type | Status | Description |
---|---|---|---|
country_code |
string | required | An ISO-3166 country code for this zone |
calculate_automatically |
boolean | optional | USA only: set to true to enable Nexus tax |
country_standard_rate |
number | optional | Country level tax rate percentage for standard (physical) items (default: 0) |
country_digital_rate |
number | optional | Country level tax rate percentage for digital items (default: 0) |
meta |
object | optional | Optional metadata to store on the tax zone |
rates.*.region_code |
string | optional | For the US and Canada, specify an ISO-3166 region code for regional tax rates |
rates.*.standard_rate |
number | optional | For the US and Canada, a regional tax rate for standard (physical) items (default: 0) |
rates.*.digital_rate |
number | optional | For the US and Canada, a regional tax rate for digital items (default: 0) |
rates.*.calcualte |
string | optional | Either "add", "compound", or "override", when referring to regional rates versus the base country rates |
rates.*.meta |
object | optional | Optional metadata attached to this regional rate |
nexus.*.zipcode |
string | optional | For the US when Nexus is enabled, provide the Nexus postal ZIP code |
nexus.*.state |
string | optional | For the US when Nexus is enabled, provide the town/city name |
Update tax zone
Update an existing tax zone. When you provide rates or Nexus states, you must provide a full list of your desired settings each time. Regional rates will only be saved against tax zones for Canada or the United States of America. Nexus rates will only be saved against the United States of America, and only when "calculate automatically" is enabled.
The request arguments for this API are the same as for the "create tax zone" API. Please refer there for more information.
Example request:
curl --request PUT \
"https://api.chec.io/v1/tax/zones/txzn_K1YDR2qy29Qem6" \
--header "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/tax/zones/txzn_K1YDR2qy29Qem6"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/tax/zones/txzn_K1YDR2qy29Qem6'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('PUT', url, headers=headers)
response.json()
Example response (200):
{
"id": "txzn_GNqKE50415dgBL",
"country_code": "US",
"type": "regional",
"calculate_automatically": false,
"country_standard_rate": 10,
"country_digital_rate": 5,
"meta": null,
"created": 1626821313,
"updated": 1626822654,
"rates": [
{
"region_code": "CA",
"standard_rate": 12,
"digital_rate": 7.5,
"calculate": "override",
"meta": null
}
]
}
Request
PUT v1/tax/zones/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | The tax zone ID |
Delete tax zone
Delete a tax zone by its ID. All associated rates and Nexus configuration will also be deleted.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/tax/zones/txzn_K1YDR2qy29Qem6" \
--header "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/tax/zones/txzn_K1YDR2qy29Qem6"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/tax/zones/txzn_K1YDR2qy29Qem6'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/tax/zones/{id}
URL parameters
Name | Status | Description |
---|---|---|
id |
required | The tax zone ID |
Webhooks
List event names
Gets the list of available webhook event names. Webhooks may subscribe to one or more of these events.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/webhooks/events" \
--header "X-Authorization: {token}"
// Commerce.js does not currently support this endpoint. Follow progress at https://github.com/chec/commerce.js
const url = new URL(
"https://api.chec.io/v1/webhooks/events"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/webhooks/events'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"data": [
"api-keys.create",
"api-keys.delete",
"api-keys.regenerate",
"api-keys.update",
"assets.create",
"assets.delete",
"assets.update",
"attributes.create",
"attributes.delete",
"attributes.update",
"categories.create",
"categories.delete",
"categories.update",
"channels.create",
"channels.delete",
"channels.update",
"customers.create",
"customers.delete",
"customers.login.token",
"customers.notes.create",
"customers.notes.delete",
"customers.notes.update",
"developer.logs.delete",
"discounts.create",
"discounts.delete",
"discounts.update",
"extra-fields.create",
"extra-fields.delete",
"extra-fields.update",
"gateways.create",
"gateways.delete",
"gateways.update",
"giftcards.create",
"giftcards.redeem",
"integrations.create",
"integrations.delete",
"integrations.update",
"orders.create",
"orders.notes.create",
"orders.notes.delete",
"orders.notes.update",
"orders.physical.shipment",
"orders.refund",
"orders.update",
"products.assets.create",
"products.assets.delete",
"products.assets.update",
"products.create",
"products.delete",
"products.update",
"rays.create",
"rays.delete",
"rays.deploy",
"rays.unpublish",
"rays.update",
"tax-zone.create",
"tax-zone.delete",
"tax-zone.update",
"variants.bulkDelete",
"variants.bulkUpdate",
"variants.create",
"variants.delete",
"variants.groups.create",
"variants.groups.delete",
"variants.groups.update",
"variants.options.assets.create",
"variants.options.assets.delete",
"variants.options.assets.update",
"variants.update"
]
}
Request
GET v1/webhooks/events
Response
Response fields
Name | Type | Description |
---|---|---|
data |
string[] | An array of all events available to subscribe to (strings) |
Get signing key
Returns the key used for signing webhook request payloads.
This key is used to calculate a SHA256 hash of the outgoing webhook payloads, which is then added as
the signature
field before sending. Clients should take care to recalculate the payload's signature
on their end, and verify that it matches that sent in the request payload. At the same time, clients
should also validate the age of the payload by comparing the current timestamp against the created
value in the payload.
If you are using JavaScript, we have an NPM package to help with verifying webhook signatures here:
@chec/webhook-verifier
.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/webhooks/signing_key" \
--header "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/webhooks/signing_key"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/webhooks/signing_key'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"data": {
"signing_key": "AnBXnza1DbWssN7BR0QhhM9c6a9YdtwL"
}
}
Request
GET v1/webhooks/signing_key
Response
Response fields
Name | Type | Description |
---|---|---|
signing_key |
string | The key used for signing webhook request payloads on your merchant account |
Regenerate signing key
Generates a new signing key for webhook request payloads. Note that regenerating your signing key will require you to update your callback's signature verification for all registered webhooks.
Example request:
curl --request PUT \
"https://api.chec.io/v1/webhooks/signing_key" \
--header "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/webhooks/signing_key"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/webhooks/signing_key'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('PUT', url, headers=headers)
response.json()
Example response (201):
{
"data": {
"signing_key": "AnBXnza1DbWssN7BR0QhhM9c6a9YdtwL"
}
}
Request
PUT v1/webhooks/signing_key
Response
Response fields
Name | Type | Description |
---|---|---|
signing_key |
string | The key used for signing webhook request payloads on your merchant account |
List webhook message history
Returns the full message history for all webhooks under your merchant account. Note that there will be a maximum of 30 messages retained per webhook.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/webhooks/history" \
--header "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/webhooks/history"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/webhooks/history'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"data": [
{
"webhook_id": "wbhk_VNplJa1EaYwL60",
"event": "products.create",
"url": "http://example.com/webhook1",
"response_code": 500,
"created": 1583143200
},
{
"webhook_id": "wbhk_VNplJa1EaYwL60",
"event": "products.create",
"url": "http://example.com/webhook1",
"response_code": 200,
"created": 1583142300
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 15,
"current_page": 1,
"total_pages": 1,
"links": {}
}
}
}
Request
GET v1/webhooks/history
Query parameters
Name | Status | Description |
---|---|---|
limit |
optional | The number of items to return per page (default: 15) |
page |
optional | The page number to return |
Response
Response fields
Name | Type | Description |
---|---|---|
webhook_id |
string | The webhook ID |
event |
string | The event that triggered the webhook |
url |
string | The URL the webhook sent a POST request to with the payload |
response_code |
integer | The response code that the webhook received |
response_body |
string | The first 500 characters of the response body from the webhook callback |
created |
integer | A unix timestamp for when the webhook executed |
Clear webhook message history
Clears the message history for a specified webhook ID. Note that these are automatically cleared according to your plan limit, the default is to retain the most recent 30 messages.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/webhooks/wbhk_VNplJa1EaYwL60/history" \
--header "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/webhooks/wbhk_VNplJa1EaYwL60/history"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/webhooks/wbhk_VNplJa1EaYwL60/history'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/webhooks/{webhook_id}/history
URL parameters
Name | Status | Description |
---|---|---|
webhook_id |
required | The webhook ID to delete |
List webhooks
Lists all webhooks for the current merchant.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/webhooks" \
--header "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/webhooks"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/webhooks'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"data": [
{
"id": "wbhk_gNXELwjdp53A4p",
"merchant_id": 123,
"url": "https://example.com/my_callback",
"subscribed_events": [
"products.create",
"orders.create",
"orders.refund"
],
"active": true,
"created": 1583784168,
"updated": 1583785201
}
]
}
Request
GET v1/webhooks
Response
Response fields
Name | Type | Description |
---|---|---|
id |
integer | The webhook ID |
merchant_id |
integer | The merchant ID that this webhook belongs to |
url |
string | The URL the webhook will call when a subscribed event happens |
subscribed_events |
string[] | An array of subscribed events (strings) |
active |
boolean | Whether the webhook is active or not |
created |
integer | A unix timestamp for when the webhook was initially created |
updated |
integer | A unix timestamp for when the webhook was last updated |
Get webhook
Retrieves a webhook by its ID, including up to the last 30 delivery history records. The output of this request will also include the message history that is detailed at 'List webhook message history`.
Example request:
curl --request GET \
--get "https://api.chec.io/v1/webhooks/wbhk_B7ZQobNDa4AgNn" \
--header "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/webhooks/wbhk_B7ZQobNDa4AgNn"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/webhooks/wbhk_B7ZQobNDa4AgNn'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"id": "wbhk_gNXELwjdp53A4p",
"merchant_id": 123,
"url": "https://example.com/my_callback",
"subscribed_events": [
"products.create",
"orders.create",
"orders.refund"
],
"active": true,
"created": 1583784168,
"updated": 1583785201,
"history": {
"data": [
{
"event": "test.webhook",
"url": "http://example.com/my_callback",
"response_code": 500,
"created": 1583785000
},
{
"event": "products.create",
"url": "http://example.com/my_callback",
"response_code": 200,
"created": 1583784000
}
]
}
}
Request
GET v1/webhooks/{webhook_id}
URL parameters
Name | Status | Description |
---|---|---|
webhook_id |
required | The webhook ID to retrieve |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
integer | The webhook ID |
merchant_id |
integer | The merchant ID that this webhook belongs to |
url |
string | The URL the webhook will call when a subscribed event happens |
subscribed_events |
string[] | An array of subscribed events (strings) |
active |
boolean | Whether the webhook is active or not |
created |
integer | A unix timestamp for when the webhook was initially created |
updated |
integer | A unix timestamp for when the webhook was last updated |
Create new webhook
Creates a new webhook for the current merchant. Webhook callback URLs will receive a Webhook object as well as the response from our API when the event occurred.
Example request:
curl --request POST \
"https://api.chec.io/v1/webhooks" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"url\": \"https:\\/\\/example.com\\/callback\",
\"active\": true
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/webhooks"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/webhooks'
payload = {
"url": "https:\/\/example.com\/callback",
"active": true
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (201):
{
"id": "wbhk_gNXELwjdp53A4p",
"merchant_id": 123,
"url": "https://example.com/my_callback",
"subscribed_events": [
"products.create",
"orders.create",
"orders.refund"
],
"active": true,
"created": 1583784168,
"updated": 1583785201
}
Request
POST v1/webhooks
Body parameters
Name | Type | Status | Description |
---|---|---|---|
url |
string | required | Your callback URL for the webhook to be sent to |
subscribed_events.* |
string | optional | A list of events to subscribe to. See "List event names" for possible values. |
active |
boolean | optional | Whether the webhook should be active or not |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
integer | The webhook ID |
merchant_id |
integer | The merchant ID that this webhook belongs to |
url |
string | The URL the webhook will call when a subscribed event happens |
subscribed_events |
string[] | An array of subscribed events (strings) |
active |
boolean | Whether the webhook is active or not |
created |
integer | A unix timestamp for when the webhook was initially created |
updated |
integer | A unix timestamp for when the webhook was last updated |
Update webhook
Update an existing webhook. This method takes the same arguments as "Create new webhook".
Example request:
curl --request PUT \
"https://api.chec.io/v1/webhooks/{webhook_id}" \
--header "X-Authorization: {token}" \
--header "Content-Type: application/json" \
--data "{
\"url\": \"https:\\/\\/example.com\\/callback\",
\"active\": true
}"
// Commerce.js currently only supports public key endpoints (for usage in a browser)
const url = new URL(
"https://api.chec.io/v1/webhooks/{webhook_id}"
);
const headers = {
"X-Authorization": "{token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PUT",
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/webhooks/{webhook_id}'
payload = {
"url": "https:\/\/example.com\/callback",
"active": true
}
headers = {
'X-Authorization': '{token}',
'Content-Type': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"id": "wbhk_gNXELwjdp53A4p",
"merchant_id": 123,
"url": "https://example.com/my_callback",
"subscribed_events": [
"products.create",
"orders.create",
"orders.refund"
],
"active": true,
"created": 1583784168,
"updated": 1583785201
}
Request
PUT v1/webhooks/{webhook_id}
Body parameters
Name | Type | Status | Description |
---|---|---|---|
url |
string | required | Your callback URL for the webhook to be sent to |
subscribed_events.* |
string | optional | A list of events to subscribe to. See "List event names" for possible values. |
active |
boolean | optional | Whether the webhook should be active or not. |
Response
Response fields
Name | Type | Description |
---|---|---|
id |
integer | The webhook ID |
merchant_id |
integer | The merchant ID that this webhook belongs to |
url |
string | The URL the webhook will call when a subscribed event happens |
subscribed_events |
string[] | An array of subscribed events (strings) |
active |
boolean | Whether the webhook is active or not |
created |
integer | A unix timestamp for when the webhook was initially created |
updated |
integer | A unix timestamp for when the webhook was last updated |
Send test request
Sends a test webhook request payload to the provided webhook ID's URL. Note that this sends a fabricated payload, whereas real webhooks would send the controller responses that triggered them in their payload.
When you have configured a webhook to listen to an event, the full response from the API endpoint that
triggers the event will be included in the payload property when the webhook is dispatched to the
webhook's URL. For example, if you're using the orders.create
event, the webhook event will be triggered
when an order is captured.
Response
If the webhook is successfully configured and an event is triggered, the API's HTTP response code will be included
along with the payload
property and other webhook properties.
Example request:
curl --request POST \
"https://api.chec.io/v1/webhooks/wbhk_VNplJa1EaYwL60/test" \
--header "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/webhooks/wbhk_VNplJa1EaYwL60/test"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/webhooks/wbhk_VNplJa1EaYwL60/test'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('POST', url, headers=headers)
response.json()
Example response (201):
{
"webhook_id": "wbhk_VNplJa1EaYwL60",
"event": "products.create",
"url": "http://example.com/webhook1",
"response_code": 500,
"created": 1583143200
}
Request
POST v1/webhooks/{webhook_id}/test
URL parameters
Name | Status | Description |
---|---|---|
webhook_id |
required | The webhook ID to fire a test request for |
Delete webhook
Deletes a webhook. All associated webhook delivery history will also be cleared.
Example request:
curl --request DELETE \
"https://api.chec.io/v1/webhooks/wbhk_VNplJa1EaYwL60" \
--header "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/webhooks/wbhk_VNplJa1EaYwL60"
);
const headers = {
"X-Authorization": "{token}",
"Accept": "application/json",
"Content-Type": "application/json",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json());
import requests
import json
url = 'https://api.chec.io/v1/webhooks/wbhk_VNplJa1EaYwL60'
headers = {
'X-Authorization': '{token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
Example response (204):
{}
Request
DELETE v1/webhooks/{webhook_id}
URL parameters
Name | Status | Description |
---|---|---|
webhook_id |
required | The webhook ID to delete |