Child pages
  • ERP Integration - Orders
Skip to end of metadata
Go to start of metadata

The Magento ERP integration supports both importing new Orders to the ERP system and also to update Order statuses back from ERP to Magento. This is achieved by letting the ERP-supplier call for (a list of) New Orders from Magento using a JSON request, and afterwards fetching new Orders into the ERP system one by one.

Here you will find the necessary details on how to Export orders (from Magento) and also how to Update order statuses back to Magento.

There are three requests that should be implemented:

Get list of new Orders from Magento

The request will give a list of all new orders from Magento that are ready to be imported into the ERP-system (i.e. that are not yet marked as exported, which our Magento module will take care of).

The request is a simple and easy JSON format.

URL to call:

Example of response




Get specific Order from Magento

There will be created one single XML (file/response) per Magento Order.

URL to call:[id]

XML format of the Order in the response


<?xml version="1.0" encoding="UTF-8"?>
    <shipping_description>Bring - Brev (A-Prioritert)</shipping_description>
    <created_at>2012-08-22 10:41:15</created_at>
    <street>Andregata 2</street>
    <street>Andregata 2</street>
      <name>Potetskreller med motor</name>


Note on <line_no> field


This field is unique for the whole site, so the <line_no>1</line_no> will appear only once.

However, there are some special line number that might appear several times.

Line no
0Indicates that this is an extra fee of some sort, can be invoice fee, handling fee, or other extra cost.
-1Indicates that this line is a custom option that refers to the previous order line.


Order update from ERP to Magento

The integration supports sending back Order updates from the ERP system to Magento, so that the Magento Order can be set to Completed once ERP has packed and shipped the items.

When Magento gets an order update from the ERP system, it will create a standard Magento Shipment and also capture the payment for the lines supplied in the update. Based on the "Order_status", it will either cancel any undelivered items on the Order and finish it, or keep the Order open for later deliveries (part deliveries).

Each Order Update POST must include only one Order.

Tracking_number is optional.

URL to POST to:

XML format of the Order Update file


<?xml version="1.0" encoding="UTF-8"?>
    <Order_status>Completely Shipped</Order_status>


How to handle order update when the item number (SKU) has been changed

There are two ways to handle this, both supporting capture of the original item.

Alternative 1 (recommended)

Include the unique <Line_no> per row which was sent in the original Order Import from Magento to the ERP system.

Alternative 2

Send the original SKU in a new <Sku2></Sku2> field (in the Order Update file), and include the NEW SKU (replacement SKU) in the <Sku></Sku> field.

The "Order_status" can have one of the following statuses

Order status
Partially ShippedMagento will create a shipment for the items specified. If there are remaining items in the order, they will be kept for later delivery. If all items are delivered the order will be closed.
Completely ShippedMagento will create a shipment for the items specified. If there are remaining items in the order, they will be cancelled and the order will be closed.

The response from Order Updates can be either XML or JSON

OKEverything went OK. The message tag will contain "Order processed"
ErrorSomething went wrong. The message tag will contain a message about what went wrong.

XML example


<?xml version="1.0"?>
    <message>Order processed</message>


XML Error example


<?xml version="1.0"?>
    <message>InvoiceAPI: Invalid qty to invoice item "Kult produkt" (100000249)</message>


JSON example


{"code":"OK","message":"Order processed"}
  • No labels