Checkout API

Checkout API

Add or update products in cart (basket)

Ability to add product to the cart with quantity and options. Default response to empty request is the content of the cart. If product and quantity are provided product will be added to the cart. If remove is provided along with valid product key, these products will be removed from the cart

Route: a/checkout/cart

Method: POST

Parameter

Meaning

Notes

Parameter

Meaning

Notes

callback

A JavaScript function to run when the response is received

Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

token

Access token ID. This token is provided by the system after successful initial authentication

required

product_id

Unique product ID that will be added to the cart

 

quantity

Number of products to be added to the cart

 

option_id

Product option ID

Options can be provided as an array with multiple combinations of option_id and option_value

option_value

Product option value

 

remove

Array of product keys to be removed from the cart.

Product cart key can be found on the cart content data structure. Examples: "key":"85:a10ee6ef6a41d8d2078bc2614fd71296" or "key":"86"

 

 

 

api_key

Unique API key that is set in the control panel

This is optional key that can be set to limit unauthorized (accidental) access to your API

Example request:
POST: rt=a/checkout/cart , token=58fb1592f0c59b8dc1d5541aebdff8da

Example response
{ "products":[ { "key":"85:a10ee6ef6a41d8d2078bc2614fd71296", "name":"Forbidden euphoria Eau de Parfum Spray ", "model":"Ck0010", "thumb":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/image\/thumbnails\/18\/6d\/azdemoproduct351jpg-100054-75x75.jpg", "option":[ { "name":"Fragrance Size", "value":"1 oz" } ], "quantity":1, "stock":true, "price":"$45.00", "total":"$45.00" } ], "weight":"0.08lb", "totals":[ { "title":"Sub-Total:", "text":"$45.00", "value":45, "sort_order":"1" }, { "title":"Total:", "text":"$45.00", "value":45, "sort_order":"6" } ] }

Update product quantity in the cart

You can update a quantity in the cart for particular product/options combination.

Route: a/checkout/cart

Method: POST

Params: product_id={number} quantity[{key}]={number}

Example quantity update request:
POST: rt=a/checkout/cart , token=58fb1592f0c59b8dc1d5541aebdff8da, product_id=53, quantity[53:ee705d4ae7846adb2c3e17d441a1009f]=2


Bulk add products into cart

Similar to adding one product into cart, you can send a request to add multiple products into the cart.

Route: a/checkout/cart

Method: POST

Params: products[{number}]: [product_id]={number} [quantity]={number} [option]={array}

Example of the request:
Request type: POST
rt=a/checkout/cart, products[0][product_id]=120, products[0][quantity]=1, products[0][option][349]=772, products[1][product_id]=120, products[1][quantity]=2, products[1][option][349]=773, token=c64b58bb51e40a3b1808592909


Clear Cart

Remove all products from the cart with one request

Route: a/checkout/cart

Method: POST

Param: remove_all=true

Example of the request:
Request type: POST
rt=a/checkout/cart, remove_all=true, token=c64b58bb51e40a3b1808592909


 

Shipping options and selection (First step in checkout)

There are 2 steps to shipping selection. First step is to get all available shipping options and pricing. Second step is to provide user selection.

Note, some products settings might not require shipping, in this case user selection step can be skipped.

Route: a/checkout/shipping

Method: POST

Get all available shipping methods with mode=list

Post users selection of shipping method and comment with mode=select

Parameter

Meaning

Notes

Parameter

Meaning

Notes

callback

A JavaScript function to run when the response is received

Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

token

Access token ID. This token is provided by the system after successful initial authentication

required

mode

switch to set the mode of this step.

Values:

select - Pass user selection for shipping method

list - Get all available shipping methods

shipping_method

User selected shipping method ID

This is an ID for shipping that is part of shipping_methods structure. Example:

default_free_shipping.default_free_shipping

option_id

Product option ID

Options can be provided as an array with multiple combinations of option_id and option_value

comment

User text based comment

Optional

api_key

Unique API key that is set in the control panel

This is optional key that can be set to limit unauthorized (accidental) access to your API

Example request: POST: rt=a/checkout/shipping , mode=list , token=2f7f30e3efeb0d73744680ac7c0c11e6

Example response
{ "error_warning":null, "address":"First Name Last Name test Address 1 Address 2 087901, 3676 Test City WI", "shipping_methods":{ "default_free_shipping":{ "title":"Free Shipping", "quote":{ "default_free_shipping":{ "id":"default_free_shipping.default_free_shipping", "title":"Free Shipping", "cost":0, "tax_class_id":0, "text":"$0.00" } }, "sort_order":"", "error":false }, "default_flat_rate_shipping":{ "title":"Flat Rate", "quote":{ "default_flat_rate_shipping":{ "id":"default_flat_rate_shipping.default_flat_rate_shipping", "title":"Flat Shipping Rate", "cost":"2", "tax_class_id":"9", "text":"$2.00" } }, "sort_order":"1", "error":false } }, "comment":null }

Example request:

POST: rt=a/checkout/shipping , mode=select , shipping_method=default_free_shipping.default_free_shipping , token=2f7f30e3efeb0d73744680ac7c0c11e6

Example response
{ "status":1, "shipping_select":"success" }