NAV
curl Javascript PHP Ruby

Introduction

API LibrariesCurrently we have Javascript & PHP sdks available

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

Welcome to Commerce.js V1

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

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

All of our API’s are designed to work either alone or with each other. Our API’s are organized around REST and are designed to have predictable, resource-oriented URLs that use HTTP response codes to indicate API errors.

Our Commerce.js javascript SDK is designed to work along side our server-side SDKs, making the API limited to calls only we allow it to make due to security reasons. 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"
var myStore = new Commerce('pk_test_c57a31c6163575e6eebbe4ae4f33d8435d962f4f');
Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');
Commerce.Auth('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 (& 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

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.

HTTP status code summary

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

Cart

The cart object

Example


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


Create a cart

Request

$ curl https://api.chec.io/v1/carts \
    -H "X-Authorization: {key}"
//New Cart
Commerce.Cart.init(function(resp){

});
Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Cart::create();
Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Cart.create()

Example Response


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

Response

If successful, this will return the cart object.

Initate an existing cart session (JS SDK)

This will reinstate an existing cart session using the cart id you have provided, if the cart no longer exists it will automatically generate a fresh cart & session.

Request

# Only available with the Commerce.js javascript SDK.
# Only available with the Commerce.js javascript SDK.
# Only available with the Commerce.js javascript SDK.
Commerce.Cart.init('{cart_id}', function(resp){
});

Example Response


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

Request

Response

If successful, this will return the cart object.

Refresh cart (JS SDK)

This will create a new cart & cart session

Request

# Only available with the Commerce.js javascript SDK.
# Only available with the Commerce.js javascript SDK.

# Only available with the Commerce.js javascript SDK.

Commerce.Cart.refresh(function(resp){

},
function(error){


});

Example Response


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

Response

If successful, this will return the cart object.

Get cart id (JS SDK)

This will get the id of the cart being used in the active session

Request

# Only available with the Commerce.js javascript SDK.
Commerce.Cart.id(function(cart_id){

});
# Only available with the Commerce.js javascript SDK.
# Only available with the Commerce.js javascript SDK

Example Response

cart_24wGN8d23eN412P1

Response

This will return the cart id as a string

Retrieve cart

Request

$ curl https://api.chec.io/v1/carts/{cart_id} \
    -H "X-Authorization: {key}"
//Will use cart id in current session
Commerce.Cart.retrieve(function(resp){

  });

Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Cart::retrieve('{cart_id}');
Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Cart.retrieve('{cart_id}')

Example Response

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

Request

Response

If successful, this will return the cart object.

Get cart contents

Request

$ curl https://api.chec.io/v1/carts/{cart_id}/items

Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Cart::contents('{cart_id}');

Commerce.Cart.contents(function(resp) {

});
Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Cart.contents('{cart_id}')

Example Response

[
  {
    "id": "item_7RyWOwmK5nEa2V",
    "product_id": "prod_R4OANwRqklvYL8",
    "name": "Cart Debug w/ Digital",
    "quantity": 1,
    "price": {
      "raw": 1,
      "formatted": "1.00",
      "formatted_with_symbol": "$1.00",
      "formatted_with_code": "1.00 USD"
    },
    "line_total": {
      "raw": 1,
      "formatted": "1.00",
      "formatted_with_symbol": "$1.00",
      "formatted_with_code": "1.00 USD"
    },
    "variants": []
  }
]

Request

Response

Add item to cart

Request

$ curl https://api.chec.io/v1/carts/{cart_id} \
    -H "X-Authorization: {key}" \
    -d id="{product_id}" \
    -d quantity="5" \
    -d variant[{variant_id}]="{option_id}" \

Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Cart::add('{cart_id}', ['id' => '{product_id}',
                                 'quantity' => 1,
                                 'variant' => [
                                              '{variant_id}' => '{option_d}'
                                              ]
                                 ]);

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Cart.add('{cart_id}' {:id => '{product_id}',
                               :quantity' => 1,
                               :variant' => {
                                              :{variant_id} => '{option_d}'
                                            }
                                 })
Commerce.Cart.add({
    'id': "{product_id}",
    'quantity': 5,
    "variant": {
        "{variant_id}": "{option_id}"
    }
}, function(resp) {

});

Example Response

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

Request

Response

Update item in cart

Request

$ curl -X PUT https://api.chec.io/v1/carts/{cart_id}/items/{line_item_id} \
    -H "X-Authorization: {key}" \
    -d quantity="10"

Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Cart::update('{cart_id}',  '{line_item_id}', [ 'quantity' => 10,
                                                        'variant' => [
                                                          '{variant_id}' => '{option_d}'
                                                          ]
                                                      ]);

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Cart.update('{cart_id}', '{line_item_id}', {:quantity' => 1,
                                                    :variant' => {
                                                      :{variant_id} => '{option_d}'
                                                      }
                                                    })
