Skip to main content

How to connect PrestaShop to Stokis

Switch the webservice on under Advanced Parameters → Webservice, create a key with read access to the resources listed below, then paste the key into Stokis. There is no module to install, and it works on PrestaShop 1.7, 8 and 9.

What you need before you start

Stokis reads PrestaShop through the webservice that is part of every PrestaShop shop. You switch it on and create a key for Stokis in the back office. The pictures were taken on PrestaShop 8.2.8; on 1.7 and 9 the Webservice page sits under the same menu and has the same fields.

  • A back office account that can open Advanced Parameters.
  • A shop address that opens over https in a browser. Stokis connects over https only.
  • URL rewriting on the server, which PrestaShop's webservice needs. Most shops have it on already.
  • A Stokis account with a workspace that has no shop connected yet. One workspace holds one shop.

Switch the webservice on

In the back office open Advanced Parameters → Webservice. Under Configuration set Enable PrestaShop's webservice to Yes and press Save.

The Webservice page of PrestaShop 8.2.8: an empty list of keys with an Add new webservice key button at the top right, and a Configuration block where Enable PrestaShop's webservice is set to Yes above a Save button.
PrestaShop 8.2.8, Advanced Parameters → Webservice, with the webservice switched on. The list is empty until the first key is made.

Create a key for Stokis

  1. Press Add new webservice key.
  2. Press Generate. PrestaShop fills in a key of 32 characters.
  3. Type a Key description that tells you later whose key it is, for example Stokis.
  4. Leave Enable webservice key on Yes.
The PrestaShop form for a new webservice key: a generated key of 32 characters, the description Stokis, Enable webservice key set to Yes, and the start of the permissions table with a column for each kind of access.
The form for a new key, with an example key. The permissions table starts at the bottom.

Give the key read access to eleven resources

In the permissions table tick View (GET) and Fast view (HEAD) for these resources, then press Save: categories, combinations, configurations, currencies, manufacturers, order_details, orders, product_option_values, products, stock_availables, suppliers.

The PrestaShop permissions table with View (GET) and Fast view (HEAD) ticked for categories, combinations, configurations, currencies, manufacturers, order_details, orders, product_option_values, products, stock_availables and suppliers.
The eleven rows Stokis needs, ticked. The real table lists every resource of the shop; the other rows are left out of this picture and stay unticked.

Do not tick customers or addresses. Stokis does not ask for them, and a key without them cannot read a customer's name, email or address.

Paste the key into Stokis

  1. Copy the key from the list on the Webservice page.
  2. In Stokis open Integrations and choose PrestaShop.
  3. Type the shop's address into Store URL. A trailing /api or slash is fine; Stokis strips it.
  4. Paste the key into API key.
  5. Press Test connection. Stokis checks every resource and names the ones the key cannot read.
  6. Press Connect. The first sync starts on its own and a dialog shows each step.
The Integrations page in Stokis with PrestaShop chosen: a Store URL field holding your-store.com and an API key field with a hidden value.
The Integrations page in Stokis with PrestaShop chosen and example values. The key is hidden as you paste it.

After the first sync Stokis reads the shop again on the schedule of your plan, and Sync now reads it on the spot.

Let Stokis add received orders to your stock

This step is optional. Tick Modify (PUT) for stock_availables on the key, and switch Push stock back to store on in the Integrations page of Stokis. Receiving a purchase order in Stokis then adds the received quantity to the product's stock in PrestaShop. Without that tick, or with the switch off, Stokis only reads.

A shop that uses Advanced Stock Management computes stock from its warehouses, so PrestaShop would overwrite the update. Stokis refuses the update for such a product; leave the switch off for that shop.

What Stokis reads from PrestaShop

Stokis readsStokis uses it for
products, combinations, product_option_valuesThe product list. Each combination is its own product, named after its option values
stock_availablesStock levels, stock cover and reorder points
orders, order_detailsSales history and the demand forecast
categories, manufacturers, suppliersFilters and supplier links
currencies, configurationsThe shop's currency, name and PrestaShop version

The key decides what can be read. With only the eleven resources above ticked, nothing else in the shop is open to Stokis.

When PrestaShop does not connect

Stokis names what it found. Match the message you see.

What you seeCauseFix
Invalid or expired API keyThe key was copied in part, was deleted, or is switched offCopy the key again from the Webservice page and check that it is enabled
Missing permissions on, followed by resource namesThe key lacks View (GET) or Fast view (HEAD) on the resources namedEdit the key, tick both for each resource named, save, then test again
The PrestaShop webservice is disabledEnable PrestaShop's webservice is set to NoSet it to Yes under Advanced Parameters → Webservice and save
Resource not found, check shop URL and resource nameThe address is not the shop's, or URL rewriting is off on the serverCheck the address, and switch URL rewriting on for the shop
PrestaShop returned non-JSON responseA firewall or security check in front of the shop answered in place of the webserviceLet Stokis through the firewall, then test again
The JSON webservice renderer raises a PHP warningAn old PrestaShop 1.7 release on a newer PHP answers every webservice request with an errorExclude warnings from PHP error_reporting on the shop, or upgrade PrestaShop
Stokis connects over https. Check that your address opens in your browserThe shop has no working https addressSet up https for the shop, then test again

How to replace the key or disconnect

  • To stop Stokis reading the shop, open Advanced Parameters → Webservice and switch the key off, or delete it. It stops working at once.
  • To replace the key, create a new one with the same permissions and paste it into the Integrations page in Stokis, then delete the old one.
  • To disconnect on the Stokis side, press Disconnect in the Integrations page. The automatic sync stops and the saved key is removed. Your products and sales history in Stokis stay, and you can connect again later.

Questions about connecting PrestaShop

No. Stokis uses the webservice that is part of PrestaShop, with a key you create in the back office.

Guides for other platforms