OpenCart

What it is

OpenCart is a free e-commerce platform (ocStore is built on it too). The integration uses the OpenCart built-in API of versions 3.x and 4.x — nothing extra has to be installed in the store. The bot checks availability and prices, places an order with shipping and payment and changes the order status. On OpenCart 3.x the bot also reads order details. An order from the bot appears in the OpenCart admin like any other.

The OpenCart built-in API is made for placing orders from the admin, so it has no catalog export, product search or customer order history. To let the bot show products, connect the store catalog in Products → Synchronization with a YML or CSV feed. Product IDs from the OpenCart catalog work for orders.

Requirements

  • An OpenCart 3.x (including ocStore 3) or 4.x store reachable from the internet over HTTPS.
  • Administrator access to the OpenCart admin.
  • An OpenCart API user whose IP allow-list includes the Botconsole server IP.

How to connect

  1. In the OpenCart admin open System → Users → API and click Add New.
  2. Set an API username, click Generate and copy the key — you can't view it later. Enable the status.
  3. On the IP Addresses tab add the Botconsole server IP and save. The IP is shown in the instruction of the OpenCart connection form in the constructor.
  4. In the constructor, open Integrations → find the OpenCart card → Connect.
  5. Enter the store URL with https://, the API username (exactly as in OpenCart) and the API key.
  6. Click Check connection. Botconsole detects the OpenCart version itself. If the store rejects the request, the error text names the IP to add to the list.

Available operations

Operation What it does
Check availability and price Puts the items into a temporary cart and returns available = 1/0, prices, the total and the store's error text: out of stock, missing required option, below the minimum quantity
Create order Customer, items, address, shipping and payment methods, comment, status. Returns the order number and the chosen methods
Order details Status, total, currency, date, contacts and shipping/payment methods. OpenCart 3.x only
Change order status Adds an order history entry with the new status and a comment, can notify the customer by email

Items are lines of product_ID:quantity. For products with required options (size, color) use JSON: [{"product_id": 42, "quantity": 1, "option": {"225": "17"}}], where 225 is the product option ID and 17 the value ID; both are visible on the product page in the admin.

Setting up «Create order»

  • Country ID and Zone ID — from System → Localisation → Countries / Zones, the number in the edit page URL. In a stock install United States is 223, Russia is 176. The zone is required when the country has zones.
  • Shipping method code — e.g. flat.flat, free.free, pickup.pickup. Empty — the first method the store offers for the address.
  • Payment method code — e.g. cod, bank_transfer. Empty — the first available one.
  • Order status ID — from System → Localisation → Order Statuses. 1 (Pending) by default.

Limitations

  • HTTPS only: the API key is sent to the store and over HTTP it would travel in clear text. The URL must be a public website. Botconsole doesn't follow redirects, so enter the store's final address.
  • Without the Botconsole server IP in the API user's allow-list the store rejects every request. The list has to be updated if Botconsole servers change.
  • OpenCart 4.x requests are signed with the key, and the signature includes the store domain and path. Behind a proxy that rewrites the Host header the signature won't match and the store answers “access denied”.
  • Enter the API username exactly as in OpenCart, case included.
  • The built-in API has no catalog, product search or customer orders. OpenCart 4.x has no order details either.
  • Modules that replace the standard checkout (quick or one-page checkout, for example) may change how the API behaves.

Notes

A typical flow: catalog from Botconsole sync → «Check availability and price» → «Create order» → the bot sends the customer the order number.

OpenCart requires an email, first name, last name and address. If the customer gave no last name, the bot repeats the first name.

The shipping cost always comes from the store's own quote for the customer's address, never from the bot's parameters.