Commerce.Cart.update('{line_item_id}', { "quantity": 5,
                                        "variant": {
                                            "{variant_id}": "{option_id}"
                                        }
                                      },
                                      function(resp){ });

Example Response

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

Request

Response

Remove item from cart

Request

$ curl -X DELETE https://api.chec.io/v1/carts/{cart_id}/items/{line_item_id} \
    -H "X-Authorization: {key}"


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Cart::remove('{cart_id}', '{line_item_id}');

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Cart.remove('{cart_id}', '{line_item_id}')
Commerce.Cart.remove('{line_item_id}', function(resp){

  });

Example Response

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

Request

Response

Empty cart

Request

$ curl -X DELETE https://api.chec.io/v1/carts/{cart_id}/items \
    -H "X-Authorization: {key}"


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Cart::reset('{cart_id}');

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Cart.reset('{cart_id}')
Commerce.Cart.empty(function(resp){

  });

Example Response

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

Request

Response

Delete cart

Request

$ curl -X DELETE https://api.chec.io/v1/carts/{cart_id} \
    -H "X-Authorization: {key}"

Commerce.Cart.delete('{cart_id}', function(resp){

  });

Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Cart::delete('{cart_id}');

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Cart.delete('{cart_id}')

Example Response

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

Request

Response

Checkout

The checkout token object

Example

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

The receipt object

Example


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

Generate token

Request


$ curl https://api.chec.io/v1/checkouts/{identifier}?type={identifier_type} \
    -H "X-Authorization: {key}"

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Checkout.generate_token('{identifier}',  {:type => '{identifier_type}'})
Commerce.Checkout.generateToken('{identifier}', { type: '{identifier_type}' }, function(resp){

  //Render Checkout

  },

  function(error){

  //Error handler

  }

);


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Checkout::generateToken('{identifier}',  ['type' => '{identifier_type}']);

Example Response


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

Request

To generate a checkout token you need to provide an id for either the product or cart, or the product’s permalink.

Response

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

Capture order

Request


$ curl https://api.chec.io/v1/checkouts/{checkout_token_id} \
    -H "X-Authorization: {key}" \
    -d line_items[item_7RyWOwmK5nEa2V][quantity]="1" \
    -d line_items[item_7RyWOwmK5nEa2V][variants][vrnt_p6dP5g0M4ln7kA]="optn_jVKXmwD47wrgDA" \
    -d line_items[item_7RyWOwmK5nEa2V][variants][vrnt_G6kVw73vaw2eDx]="optn_DeN1ql93doz3ym" \
    -d discount_code="20off" \
    -d extrafields[extr_Kvg9l6zvnl1bB7]="415-111-2222" \
    -d extrafields[extr_bWZ3l8zLNokpEQ]="google.com" \
    -d customer[firstname]="John" \
    -d customer[lastname]="Doe" \
    -d customer[email]="buyer@email.com" \
    -d shipping[name]="John Doe" \
    -d shipping[country]="US" \
    -d shipping[street]="123 Fake St" \
    -d shipping[town_city]="San Francisco" \
    -d shipping[county_state]="CA" \
    -d shipping[postal_zip_code]="94107" \
    -d fulfillment[shipping_method]="ship_7RyWOwmK5nEa2V" \
    -d billing[name]="John Doe" \
    -d billing[country]="US" \
    -d billing[street]="1123 Fake ST" \
    -d billing[town_city]="San Francisco" \
    -d billing[county_state]="CA" \
    -d billing[postal_zip_code]="94107" \
    -d payment[gateway]="stripe" \
    -d payment[card][number]="4242 4242 4242 4242" \
    -d payment[card][expires]="11 / 19" \
    -d payment[card][cvc]="123" \
    -d payment[card][postal_zip_code]="94107" \
    -d payment[card][token]="tok_18p356Jf7a6prG89YGcm7cpZ" \
    -d pay_what_you_want="150"


