Inventory

Different OIS Inventory endpoints give back different results, because they are intended for different purposes. Always consider the specific use case when deciding which endpoints to use.

Unprocessed orders

Some OIS Inventory endpoints deduct stock from unprocessed orders when giving back the result. This is done to take into account the time it takes to import and process orders in the ERP system. Note that inventory endpoints that contain stock per branch cannot deduct unprocessed orders, as it is not yet known which branch is going to ship the articles.

Endpoints that deduct unprocessed orders can be used to perform a RealTime StockCheck (RTSC). In order to prevent overselling, it is recommended to perform the RTSC in various parts of the webshop. This should include when an article is added to the cart and every step of the checkout. However, in order to prevent large amounts of unnecessary API calls the RTSC should only be performed when stock levels are already sufficiently low.

When performing the RTSC, the Source parameter defines where stock is retrieved:

  • Source = 1 (OIS). This source retrieves current stock from OIS and deducts unprocessed orders. This source is always available.

  • Source = 2 (XPRT). This source retrieves current stock from XPRT, thereby keeping track of POS transactions, and deducts unprocessed orders. This source is only available when configured in both OIS and XPRT and is not available for all endpoints.

Accurate Stock

To prevent overselling in 100% of cases is a tall order, however to keep stock levels as accurate as possible, the following automated processes are recommended:

  • Every night or early morning, perform a full stock synchronisation. This means retrieving all stock from an OIS endpoint and updating any stock discrepancies accordingly.

  • During the day, perform a delta stock synchronisation every X minutes (normally between 5-15 minutes). This means only the stock that has changed in the last X minutes has to be updated.

  • Perform the RealTime StockCheck (RTSC) whenever an article is added to the cart and in every step of the checkout, if the stock of that article is below X. Ideally X should be configurable, in order to be able to adapt to sale periods quickly. If there is a discrepancy between own stock and the RTSC, update own stock accordingly.

  • Whenever a customer is sent to the Payment Service Provider (PSP), reserve stock of all articles in the cart until:

    • Confirmation of payment is received from the PSP and the order has been posted to the OIS.

    • Cancellation is received from the PSP.

    • No notification is received from the PSP for X minutes. Note that this depends on the PSP, as some PSPs do not send a notification if a customer abandons the payment page.

The recommended endpoint for synchronising stock is v2/stock/combined GET. This endpoint supports paginated full and delta stock synchronisation, and can also be used for the RTSC.

Branch Stock

In case branch stock needs to be shown in the webshop, it is recommended to create separate flows for the regular stock synchronisation and the branch-specific stock synchronisation. The stock endpoints that return stock per branch cannot deduct unprocessed orders, meaning discrepancies can exist between actual stock that can be sold in the webshop and the total stock that is in branches.

The recommended endpoint for synchronising branch-specific stock is v2/stock/byBranch GET.