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

Shipping or Billing (payment) selection

There are 2 steps to shipping or billing address selection. First step is to get all available addresses in customer address book. Second step is to provide user selection with existing address ID or completely new address information (will be saved to address book)

Route: a/checkout/address

Method: POST

Get all available addresses and current selection (if already done) with mode=shipping or mode =payment

Post users selection with mode=shipping or mode =payment and action=save

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:

shipping - Handle shipping related address

payment - Handle payment (billing) related address

address_id

User selected shipping address ID from address book

This is address_id for shipping that is part part of response structure in saved_addresses

Works in combination with mode=shipping

payment_address_id

User selected payment address ID from address book

This is address_id for payment that is part part of response structure in saved_addresses

Works in combination with mode=payment

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/address , mode=shipping , token=2f7f30e3efeb0d73744680ac7c0c11e6

Example response
{ "selected_address_id":"20", "saved_addresses":[ { "address_id":"20", "address":"First Name Last Name, Address 1, Test City, Wisconsin, 087901, United States" } ], "fields":{ "firstname":{ "type":"input", "name":"firstname", "value":null, "required":true, "error":null }, "lastname":{ "type":"input", "name":"lastname", "value":null, "required":true, "error":null }, "company":{ "type":"input", "name":"company", "value":null, "required":false }, "address_1":{ "type":"input", "name":"address_1", "value":null, "required":true, "error":null }, "address_2":{ "type":"input", "name":"address_2", "value":null, "required":false }, "city":{ "type":"input", "name":"city", "value":null, "required":true, "error":null }, "postcode":{ "type":"input", "name":"postcode", "value":null, "required":false }, "country_id":{ "type":"selectbox", "name":"country_id", "options":{ "FALSE":" --- Please Select --- ", "1":"Afghanistan", "2":"Albania", "3":"Algeria", ….. }, "value":"223", "required":true, "error":null }, "zone_id":{ "type":"selectbox", "name":"zone_id", "required":true, "value":null, "error":null } } }

 

Method: POST

Validate and save new customer’s address and set it as shipping or payment address

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:

shipping - Handle shipping related address

payment - Handle payment (billing) related address

firstname

Customer’s first name

32 characters limit

lastname

Customer’s lastname

32 characters limit

company

Company name (optional)

32 characters limit

address_1

Street Address

128 characters limit

address_2

Apartment #, Suite #, etc part of address

128 characters limit

postcode

Zip code or Postal code

10 characters limit

city

City or town name

128 characters limit

country_id

ID of the country based on provided list of countries

 

zone_id

ID for the local zone within a country. This is usually a state or region

This ID can be received with separate request based on selected country ID

Any other

There are other parameters possible to be loaded (from extensions)

 

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


Payment options and selection

There are 2 steps to payment method selection. First step is to get all available payment options. Second step is to provide user payment selection. Coupon for discount can also be provided at this stage.

Route: a/checkout/payment

Method: POST

Get all available payment methods with mode=list

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

Shipping method and Payment address should be selected before this API stage.

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 payment method

list - Get all available payment methods

coupon

Coupon code to be used to apply available coupon value to total order.

Works in combination with any mode.

payment_method

User selected payment method ID

This is an ID for payment that is part of payment_methods structure.

Example: default_authorizenet_aim

agree

Pass return policy confirmation if required based on configuration settings.

This is configured in the admin and can be possibly enabled or disabled. Values: 1 agree or 0 decline

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/payment , mode=list , token=2f7f30e3efeb0d73744680ac7c0c11e6

Example response
{ "error_warning":"Error: You must agree to the Return Policy!", "success":null, "coupon":null, "address":"First Name Last Name test Address 1 Address 2 087901, 3676 Test City WI", "payment_methods":{ "default_cod":{ "id":"default_cod", "title":"Cash On Delivery", "sort_order":"" }, "default_authorizenet_aim":{ "id":"default_authorizenet_aim", "title":"Credit Card \/ Debit Card (Authorize.Net)", "sort_order":"" } }, "payment_method":null, "comment":"", "text_agree":"I have read and agree to the Return Policy<\/b><\/a>", "agree":null }

 

Final confirmation before payment submit

This step it to provide all prepared data for the order back to the user for final confirmation. Once user confirms that details payment details needs to be sent back for final payment processing.

Currently. Only COD and Authorize.Net are supported for payment methods.

important