Commerce.Checkout.capture('{checkout_token_id}',
    {
        "line_items": {
            "item_7RyWOwmK5nEa2V": {
                "quantity": "1",
                "variants": {
                    "vrnt_p6dP5g0M4ln7kA": "optn_jVKXmwD47wrgDA",
                    "vrnt_G6kVw73vaw2eDx": "optn_DeN1ql93doz3ym"
                }
            }
        },
        "discount_code": "20off",
        "extrafields": {
            "extr_Kvg9l6zvnl1bB7": "415-111-2222",
            "extr_bWZ3l8zLNokpEQ": "google.com"
        },
        "customer": {
            "firstname": "John",
            "lastname": "Doe",
            "email": "buyer@email.com"
        },
        "shipping": {
            "name": "John Doe",
            "country": "US",
            "street": "123 Fake St",
            "town_city": "San Francisco",
            "county_state": "CA",
            "postal_zip_code": "94103"
        },
        "fulfillment": {
            "shipping_method": "ship_7RyWOwmK5nEa2V"
        },
        "billing": {
            "name": "John Doe",
            "country": "US",
            "street": "123 Fake St",
            "town_city": "San Francisco",
            "county_state": "CA",
            "postal_zip_code": "94103"
        },
        "payment": {
            "gateway": "stripe",
            "card": {
                "token": "tok_18p356Jf7a6prG89YGcm7cpZ"
            }
        },
        "pay_what_you_want": "100"
    }

    ,
    function(resp) {

        //Successful

    },

    function(error) {

        //Error handler

    }

);
Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Checkout.capture('{checkout_token_id}', {
  :line_items => {
    :item_7RyWOwmK5nEa2V => {
      :quantity => "1",
      :variants => {
        :vrnt_p6dP5g0M4ln7kA => "optn_jVKXmwD47wrgDA",
        :vrnt_G6kVw73vaw2eDx => "optn_DeN1ql93doz3ym"
      }
    }
  },
  :discount_code => "20off",
  :extrafields => {
    :extr_Kvg9l6zvnl1bB7 => "415-111-2222",
    :extr_bWZ3l8zLNokpEQ => "google.com"
  },
  :customer => {
    :firstname => "John",
    :lastname => "Doe",
    :email => "buyer@email.com"
  },
  :shipping => {
    :name => "John Doe",
    :country => "US",
    :street => "123 Fake St",
    :town_city => "San Francisco",
    :county_state => "CA",
    :postal_zip_code => "94103"
  },
  :fulfillment => {
    :shipping_method => "ship_7RyWOwmK5nEa2V"
  },
  :billing => {
    :name => "John Doe",
    :country => "US",
    :street => "123 Fake St",
    :town_city => "San Francisco",
    :county_state => "CA",
    :postal_zip_code => "94103"
  },
  :payment => {
    :gateway => "stripe",
    :card => {
      :token => "tok_18p356Jf7a6prG89YGcm7cpZ"
    }
  },
  :pay_what_you_want => "100"
})


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

  $order = ['line_items' =>
              [
                'item_7RyWOwmK5nEa2V' =>
                [
                  'quantity' => '1',
                  'variants' =>
                  [
                    'vrnt_p6dP5g0M4ln7kA' => 'optn_jVKXmwD47wrgDA',
                    'vrnt_G6kVw73vaw2eDx' => 'optn_DeN1ql93doz3ym',
                  ],
                ],
              ],
              'discount_code' => '20off',
              'extrafields' =>
              [
                'extr_Kvg9l6zvnl1bB7' => '415-111-2222',
                'extr_bWZ3l8zLNokpEQ' => 'google.com',
              ],
              'customer' =>
              [
                'firstname' => 'John',
                'lastname' => 'Doe',
                'email' => 'buyer@email.com',
              ],
              'shipping' =>
              [
                'name' => 'John Doe',
                'country' => 'US',
                'street' => '123 Fake St',
                'town_city' => 'San Francisco',
                'county_state' => 'CA',
                'postal_zip_code' => '94103',
              ],
              'fulfillment' =>
              [
                'shipping_method' => 'ship_7RyWOwmK5nEa2V',
              ],
              'billing' =>
              [
                'name' => 'John Doe',
                'country' => 'US',
                'street' => '123 Fake St',
                'town_city' => 'San Francisco',
                'county_state' => 'CA',
                'postal_zip_code' => '94103',
              ],
              'payment' =>
              [
                'gateway' => 'stripe',
                'card' =>
                [
                  'token' => 'tok_18p356Jf7a6prG89YGcm7cpZ',
                ],
              ],
              'pay_what_you_want' => '100',
            ];

Commerce\Checkout::capture('{checkout_token_id}', $order);

Example Response (Card)


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

Example Response (PayPal)

{
  "payment_redirect": true,
  "gateway": "paypal",
  "paykey": "AP-6XA29657R63538148",
  "redirect_url": "https://www.paypal.com/webscr?cmd=_ap-payment&paykey=AP-6XA29657R63538148"
}

Request

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

Response (Card Gateway)

If successful, this will return the receipt object.

Response (PayPal)

If you are using PayPal, this will return an object containing the redirect details & PayKey.

Checkout Helpers

