ERP integrations and order automation
How to synchronise ecommerce and ERP order statuses without update loops
A webshop says an order is processing, the ERP says it is open, and the warehouse says part of it has shipped. Copying one label into every system does not resolve that difference. It can create loops, overwrite newer work or tell a customer that an order is complete when only one business step finished. Before development, define a small order-state contract that states what each status means, which system owns each change and how conflicts are resolved.
By SVS Digital · Published
Start here
Do not synchronise one generic status in both directions. Separate at least payment, fulfilment, ERP processing, cancellation and return or refund state. Give each field one authoritative source, map only approved transitions and store both systems' order IDs. Every update should carry its origin and observed version so the receiving system does not echo it back or overwrite a newer change. Treat events as triggers, not guaranteed truth: read current state when needed, reconcile orders on a schedule and route impossible or ambiguous transitions to a person.
1. Separate payment, fulfilment and order lifecycle
Begin with the business facts your team needs, not the labels available in one product. An order can be paid but not shipped, partly shipped while still open, cancelled before capture, or refunded after fulfilment. Record these as separate dimensions. A single value such as complete cannot safely express all of them.
Shopify's official orders query exposes financial status separately from fulfilment status and also distinguishes open, closed and cancelled orders. WooCommerce uses its own workflow: Processing normally means payment was received and stock reduced while fulfilment still waits; On hold can mean payment confirmation is pending. These are platform semantics, not a universal vocabulary.
- Payment state and the event that proves it.
- Fulfilment state, including partial shipment.
- ERP processing or review state.
- Cancellation, return and refund as distinct facts.
2. Give each state and identifier one owner
Create a table with one row per field: webshop order ID, ERP order ID, payment state, fulfilment state, customer-visible status, cancellation request and refund state. For each row name the source of truth, systems allowed to propose a change, systems allowed to confirm it and what evidence makes the transition valid. Two-way synchronisation should mean coordinated ownership, not that both systems may overwrite every field.
Business Central's documented salesOrder resource has its own ID, external document number, status, fullyShipped value and lastModifiedDateTime. Its documented status values include Draft, In Review and Open. Preserve both identifiers and translate business meaning deliberately; do not assume that ERP Open equals webshop Processing or that fullyShipped means paid.
- Permanent source and destination order IDs.
- Authoritative system for every synchronised field.
- Customer-facing label derived from verified facts.
- Named owner for a state that cannot be mapped.
3. Write a transition matrix before mapping fields
For every allowed change, record current state, triggering event, required conditions, destination change and reversal or compensation path. For example: a verified payment may permit ERP order release; warehouse confirmation may change fulfilment from unfulfilled to partial; final shipped quantity may permit fulfilled. A customer cancellation request should not automatically cancel an order that has already entered picking.
Include forbidden transitions. Refunded should not imply restocked unless the return was received and accepted. Cancelled should not imply money returned. WooCommerce explicitly notes that a manual refund can set a refunded status without proving the customer's funds were returned, and that failed or cancelled states can affect stock. Your mapping must reflect the actual payment, warehouse and ERP process.
- Current state and exact triggering evidence.
- Required preconditions and responsible system.
- Result in each connected system.
- Forbidden, reversible and manual-review transitions.
4. Prevent echo loops, duplicates and stale overwrites
Store an integration record for each accepted change: source system, source event ID, order IDs, field, old and new value, source time, observed version and destination result. When the destination emits its own update, compare that record before sending anything back. A repeated event should return the previous result; it must not create a new order or repeat a state change.
Do not use the most recently received message as proof of the latest business state. Shopify says webhook order is not guaranteed and recommends timestamps, duplicate handling and periodic reconciliation. Business Central's update method uses an If-Match header with an eTag so a mismatched version prevents an update. Apply the same principle even where a product lacks eTags: read the current record and stop or re-evaluate when it changed after your decision.
- Origin marker and durable event or operation ID.
- Idempotent handling of retries and duplicate events.
- Version or last-modified check before writing.
- No automatic echo of a change back to its source.
5. Make conflicts visible and reconcile current state
An exception record should explain the conflict in business terms: order 1048 is marked cancelled in the store, but the ERP reports a shipped quantity; payment is refunded, but the warehouse has no accepted return; the ERP order changed after the integration read it. Show the source values, timestamps, attempted transition and safe next actions. Do not hide the problem behind a generic sync failed message.
Run reconciliation independently from events. Select orders changed since the last successful checkpoint, compare the owned fields and repair only differences with an unambiguous permitted transition. Report missing mappings, stale orders and unresolved conflicts. Reconciliation is not a second writer with broader authority; it follows the same state contract and review rules.
- Queue with source values, times and attempted action.
- Checkpointed comparison of recently changed orders.
- Safe repair rules separated from human decisions.
- Owner and response target for unresolved exceptions.
6. Pilot the complete lifecycle, including failure
Test a normal paid order, payment delay, payment failure, partial shipment, final shipment, cancellation before and after picking, address change, return, partial refund, duplicate event, out-of-order event, ERP outage and concurrent employee edit. Verify the customer view, stock effects, warehouse task, ERP state and audit trail for each case. Start with one store, one ERP company and a bounded order type.
An integration cannot repair unclear fulfilment, payment or return policy. APIs, writable fields, event delivery, licences and status meanings vary by platform and version. Confirm them against the actual systems and test environment. Launch only when the process owner accepts the transition matrix, exception queue, reconciliation report and manual fallback; expand channels or automation after the first flow stays understandable in daily work.
- Expected result for normal and exceptional lifecycle cases.
- Verified permissions and interfaces in the actual system versions.
- Manual fallback during an outage or conflict.
- Accepted state contract, monitoring and support ownership.

