Brightpearl and Spree Commerce

Introduction

We recently did a project for a client in the Middle East. They were looking for an ecommerce system along with a business management application for inventory management, purchasing, sales order management and financial accounting.

Believing Spree Commerce as one of the most exciting ecommerce platforms, we simply proposed it. However for other business management needs we had no obvious choice. We found various open source and cloud based solutions but surprisingly there were very few (or may be none) which were satisfying our criteria:  cost effective, easy to implement with minimum configuration and implementation effort/time, and easy to integrate with third party systems (Spree Commerce in our case). 

In short we found Brightpearl the most suitable for our need. The most useful feature of it is its intuitive and easy to use UI and API. API enables it to be integrated with third party systems. In this post I am going to share with you my experience of integrating Spree Commerce with Brightpearl.


Brightpearl - Spree Commerce Integration

The requirement was that whenever an order is placed on ecommerce website, the order should be transferred to Brightpearl for further processing. When order is fulfilled and marked as shipped in Brightpearl, its status should be reflected in Spree Commerce. On the other hand when items are received from vendors (in Brightpearl), it should adjust the inventory level of those products in Spree Commerce. In sum, inventory management and sales order processing was to be done through Brightpearl.

After analysing the requirement it was obvious that following integration points are needed:
  • Products
    We decided that Spree Commerce shouldn't be used to create new products. Product should always be created within Brightpearl and then should automatically be pushed in Spree Commerce. This is to ensure that items of sales orders, moving from Spree Commerce to Brightpearl, have valid reference in Brightpearl.

    Here we used one of the most exciting features of Brightpearl: 'Webhook'. Webhook is the feature that enables Brightpearl to send HTTP messages to a third party system on certain events occurred within Brightpearl. For example, whenever a new product is created, a message (with json payload) is sent to an already registered URL.

    It is really amazing to see a product created in Brightpearl automatically reflected in Spree Commerce in moments.

  • Product Inventory 
    While implementing ecommerce system there might be a tendency to totally depend on the inventory management of third party system. For example, wherever it is needed to show the 'Availability' status of products (on ecommerce website, e.g. on product detail page), there will be a call to third party system for inventory check, same is the case when adding items to cart as well as at the time of checkout. (I've personally seen this in an implementation of IBM WebSphere Commerce). I personally consider this as a very bad practice. Imagine, thousands of visitors daily visiting your website and each visitor views tens of product and each view is initiating a call to your third party system. Not only it will (negatively) hit the performance of the site but will also burden your inventory management system.

    What we decided in our implementation is to synchronise the inventory of both systems and let both systems use their own inventory management. In this way whenever you are showing 'Availability' status of products on ecommerce website, it uses its own database and no call is made to the third party system.


    We again made use of webhook feature of Brightpearl in order to get updates in Spree Commerce from Brightpearl (e.g. when an item is received from the vendor, Brightpearl should make a call to Spree Commerce so that it can adjust the inventory there).


    Note: Some webhook notifications don't work as they should be. This is probably due to some bug in Brightpearl. I've contacted them in past for it. Not sure it is fixed yet or not.
  • Order Transfer
    Whenever an order is placed in Spree Commerce it is just pushed to Brightpearl using Brightpearl API. Again it is really amazing to see orders flowing from Spree Commerce to Brightpearl instantly. Right after the order is sent to Brightpearl, I am also sending another message to allocate the inventory there. Please also note that I am using delayed_job gem to push the order asynchronously.

  • Shipment Status
    After an order is placed, further processing of it is done in Brightpearl. It is fulfilled from there and marked as shipped. It is very important to reflect that shipment status in Spree Commerce so that registered users who placed the orders can check the shipment status of their orders on the website.


    Again, webhook plays its role here and as soon as the order is marked as shipped, Brightpearl calls a specific Spree Commerce URL to notify the system that order status is updated.

Summary

Integration between systems is always a tough part but the project in question was a wonderful experience due to extensibility features of Spree Commerce and due to Brightpearl's integration options. Nevertheless, webhooks and API of Brightpearl definitely have good room for improvements and I hope Brightpearl team will put special focus on this area.

Popular posts from this blog

Medical Codings – An Overview

Clinical Decision Support and Meaningful Use Stage II