The live object

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

Example


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

Get client-side validation rules

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

Examples:

Request


$ curl https://api.chec.io/v1/checkouts/{checkout_token_id}/helper/validation \
    -H "X-Authorization: {key}"


Commerce.Checkout.helperValidation('{checkout_token_id}', function(resp){
  //Success
},
function(error){
  //Error handler
 }
);


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Checkout::helperValidation('{checkout_token_id}');

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Checkout.helper_validatoion('{checkout_token_id}')

Request

Example Response


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

Response

Get buyers location from IP

Request (Auto detect IP)


$ curl https://api.chec.io/v1/checkouts/{checkout_token_id}/helper/location_from_ip \
    -H "X-Authorization: {key}"


Commerce.Checkout.getLocationFromIP('{checkout_token_id}', function(resp){
  //Success
},
function(error){
  //Error handler
 }
);


#Do not use this endpoint with our PHP SDK, as it will return your server IP not your customers.

#Do not use this endpoint with our Ruby SDK, as it will return your server IP not your customers.

Request


$ curl https://api.chec.io/v1/checkouts/{checkout_token_id}/helper/location_from_ip?ip_address={ip_address} \
    -H "X-Authorization: {key}"


Commerce.Checkout.getLocationFromIP('{checkout_token_id}', '{ip_address}', function(resp){
  //Success
},
function(error){
  //Error handler
 }
);


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Checkout::getLocationFromIP('{checkout_token_id}', ['ip_address' => '{ip_address}']);

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Checkout.get_location_from_ip('{checkout_token_id}', {:ip_address => "{ip_address}"})

Request

Example Response


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

Response

Set tax zone

Request (IP address only - EU VAT MOSS)


$ curl https://api.chec.io/v1/checkouts/{checkout_token_id}/helper/set_tax_zone?ip_address={ip_address} \
    -H "X-Authorization: {key}"


Commerce.Checkout.setTaxZone('{checkout_token_id}', { 'ip_address': "{ip_address}" },
    function(resp) {
        //Success
    },
    function(error) {
        //Error handler
    }

);


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Checkout::setTaxZone('{checkout_token_id}', ['ip_address' => '{ip_address}']);

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Checkout.set_tax_zone('{checkout_token_id}', {:ip_address => "{ip_address}"})

Request


$ curl https://api.chec.io/v1/checkouts/{checkout_token_id}/helper/set_tax_zone?country={country}&region={region?}postal_zip_code={postal_zip_code?} \
    -H "X-Authorization: {key}"


Commerce.Checkout.setTaxZone('{checkout_token_id}',
    {
        'country': "{country}",
        'region': "{region}",
        'postal_zip_code': "{postal_zip_code}",
    },
    function(resp) {
        //Success
    },
    function(error) {
        //Error handler
    }

);


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Checkout::setTaxZone('{checkout_token_id}', ['country' => '{country}',
                                                      'region' => '{region}',
                                                      'postal_zip_code' => '{postal_zip_code}']);

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Checkout.get_location_from_ip('{checkout_token_id}', {:country => '{country}',
                                                               :region => '{region}',
                                                               :postal_zip_code => '{postal_zip_code}'})

Request

Example Response


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

}

Response

Check variant

Request


$ curl https://api.chec.io/v1/checkouts/{checkout_token_id}/check/{line_item_id}/variant?variant_id={variant_id}&option_id={option_id} \
    -H "X-Authorization: {key}"


Commerce.Checkout.checkVariant('{checkout_token_id}', '{line_item_id}', { variant_id : '{variant_id}', option_id : '{option_id}' }, function(resp){
  //Success
},
function(error){
  //Error handler
 }
);


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Checkout::checkVariant('{checkout_token_id}', '{line_item_id}', ['variant_id' => '{variant_id}',
                                                                          'option_id' => '{option_id}']);

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Checkout.check_variant('{checkout_token_id}', '{line_item_id}', [:variant_id => '{variant_id}',
                                                                                 :option_id => '{option_id}'})

Request

Example Response


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

Response

Check requested quantity

Request


$ curl https://api.chec.io/v1/checkouts/{checkout_token_id}/check/{line_item_id}/quantity?amount={amount} \
    -H "X-Authorization: {key}"


Commerce.Checkout.checkQuantity('{checkout_token_id}', '{line_item}', { amount: '{amount}'}, function(resp){
  //Success
},
function(error){
  //Error handler
 }
);


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Checkout::checkQuantity('{checkout_token_id}', '{line_item_id}', ['amount' => '{amount}']);

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Checkout.check_quantity('{checkout_token_id}', '{line_item_id}', { :amount => '{amount}' })

