We’re experts at integrating Magento and OrderWise and here’s proof
Who are OrderWise and what’s our relationship with them?
OrderWise is an ERP, an enterprise resource planning system, create by Wise software. This software is suitable for large-scale organisations to manage stock, orders, piercing and delivery of goods and services within their ecosystem. We were introduced to OrderWise when asked to integrate with their systems during a website build, and have since formed a partnership with them after successfully integrating Magento and OrderWise.
Why do you need to integrate Magento and OrderWise?
One of the most common requests with any eCommerce website is “Can we integrate our ERP into the site?”. For most companies, the ERP is the hub for managing almost everything logistically within the business.
One of the biggest benefits of these integrations is that instead of using valuable human resources on tasks that are tedious but necessary for the business, you can now allocate that time to a computer, thus freeing up valuable resource time for tasks that are more complex and would be better suited for an actual human.
The downside of these integrations is they’re often costly and time-consuming due to poor planning and implementation, in certain situations wasting more time than saving. Based on our experience, we want to share with you some of the challenges and solutions that we found along the way when integrating OrderWise and Magento 2.
How does a Magento and OrderWise Integration work?
OrderWise and Magento both natively use a Rest API. In simple terms, this means that they have access points (referred to as endpoint points) that are exposed publicly for access outside of the platform. One service can send information to the other and as long as they have the right access information they can trigger various actions depending on the endpoints available. This can either be sending data and requesting the service use that data to perform an action or requesting that the service sends back information.
Start with proper planning when integrating Magento and OrderWise
Magento and OrderWise are both complicated and powerful in their own right. When it comes to integrating them, you must be very careful to follow the individual processes each requires when transferring information, so as to not disrupt the way these systems are set up to function.
When we started this project we scoped out all the endpoints we would require, using OrderWise’s API testing tool to verify data and endpoints, and planning out what data would be sent and retrieved. This gave our development team the advantage of not needing to map out data, but instead just focusing on the implementation.
Are you integrating Customers and companies between OrderWise and Magento?
The client needed customers and companies within Magento to be linked to customers and companies within OrderWise so that orders and payments would be linked to the correct company. This included making any new customers on Magento in the correct way within OrderWise.
Aligning out the hierarchy and mapping the objects
This section of the integration caused a lot of terminology confusion within our team. Within OrderWise, a customer is a company. Individuals within these companies are referred to as company contacts. If you’re familiar with Magento, you know that natively it does not come with companies and an individual would be a customer.
Configuring Magento to fit in with Orderwise’s structure
For this integration, we set up the Aheadworks company account module and then mimicked the structure within OrderWise to make everything sync correctly. To properly do this we had to add some customisation that made individual customers (within Magento) without companies, a company of a singular person. The customers themselves could not see a difference however the databases could be matched up correctly.
With this configuration, we could sync customers within OrderWise to companies within Magento, and customer contacts in OrderWise, with customers within Magento.
Are you looking for an Orderwise > Magento integration?
Tidying up the OrderWise edge cases
At this point, I hope you understand why the terminology caused so much confusion, which is why we included a diagram to help explain it.
This worked well, with the only issue being that some large companies with many branches were set up within OrderWise as separate companies, but all needed their billing email to be the same. Whereas in Magento the email used for this needed to be unique.
Because this was such an edge case, with only 3 companies out of 2000 operating in this fashion, we set up a bespoke redirect, rather than creating huge customisation just for them. We’d like to note here that this was done to protect the client’s budget, as our solution took drastically less time than the alternative.
How integrating stock and products went from complex to simple
The client needed the stock of all products to be updated hourly so that no orders for out-of-stock products could be made. They also wanted new products to be added to the site as they were added to OrderWise.
Why the native routes stopped us from syncing stock hourly
Using the native API routes, you can get a list of products or a single product with its stock. This is not helpful to sync all of the stock for all products, as for the 2000+ products the company has, that would mean 2000 API calls. Not only would this have been an absurd amount of requests, but it would have also likely led to the IP being blacklisted.
Solving the problem with export definition routes
This is where OrderWise’s export definition feature came in. The export definition endpoints allow you to create an endpoint, attach some SQL to it, and have the result be the response. So we created an endpoint that gave us SKU and stock, and as a bonus, added filters to remove products that would not be shown on the site. This removed excess data and prevented the Magento side from having to filter the results, win-win. Now we have a simple call, and once this endpoint was in place, the smoothest of all parts of the integration.
Learning our lesson from the stock call, we also created a custom endpoint for products. This one only gives new products and their website relevant attribute details.
Synchronising credit limits between Magento and OrderWise
The client required the customer credit to be synced within the two systems. This was originally scoped as a daily API call that would update the customers once per day using the detailed customer endpoint in OrderWise.
Receiving large and complicated calls for 2 pieces of information
The first issue arose when we realised that calling the detailed customer endpoint for 2000 customers was going to be a large call with a lot of data. This was ok for a once-a-day call, but not optimum for what the client wanted.
Solving the problem with export definition calls and Aheadworks company credit
Firstly, to accommodate customer credit, as we already used the Aheadworks company accounts module, we chose to use the Aheadworks company credit module as well. After our previous learning experiences with stock and products, we realised that creative use of the export definition endpoint to create our own call would simplify and optimise our integration.
We set up a custom endpoint, which would use the SQL to return only customers with credit, and from those customers, only their credit limit, credit amount available and customer ID. With customers already synced within the system, this worked very efficiently.
A Major size reduction
As an added bonus we cut the call down from 2000 + customers to 600, and the data field per customer from 30, to 3. That shrunk the call from 60,000 + data points to 1,800, reducing it by a whopping 97%. This meant we could allow the client to run the call several times a day without impacting their site.
How to approach integrating orders and payments between OrderWise and Magento
The client required orders and payments to be sent from Magento to OrderWise. Due to the company allowing purchases to be made on credit, the two needed to be separated and each has separate behaviour.
Separating orders and payments
Despite the fact that you’d think the two were linked when you deal with a system that handles credit, they’re not. They are separate entities that need to be treated as such.
Balancing credit in OrderWise
OrderWise, because of its credit-handling nature, works on a check and balance system. Adding an order against a customer creates a negative balance, and a payment creates a positive one. So the payment call and the order call within Magento had to be created and used separately, and when an order is purchased on credit, only the order call is activated.
A warning on custom endpoints (Export definition) in OrderWise
You can use these custom endpoints mentioned previously to add data to OrderWise. However, we would strongly recommend that unless you are an absolute expert on OrderWise, you should not do this. OrderWise is complicated, and set up to work in certain ways, with certain actions triggered when data is inputted the correct way. This is why we only chose to use these endpoints when retrieving data and left the creating and updating to OrderWise’s native API.
Our final thoughts on integrating Magento and OrderWise
As a leading B2B Magento agency experienced in software integration, including Magento integrations, the OrderWise integration was a big learning opportunity for us which required research, creative thinking and cooperation from our client.
It has given us opportunities to put our skills to the test and challenged us to really understand the processes involved in both systems.
We hope that some of the solutions and ideas in this article can help you solve problems that you face, and can help you protect your client’s time and budget.