In the confirmation response, there is a payment array structure that provides required data to complete payment. This data needs to be collected from the user and sent to final process step.

Route: a/checkout/confirm

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

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/confirm , token=2f7f30e3efeb0d73744680ac7c0c11e6

{ "store_id":null, "store_name":"Web Store Name", "store_url":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/", "customer_id":"16", "customer_group_id":"8", "firstname":"First Name", "lastname":"Last Name", "email":"test@test1.com", "telephone":"435435435", "fax":"434543543", "shipping_firstname":"First Name", "shipping_lastname":"Last Name", "shipping_company":"test", "shipping_address_1":"Address 1", "shipping_address_2":"Address 2", "shipping_city":"Test City", "shipping_postcode":"087901", "shipping_zone":"Wisconsin", "shipping_zone_id":"3676", "shipping_country":"United States", "shipping_country_id":"223", "shipping_address_format":"{ firstname } { lastname }\r\n{ company }\r\n{ address_1 }\r\n{ address_2 }\r\n{ city }, { zone } { postcode }\r\n{ country }", "payment_firstname":"First Name", "payment_lastname":"Last Name", "payment_company":"test", "payment_address_1":"Address 1", "payment_address_2":"Address 2", "payment_city":"Test City", "payment_postcode":"087901", "payment_zone":"Wisconsin", "payment_zone_id":"3676", "payment_country":"United States", "payment_country_id":"223", "payment_address_format":"{ firstname } { lastname }\r\n{ company }\r\n{ address_1 }\r\n{ address_2 }\r\n{ city }, { zone } { postcode }\r\n{ country }", "shipping_method":"Free Shipping", "payment_method":"Credit Card \/ Debit Card (Authorize.Net)", "products":[ { "product_id":"84", "name":"Armani Code Pour Femme", "model":"GRM005", "option":[ { "product_option_value_id":"669", "name":null, "value":"669", "prefix":null } ], "download":[ ], "quantity":2, "price":"$30.00", "total":"$60.00", "tax":0, "thumb":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/image\/thumbnails\/18\/6b\/azdemoproduct34jpg-100018-75x75.jpg" } ], "totals":[ { "title":"Sub-Total:", "text":"$60.00", "value":60, "sort_order":"1" }, { "title":"Free Shipping:", "text":"$0.00", "value":0, "sort_order":"3" }, { "title":"Retail 8.5%:", "text":"$5.10", "value":5.1, "sort_order":"5" }, { "title":"Total:", "text":"$65.10", "value":65.1, "sort_order":"6" } ], "comment":"", "total":65.1, "language_id":"1", "currency_id":"1", "currency":"USD", "value":"1.00000000", "coupon_id":0, "ip":"71.127.255.162", "shipping_address":"First Name Last Name test Address 1 Address 2 087901, 3676 Test City WI", "payment_address":"First Name Last Name test Address 1 Address 2 087901, 3676 Test City WI", "text_accept_agree":"", "payment":{ "text_credit_card":"Credit Card Details", "entry_cc_owner":"Card Owner:", "cc_owner":{ "type":"input", "name":"cc_owner", "required":true, "value":"" }, "entry_cc_number":"Card Number:", "cc_number":{ "type":"input", "name":"cc_number", "required":true, "value":"" }, "entry_cc_expire_date":"Card Expiry Date:", "entry_cc_cvv2":"Card Security Code (CVV2):", "cc_cvv2":{ "type":"input", "name":"cc_cvv2", "value":"", "style":"short", "required":true, "attr":" size=\"3\"" }, "button_confirm":"Confirm Order", "button_back":"Back", "cc_expire_date_month":{ "type":"selectbox", "name":"cc_expire_date_month", "value":"03", "options":{ "01":"January", "02":"February", … }, "required":true, "style":"short" }, "cc_e xpire_date_year":{ "type":"selectbox", "name":"cc_expire_date_year", "value":"2013", "options":{ "2012":"2012", … }, "required":true, "style":"short" }, "process_rt":"default_authorizenet_aim\/send" } }

Process payment and complete the order

This is a final step in order process.

mportant

In the confirmation response, there was a payment array structure that provided required data to complete payment. This data needs to be collected from the user and sent to this process step.

Route: a/checkout/process

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

payment details

Details that are returned from confirmation step in payment structure.

Required based on “required” flag in the structure

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/process , [ field values ] token=2f7f30e3efeb0d73744680ac7c0c11e6

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