Request

Example Response

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

Response

Check discount code

Request


$ curl https://api.chec.io/v1/checkouts/{checkout_token_id}/check/discount?code={code} \
    -H "X-Authorization: {key}"


Commerce.Checkout.checkDiscount('{checkout_token_id}', { code : '{code}' }, function(resp){
  //Success
},
function(error){
  //Error handler
 }
);


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Checkout::checkDiscount('{checkout_token_id}', ['code' => '{code}']);

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Checkout.check_discount('{checkout_token_id}', { :code => '{code}' })

Request

Example Response


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

Response

Get available shipping methods

Request


$ curl https://api.chec.io/v1/checkouts/{checkout_token_id}/helper/shipping_options?country={country_code} \
    -H "X-Authorization: {key}"


Commerce.Checkout.getShippingOptions('{checkout_token_id}', { 'country': '{country}', 'region' : '{region}' }, function(resp){
  //Success
},
function(error){
  //Error handler
 }
);


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Checkout::getShippingOptions('{checkout_token_id}', ['country' => '{country}', 'region' => '{region}']);

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Checkout.get_shipping_options('{checkout_token_id}', { :country => '{country}', :region => '{region}' })

Request

Example Response


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

Response

Check shipping method

Request


$ curl https://api.chec.io/v1/checkouts/{checkout_token_id}/check/shipping?country={country}&id={shipping_method_id} \
    -H "X-Authorization: {key}"


Commerce.Checkout.checkShippingOption('{checkout_token_id}', { country: '{country}', region: '{region}',  id: '{shipping_method_id}'}, function(resp){
  //Success
},
function(error){
  //Error handler
 }
);


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Checkout::checkShippingOption('{checkout_token_id}', ['country' => '{country}',  'region': '{region}', 'id' => '{shipping_method_id}']);

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Checkout.check_shipping_option('{checkout_token_id}', { :country => '{country}', :region => '{region}', :id => '{shipping_method_id}'  })

Request

Example Response

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

Response

Check “Pay What You Want” amount

Request


$ curl https://api.chec.io/v1/checkouts/{checkout_token_id}/check/pay_what_you_want?customer_set_price={customer_set_price} \
    -H "X-Authorization: {key}"


Commerce.Checkout.checkPayWhatYouWant('{checkout_token_id}', { customer_set_price: '{customer_set_price}' }, function(resp){
  //Success
},
function(error){
  //Error handler
 }
);


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Checkout::checkPayWhatYouWant('{checkout_token_id}', ['customer_set_price' => '{customer_set_price}']);

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Checkout.check_pay_what_you_want('{checkout_token_id}', { :customer_set_price => '{customer_set_price}' })

Request

Example Response

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

Response

Check if order is free

Request


$ curl https://api.chec.io/v1/checkouts/{checkout_token_id}/check/is_free \
    -H "X-Authorization: {key}"


Commerce.Checkout.isFree('{checkout_token_id}', function(resp){
  //Success
},
function(error){
  //Error handler
 }
);


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Checkout::isFree('{checkout_token_id}');

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Checkout.is_free('{checkout_token_id}')

Request

Example Response

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

Response

Check status of PayPal payment

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

Request


$ curl https://api.chec.io/v1/checkouts/{checkout_token_id}/check/paypal/payment \
    -H "X-Authorization: {key}"


Commerce.Checkout.checkPaypalStatus('{checkout_token_id}', function(resp){
  //Success
},
function(error){
  //Error handler
 }
);


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Checkout::checkPaypalStatus('{checkout_token_id}');

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Checkout.check_paypal_status('{checkout_token_id}')

Request

Example Response


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

Response

Check if PayPal order captured

This endpoint was designed to let you know if Chec has processed the order as we have to wait for PayPal’s IPN to notify us.

Request


$ curl https://api.chec.io/v1/checkouts/{checkout_token_id}/check/paypal/captured \
    -H "X-Authorization: {key}"


Commerce.Checkout.checkPaypalOrderCaptured('{checkout_token_id}', function(resp){
  //Success
},
function(error){
  //Error handler
 }
);


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Checkout::checkPaypalOrderCaptured('{checkout_token_id}');

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Checkout.check_paypal_order_captured('{checkout_token_id}')

Request

Example Response

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

Response

Get live

Request


$ curl https://api.chec.io/v1/checkouts/{checkout_token_id}/live \
    -H "X-Authorization: {key}"


Commerce.Checkout.getLive('{checkout_token_id}', function(resp){
  //Success
},
function(error){
  //Error handler
 }
);


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Checkout::getLive('{checkout_token_id}');

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Checkout.get_live('{checkout_token_id}')

Request

