This is a section of API to provide tools to add products to cart, select shipment and payment details and complete the order. It is highly recommended to use HTTPS to access this part of API.
Table of Contents |
---|
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
Panel | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Example request:
POST: rt=a/checkout/cart , token=58fb1592f0c59b8dc1d5541aebdff8da
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "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
Panel | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Example request: POST: rt=a/checkout/shipping , mode=list , token=2f7f30e3efeb0d73744680ac7c0c11e6
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "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
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "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
Panel | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Example request:
POST: rt=a/checkout/address , mode=shipping , token=2f7f30e3efeb0d73744680ac7c0c11e6
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "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
Panel | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
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
Note |
---|
Shipping method and Payment address should be selected before this API stage. |
Panel | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Example request: POST: rt=a/checkout/payment , mode=list , token=2f7f30e3efeb0d73744680ac7c0c11e6
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "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.
Warning | ||
---|---|---|
| ||
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
Panel | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Example request:
POST: rt=a/checkout/confirm , token=2f7f30e3efeb0d73744680ac7c0c11e6
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
{ "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.
Warning | ||
---|---|---|
| ||
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
Panel | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Example request:
POST: rt=a/checkout/process , [ field values ] token=2f7f30e3efeb0d73744680ac7c0c11e6
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "success":"completed", "status":1 } |
Common DATA API
There is some additional data available via API.
Validate Access to API
You can run this simple request to check if API access is working. You will get error if no access or empty reply if access it OK.
Route: a/common/access
Method: GET
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. |
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:
http://demo.abantecart.com/index.php?rt=a/common/access&api_key=[key]
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{"error":"Access to API is disabled!"} |
Get Countries
You can get all the countries from the system
Route: a/common/country
Method: GET
Embed the API query in <script> tags. Define the callback function in <script> tags.
Example request: http://demo.abantecart.com/index.php?rt=a/common/country
Get Zones
You can get all the geo zones for specified country ID
Route: a/common/zone
Method: GET
Embed the API query in <script> tags. Define the callback function in <script> tags.
Example request:
http://demo.abantecart.com/index.php?rt=a/common/zone&country_id=2
language | actionscript3 |
---|---|
theme | DJango |
title | Example response |