Example Response

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

Response

Returns the live object

List available shipping countries

Returns only the countries which can be shipped to

Request


$ curl https://api.chec.io/v1/services/locale/{checkout_token_id}/countries \
    -H "X-Authorization: {key}"


Commerce.Services.localeListShippingCountries('{checkout_token_id}', function(resp){
  //Success
},
function(error){
  //Error handler
 }
);


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Service::localeListShippingCountries('{checkout_token_id}');

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Service.locale_list_shipping_countries('{checkout_token_id}')

Example Response


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

Response

List all countries

Request


$ curl https://api.chec.io/v1/services/locale/countries \
    -H "X-Authorization: {key}"


Commerce.Services.localeListCountries(function(resp){
  //Success
},
function(error){
  //Error handler
 }
);


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Service::localeListCountries();

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Service.locale_list_countries()

Example Response


{
  "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",
    "BY": "Belarus",
    "BE": "Belgium",
    "BZ": "Belize",
    "BJ": "Benin",
    "BM": "Bermuda",
    "BT": "Bhutan",
    "BO": "Bolivia",
    "BA": "Bosnia & Herzegovina",
    "BW": "Botswana",
    "BV": "Bouvet Island",
    "BR": "Brazil",
    "IO": "British Indian Ocean Territory",
    "BN": "Brunei Darussalam",
    "...","...","..."
  },
  "html": "<option value=\"AF\">Afghanistan</option><option value=\"AL\">Albania</option><option>...</option>, <option>...</option>, <option>...</option>"
}

Response

List all subdivisions (states, provinces, or regions) for a country

Request


$ curl https://api.chec.io/v1/services/locale/{country_code}/subdivisions \
    -H "X-Authorization: {key}"


Commerce.Services.localeListSubdivisions('{country_code}', function(resp){
  //Success
 },
function(error){
  //Error handler
 }
);


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Service::localeListSubdivisions('{country_code}');

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Service.locale_list_subdivisions('{country_code}')

Request

Example Response



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


Response

Products

The product object

Example

{
  "id": "prod_4VPvL5zRQ5AQkX",
  "created": 1476727740,
  "last_updated": 1479508416,
  "active": true,
  "permalink": "ScZPWz",
  "name": "Cart Debug Digital + Physical",
  "description": null,
  "price": {
    "raw": 1,
    "formatted": "1.00",
    "formatted_with_symbol": "$1.00",
    "formatted_with_code": "1.00 USD"
  },
  "quantity": 0,
  "media": {
    "type": "image",
    "source": "https://cdn.chec.io/merchants/2/local/images/c0d0e195df91ff0bb3f4fe5b6eaf2866d32a33a1582f81adc376c|IMG_5564.JPG"
  },
  "conditionals": {
    "is_active": true,
    "is_free": false,
    "is_pay_what_you_want": false,
    "is_preorder": false,
    "is_quantity_limited": false,
    "is_sold_out": false,
    "has_digital_delivery": true,
    "has_physical_delivery": true,
    "has_images": true,
    "has_video": false,
    "has_rich_embed": false,
    "collects_fullname": false,
    "collects_shipping_address": true,
    "collects_billing_address": false,
    "collects_extrafields": true
  },
  "is": {
    "active": true,
    "free": false,
    "pay_what_you_want": false,
    "preorder": false,
    "quantity_limited": false,
    "sold_out": false
  },
  "has": {
    "digital_delivery": true,
    "physical_delivery": true,
    "images": true,
    "video": false,
    "rich_embed": false
  },
  "collects": {
    "fullname": false,
    "shipping_address": true,
    "billing_address": false,
    "extrafields": true
  },
  "checkout_url": {
    "checkout": "http://checkout.chec.dev/ScZPWz?checkout=true",
    "display": "http://checkout.chec.dev/ScZPWz"
  },
  "extrafields": [
    {
      "id": "extr_Kvg9l6GQqw1bB7",
      "name": "Test",
      "type": "text",
      "required": true,
      "options": null
    }
  ],
  "variants": [
    {
      "id": "vrnt_Kvg9l6Apq51bB7",
      "name": "Variant #1",
      "options": [
        {
          "id": "optn_ZG6kVw7vOl2eDx",
          "name": "Options 1",
          "price": {
            "raw": 5,
            "formatted": "5.00",
            "formatted_with_symbol": "$5.00",
            "formatted_with_code": "5.00 USD"
          },
          "quantity": 0,
          "is": {
            "quantity_limited": true
          }
        },
        {
          "id": "optn_QO3bR5XDk5nzdj",
          "name": "Option 2",
          "price": {
            "raw": 10,
            "formatted": "10.00",
            "formatted_with_symbol": "$10.00",
            "formatted_with_code": "10.00 USD"
          },
          "quantity": 0,
          "is": {
            "quantity_limited": true
          }
        }
      ]
    },
    {
      "id": "vrnt_kpnNwAyBrwmXB3",
      "name": "Variant #2",
      "options": [
        {
          "id": "optn_7RyWOwmG95nEa2",
          "name": "Option 1",
          "price": {
            "raw": 10,
            "formatted": "10.00",
            "formatted_with_symbol": "$10.00",
            "formatted_with_code": "10.00 USD"
          },
          "quantity": 0,
          "is": {
            "quantity_limited": true
          }
        },
        {
          "id": "optn_1ypbroEyno8n4e",
          "name": "Option 2",
          "price": {
            "raw": 20,
            "formatted": "20.00",
            "formatted_with_symbol": "$20.00",
            "formatted_with_code": "20.00 USD"
          },
          "quantity": 0,
          "is": {
            "quantity_limited": true
          }
        }
      ]
    }
  ]
}

List all products

Request


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


Commerce.Products.list(function(resp){
  //Success
 },
function(error){
  //Error handler
 }
);


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Product::all();

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Product.all()

Request

Example Response


{
  "data": [
    {
      "id": "prod_AmOVKl4v8oprRP",
      "created": 1478918484,
      "last_updated": 1479428022,
      "active": true,
      "permalink": "PZ5l5K",
      "name": "Category Test",
      "description": null,
      "price": {
        "raw": 1,
        "formatted": "1.00",
        "formatted_with_symbol": "$1.00",
        "formatted_with_code": "1.00 USD"
      },
      "quantity": 0,
      "media": [],
      "conditionals": {
        "is_active": true,
        "is_free": false,
        "is_pay_what_you_want": false,
        "is_preorder": false,
        "is_quantity_limited": false,
        "is_sold_out": false,
        "has_digital_delivery": true,
        "has_physical_delivery": false,
        "has_images": false,
        "has_video": false,
        "has_rich_embed": false,
        "collects_fullname": false,
        "collects_shipping_address": false,
        "collects_billing_address": false,
        "collects_extrafields": false
      },
      "is": {
        "active": true,
        "free": false,
        "pay_what_you_want": false,
        "preorder": false,
        "quantity_limited": false,
        "sold_out": false
      },
      "has": {
        "digital_delivery": true,
        "physical_delivery": false,
        "images": false,
        "video": false,
        "rich_embed": false
      },
      "collects": {
        "fullname": false,
        "shipping_address": false,
        "billing_address": false,
        "extrafields": false
      },
      "checkout_url": {
        "checkout": "http://checkout.chec.dev/PZ5l5K?checkout=true",
        "display": "http://checkout.chec.dev/PZ5l5K"
      }
    }, {...}, {...}
  ],
  "meta": {
    "pagination": {
      "total": 5,
      "count": 1,
      "per_page": 25,
      "current_page": 1,
      "total_pages": 5,
      "links": {
        "next": "http://api.chec.dev/v1/products?limit=1&page=2"
      }
    }
  }
}

Response

Retrieve Product

Request


$ curl https://api.chec.io/v1/products/{identifier}?type={identifier_type} \
    -H "X-Authorization: {key}"


Commerce.Products.retrieve('{identifier}', { type: '{identifier_type}' }, function(resp){
  //Success
 },
function(error){
  //Error handler
 }
);


Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Product::retrieve('{identifier}', {'type' => '{identifier_type}'});

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Product.retrieve('{identifer}')

Request

Example Response

{
  "id": "prod_4VPvL5zRQ5AQkX",
  "created": 1476727740,
  "last_updated": 1479508416,
  "active": true,
  "permalink": "ScZPWz",
  "name": "Cart Debug Digital + Physical",
  "description": null,
  "price": {
    "raw": 1,
    "formatted": "1.00",
    "formatted_with_symbol": "$1.00",
    "formatted_with_code": "1.00 USD"
  },
  "quantity": 0,
  "media": {
    "type": "image",
    "source": "https://cdn.chec.io/merchants/2/local/images/c0d0e195df91ff0bb3f4fe5b6eaf2866d32a33a1582f81adc376c|IMG_5564.JPG"
  },
  "conditionals": {
    "is_active": true,
    "is_free": false,
    "is_pay_what_you_want": false,
    "is_preorder": false,
    "is_quantity_limited": false,
    "is_sold_out": false,
    "has_digital_delivery": true,
    "has_physical_delivery": true,
    "has_images": true,
    "has_video": false,
    "has_rich_embed": false,
    "collects_fullname": false,
    "collects_shipping_address": true,
    "collects_billing_address": false,
    "collects_extrafields": true
  },
  "is": {
    "active": true,
    "free": false,
    "pay_what_you_want": false,
    "preorder": false,
    "quantity_limited": false,
    "sold_out": false
  },
  "has": {
    "digital_delivery": true,
    "physical_delivery": true,
    "images": true,
    "video": false,
    "rich_embed": false
  },
  "collects": {
    "fullname": false,
    "shipping_address": true,
    "billing_address": false,
    "extrafields": true
  },
  "checkout_url": {
    "checkout": "http://checkout.chec.dev/ScZPWz?checkout=true",
    "display": "http://checkout.chec.dev/ScZPWz"
  },
  "extrafields": [
    {
      "id": "extr_Kvg9l6GQqw1bB7",
      "name": "Test",
      "type": "text",
      "required": true,
      "options": null
    }
  ],
  "variants": [
    {
      "id": "vrnt_Kvg9l6Apq51bB7",
      "name": "Variant #1",
      "options": [
        {
          "id": "optn_ZG6kVw7vOl2eDx",
          "name": "Options 1",
          "price": {
            "raw": 5,
            "formatted": "5.00",
            "formatted_with_symbol": "$5.00",
            "formatted_with_code": "5.00 USD"
          },
          "quantity": 0,
          "is": {
            "quantity_limited": true
          }
        },
        {
          "id": "optn_QO3bR5XDk5nzdj",
          "name": "Option 2",
          "price": {
            "raw": 10,
            "formatted": "10.00",
            "formatted_with_symbol": "$10.00",
            "formatted_with_code": "10.00 USD"
          },
          "quantity": 0,
          "is": {
            "quantity_limited": true
          }
        }
      ]
    },
    {
      "id": "vrnt_kpnNwAyBrwmXB3",
      "name": "Variant #2",
      "options": [
        {
          "id": "optn_7RyWOwmG95nEa2",
          "name": "Option 1",
          "price": {
            "raw": 10,
            "formatted": "10.00",
            "formatted_with_symbol": "$10.00",
            "formatted_with_code": "10.00 USD"
          },
          "quantity": 0,
          "is": {
            "quantity_limited": true
          }
        },
        {
          "id": "optn_1ypbroEyno8n4e",
          "name": "Option 2",
          "price": {
            "raw": 20,
            "formatted": "20.00",
            "formatted_with_symbol": "$20.00",
            "formatted_with_code": "20.00 USD"
          },
          "quantity": 0,
          "is": {
            "quantity_limited": true
          }
        }
      ]
    }
  ]
}

Response

If successful, this will return the product object for the requested product.

Orders

The order object

Example

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

List orders

Request

Request

$ curl https://api.chec.io/v1/orders/{order_id} \
    -H "X-Authorization: {key}"

//Not available with JS SDK

Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Order::all(['limit' => 15]);

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Order.all({:limit => 15})

Example Response


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

Response

Retrieve

Request

$ curl https://api.chec.io/v1/orders/{order_id} \
    -H "X-Authorization: {key}"

//Not available with JS SDK

Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Order::retrieve('{order_id}');

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Order.retrieve('{order_id}')

Example Response

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

Request

Response

If successful, this will return the order object.

Retrieve payment & refund details

Request

$ curl https://api.chec.io/v1/orders/{order_id}/payments \
    -H "X-Authorization: {key}"

//Not available with JS SDK

Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Order::payments('{order_id}');

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Order.payments('{order_id}')

Example Response

{
  "order_id": "ord_p7ZAMo1xwNJ4xX",
  "payments": [
    {
      "id": "pymnt_20icw2ZVLRq4",
      "gateway_transaction_id": "ch_19HLUQDm0vyxCdYanLOHURDE",
      "created": 1479510590,
      "type": "card",
      "kind": "sale",
      "gateway": "stripe",
      "reference": 4242,
      "amount": 100,
      "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": []
}

Request

Response

Retrieve fulfillment details

Request

$ curl https://api.chec.io/v1/orders/{order_id}/fulfillment \
    -H "X-Authorization: {key}"

//Not available with JS SDK

Commerce\Auth::setApiKey('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27');

Commerce\Order::fulfillment('{order_id}');

Commerce.Auth('sk_test_8146250gNZ8gddde480e07ac91c10c2651077176aed27')

Commerce.Order.fulfillment('{order_id}')

Example Response


{
  "order_id": "ord_p7ZAMo1xwNJ4xX",
  "shipping": {
    "id": "ful_j0YnEoq65e7P61",
    "description": "USPS",
    "price": 0.99,
    "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"
        }
      ],