← Blog

Sync ecommerce orders to ERP: what to build and what it costs

For e-commerce and operations managers who retype orders or chase stock mismatches: the flows to build, how to choose a connector, middleware or custom API, and what it costs.

Get a summary withChatGPT Claude Google AI Mode
Ledger lines and warehouse shelves joined by a chartreuse thread, showing how to sync ecommerce orders to ERP
On this page

If your team retypes web orders into the ERP, or learns on Monday that Saturday's best seller was already sold out, this guide is for you. By the end you will know what to build, in which order, and what drives the price.

The short answer: to sync ecommerce orders to ERP, you build four flows (orders out, stock and prices back, customers, returns), match your SKUs first, then choose a native connector, middleware or a custom API by volume and by how many rules your ERP holds. Testing and monitoring belong to the build.

This guide stays on orders and stock and works for any platform, with notes for Shopify and WooCommerce. Customer pricing and automatic quotes have their own guide: how to connect an online store to an ERP and automate quotes.

Key takeaways

  • A paid order can reach your ERP within minutes with no retyping, and available stock can return to the store before it oversells.
  • Four flows cover almost every store: orders out, stock and prices back, customers, and returns.
  • Matching SKUs, tax codes and warehouses comes first, and you can start that work this week.
  • Order volume and the rules inside your ERP decide between a native connector, middleware and a custom API.
  • Retries, a failed-orders list and a daily reconciliation are part of the build, so no order disappears quietly.

Sync ecommerce orders to ERP: the short answer

A working sync puts a paid order in the ERP within minutes, with the right customer, items, taxes and shipping method. Then the ERP sends back the stock number and the store shows it. Nobody touches a keyboard.

One honest note before the detail. If you ship ten orders a week, retyping may cost less than a build. A native connector or a scheduled file import may be the right answer for you.

What the sync does for your team

Three things change from the first day:

  • Orders arrive in the ERP as sales orders, ready to pick, invoice and ship.
  • Available stock in the store follows the warehouse, so you stop selling what you do not have.
  • Status and tracking numbers reach the customer without anyone copying them across.

The saving is easy to size in your own week. Count the orders you retype, multiply by the minutes each takes, and add the refunds you issue for items sold but never in stock. That total is what the sync has to beat.

Chartreuse thread linking ledger sheets and a shelf edge with marks that line up, a store and warehouse in agreement
Store and warehouse agreeing without retyping

Who can build it for you

Four kinds of team build these syncs, and each fits a different starting point:

  • An ERP partner knows your ERP's data model. It fits when the hard part is inside the ERP and the store is simple.
  • An ecommerce agency knows the store, the checkout and the platform APIs. It fits when the store side carries the complexity.
  • An integration specialist builds on middleware such as n8n and maintains the workflows.
  • Your own developer fits when someone has time to keep it running for years.

The right fit reads both APIs, the ERP's and the store's, and stays after launch. At werun.dev we read your ERP documentation and your store setup first, so you hear what is feasible before any quote. Our ecommerce integrations service covers both sides.

The four flows between store and ERP

List every piece of data that crosses between the two systems and the project scopes itself. Four flows cover almost every store.

Store and ERP flows

  1. 01Paid orderStore to ERP: No retyping
  2. 02Available stockERP to store: No overselling
  3. 03Price changesERP to store: One price list
  4. 04Customers and returnsBoth ways: Records match

Two-way map showing orders travelling from the store to the ERP, and stock, prices, customers and returns moving between them

The four flows between your store and your ERP

Orders to the ERP: from paid to picked

The order flow starts when payment succeeds, not when the cart is created. The ERP creates a sales order and answers with its own order number. That number goes back onto the store order, so support can search from either side.

Decide when an order moves: on payment, or only after a fraud review. Send discounts, shipping, tax and payment status as separate fields, because finance reconciles from them. Shopify exposes orders through its Admin GraphQL API (opens in a new tab), and WooCommerce through its REST API (opens in a new tab). Our WooCommerce ERP service builds on it.

Stock and prices back to the store

This flow stops overselling. The ERP owns stock, so it sends available quantity: on hand minus what open orders have reserved.

Send the total, never the change. If a retry delivers "minus 2" twice, the store is wrong. If it delivers "available: 14" twice, the store is still right.

A small buffer helps. For example, hold back two units on fast movers to cover the minutes between a sale and the next sync. Prices follow the same path when the ERP owns price lists, so pick one owner per field. For Shopify drift in particular, see how to fix Shopify inventory sync.

Customers and returns

Match customers by email or tax ID, so a returning buyer never becomes a duplicate account. B2B accounts usually exist in the ERP already, so the sync links to them instead of creating new ones. If a CRM also needs the customer, this guide to Shopify CRM integration covers the hiring side.

Refunds travel to the ERP as credit notes or return orders. A partial refund needs the line and the quantity, not only the amount. Decide early whether a refund restocks the item at once or waits for the warehouse to inspect it.

Webhooks, polling and failed calls

The store can tell the ERP when something happens, or your integration can ask on a timer. Most projects use both.

When a webhook beats polling

A webhook is a message the store sends the moment an event happens, such as an order paid. It arrives in seconds and costs nothing while the shop is quiet. Shopify's webhook documentation (opens in a new tab) describes delivery, and WooCommerce can send webhooks too.

Polling asks "anything new?" every few minutes. It suits ERPs that can answer questions but cannot call out, which is common. So orders usually travel by webhook, and stock from the ERP arrives by polling.

MethodHow it worksSpeedBest for
WebhookThe store sends a message on each eventSecondsOrders and refunds
PollingThe integration asks on a timerMinutes, set by the timerStock and prices from an ERP that cannot call out
BothWebhook first, slow poll as a backstopSeconds, with a safety netMost projects

How fast must stock sync? For slow movers, every 15 minutes is usually fine. For items that sell out in a day, push the number after every sale. Webhooks can arrive twice, late or not at all, so a slow poll runs behind them as a safety net.

Retries without duplicate orders

A retry is a second attempt after a failure. The danger is posting the same order twice. The fix is an idempotency key: the store's order ID travels with every attempt, and the integration or the ERP refuses a second sales order with the same reference.

Wait times grow between attempts (for example 1 minute, then 5, then 30), so an ERP that is down is not hammered. Check the signature first, so only your store can create orders. This Node.js function verifies the signature Shopify sends with each webhook:

import crypto from "node:crypto";

// rawBody is the unparsed request body; hmacHeader is the X-Shopify-Hmac-Sha256 header
export function isValidShopifyWebhook(rawBody, hmacHeader, secret) {
  const digest = crypto
    .createHmac("sha256", secret)
    .update(rawBody, "utf8")
    .digest("base64");
  const expected = Buffer.from(digest);
  const received = Buffer.from(hmacHeader || "");
  return (
    expected.length === received.length &&
    crypto.timingSafeEqual(expected, received)
  );
}

Failed order path

  1. 01Store order eventOrder paid, webhook arrives
  2. 02QueueHeld safely until it is processed
  3. 03Try to post to ERPOrder ID travels as the key
  • ASuccessThe ERP accepts the sales order
    1. DoneOne order, one record
  • BFailureERP is down or slow
    1. Retry, longer waitThen back to the ERP call
  • CLast retry failedAutomatic attempts are used up
    1. Failed-orders listNothing is lost or hidden
    2. Alert to named ownerA person knows the same day

Failure-handling path where an order event is retried with growing waits and then moves to a failed-orders list with an alert

What happens to an order that cannot post at first try

What to do with orders the ERP rejects

Some orders never post however often you retry: an unknown SKU, a missing tax code, a closed customer account. Those stop retrying, move to a failed-orders list and alert someone.

One rule

Every order that fails to post lands in a failed-orders list that a named person owns. An order must never disappear without someone being told.

Each row on that list shows the order number, the ERP's reason in plain words and a replay button. Fix the cause once, replay the order once, and the idempotency key prevents a duplicate.

Match SKUs and IDs before you connect

Many sync problems trace back to data that looks the same in both systems and is not. A mapping exercise finds them before they cost you an order.

One key for every product and variant

Pick one key per sellable item and make it identical in both systems. The SKU is the usual choice. Stores hold a shirt with three sizes as one product with variants, while the ERP often holds each size as its own item. The sync must map one variant to one ERP item.

Export both catalogues and compare them. These are the usual culprits:

  • Blank SKUs on older products.
  • Spaces or capital letters that differ between systems.
  • Leading zeros dropped by a spreadsheet.
  • The same SKU on two products.
  • Bundles the store sells as one item and the ERP sees as several components.

Keep the store's internal product IDs in a mapping table as well. They never change when someone edits a SKU. Also decide what happens when a new variant is created in the ERP: it is added to the store automatically, or it waits for approval.

Warehouses, taxes and payment methods

Four more lists need a translation table: warehouses, tax codes, shipping methods and payment methods. Each store value must point to exactly one ERP value. The values below are examples.

Store valueERP valueWhy it matters
Main warehouseLocation WH01Stock is read from the right shelf
VAT 21%Tax code IVA21Invoices carry the correct tax
Express shippingCarrier service EXPThe warehouse prints the right label
Card paymentBank account CARDFinance reconciles payments

Fill this table with the ERP's finance person beside you, since a wrong tax code is found at month end, not at checkout.

Native connector, middleware or custom API

Five questions decide the approach: how many orders a day, how many variants, how many rules live in the ERP, how many systems connect, and who maintains it afterwards. The comparison below summarises the three options.

Option A

Native connector

  • Flows: usually orders and stock, with fixed mapping
  • Rules: few, set by the vendor
  • Maintained by: the connector vendor
  • Best for: standard processes and lower volume

Our pick for a typical mid-sized store

Middleware such as n8n

  • Flows: all four, mapped as you need
  • Rules: added as workflow steps
  • Maintained by: you or your agency
  • Best for: mid-sized volume, a few systems, rules that change

Option C

Custom API integration

  • Flows: any, including older ERP protocols
  • Rules: unlimited, written in code
  • Maintained by: your developers or your agency, code yours
  • Best for: very high volume or complex rules

The highlighted column fits a typical mid-sized store. A simple rule applies: start with the cheapest option that covers all four flows, and move up only when a rule or the volume forces you. Moving later costs less than overbuilding now, because the mapping work carries over.

When a native connector is enough

If your ERP vendor or your platform's marketplace offers a connector for your exact pair, and your process is standard, buy it. It is the cheapest and fastest route. Check that it sends stock back, handles partial refunds and maps variants. If it does all three, you may not need a custom build at all.

When middleware such as n8n fits

Middleware is a layer between the store and the ERP with workflows you can read on screen. An n8n workflow receives the webhook, maps the fields, calls the ERP API, retries and alerts. It suits mid-sized volume, two or three connected systems and rules that change often, such as holding orders over a set value for approval. You own the workflows, and someone must maintain them.

When a custom API integration pays off

Custom code earns its cost at very high volume, with complex rules such as multi-warehouse allocation or contract pricing, or when the ERP speaks an older protocol. It runs faster, is tested like software and is yours, repository included. Where the ERP is old, this guide to API and legacy system integrations explains the options.

Mixed setups are common: middleware for most flows and a small custom service for the one rule that is hard.

What it costs to sync ecommerce orders to ERP

We do not quote from a table, because the same two systems can need a few weeks or a few months depending on the ERP. What follows shows what moves the price, so you can read any quote you receive.

What moves the price

  • The ERP's API: a documented REST API is quick, while file drops or older protocols take longer.
  • The number of flows: orders only, or all four.
  • Custom rules: approvals, allocation across warehouses, contract pricing.
  • Volume and variants: more products and more orders need more care in queues and mapping.
  • Stores, warehouses and currencies: each one multiplies the mapping and the tests.
  • Testing: a test company in the ERP saves days, and its absence costs them.

For example (illustrative), a store with 3,000 SKUs, one warehouse and a modern ERP API is a mid-sized job: the orders and stock flows, a mapping table and tests. Add a second warehouse and B2B price lists, and the work grows in rules and testing, not in connecting.

By approach, a native connector is mostly a subscription, middleware is a build fee plus small hosting, and a custom integration is the largest build with the lowest cost per order at scale.

A typical timeline from kickoff to go live

These phases are illustrative for a mid-sized project. The ERP's API sets the real pace.

  1. Weeks 1 to 2

    Scoping and mapping

    You and the team read the ERP API, map every field and agree what each flow does.

  2. Weeks 3 to 5

    Orders flow

    Paid orders post to the ERP with retries, the failed-orders list and alerts.

  3. Weeks 5 to 7

    Stock and prices flow

    Available stock and agreed prices reach the store on their schedule.

  4. Weeks 7 to 9

    Testing and parallel run

    Messy test orders run on a copy, then the sync runs beside your manual process.

  5. Week 10 onward

    Go live and first month

    Real orders flow, and the first month of monitoring settles the edge cases.

Running costs after launch

After go live, four costs remain: hosting for the middleware or service, any API fee the ERP vendor charges, time to answer alerts, and updates when a platform changes its API. Shopify, for one, releases new API versions regularly, so someone must check each one.

At werun.dev a monthly Care plan or Retainer covers this, and the monthly report shows what the sync did.

A test plan before go live

Real orders are messy, so test with messy ones. Use a copy of the store and a test company in the ERP, so no customer meets the first version.

Scenarios to run on a copy first

Run these eight scenarios and write down the result of each:

  • Split shipment: one order leaves the warehouse in two parcels
  • Partial refund of one line, with and without restocking
  • Discount code and free shipping, with totals matching to the cent
  • Out-of-stock race: two buyers, one last unit
  • ERP offline for an hour while orders keep arriving
  • The same webhook delivered twice for one order
  • A new variant created in the ERP that does not exist in the store
  • An order with an unknown SKU, which must reach the failed list with an alert

The out-of-stock race deserves care. Two buyers order the last unit in the same minute. Decide who gets it, and what the second buyer sees.

Discount codes and taxes cause the quiet errors. Compare the ERP's total with the store's total on every test order. A one-cent rounding gap multiplies across hundreds of orders.

A parallel run before the switch

Run the sync beside your manual process for one or two weeks (typical). Staff keep entering orders as usual while the integration posts to the test company. Compare daily: order count, totals and tax.

When every difference is explained, switch. Keep a way back: turn off the webhook and return to manual entry for a day if needed.

Monitoring and alerts that keep it honest

A sync that works on launch day can drift later: an API key expires, a new SKU appears in the ERP, a platform updates. Monitoring means you hear about it before a customer does.

The alerts worth setting up

  • An order failed after its last retry, sent to the person who owns the failed list.
  • No order posted for several hours of business time, which catches a silent break.
  • The ERP answers with errors or very slowly.
  • A stock update failed or did not arrive.
  • A credential, such as an API key, is about to expire.

Send alerts where your team already looks, and name an owner for each. An alert to a shared inbox is read by nobody.

A daily reconciliation of stock and orders

Once a night, a job compares paid orders in the store with sales orders in the ERP, by count and total. It also compares stock per SKU. Small stock differences correct themselves with the ERP winning, and missing orders go to the failed list.

The result is one page you read in a minute, and a monthly report that shows orders synced, failures and time to fix.

Where to start this week

Export 20 recent orders from your store and map every field to the ERP. Include a refund, a discount code, an order with several items and, if you sell abroad, an overseas order.

  1. For each field, write which ERP field receives it, and mark a gap where none exists.
  2. Export both catalogues and compare the SKUs.
  3. Write down who owns the failed-orders list.

The gaps in that sheet are your scope, and they make any quote precise. If the sheet shows no gaps and a native connector covers your case, buy the connector.

If the gaps are there, tell us your goal on the ecommerce integrations page. A person you can name answers within 2 hours on business days, and you follow the build in the Client Portal.

Frequently asked questions

Who can connect my online store to our ERP so orders and stock update automatically?

An ecommerce agency that reads both APIs, an ERP partner, an integration specialist using middleware such as n8n, or your own developer. Choose the team that has worked with your ERP's API and will maintain the sync after launch.

How much does it cost to integrate an ecommerce store with an ERP?

The price depends on the ERP's API quality, the number of flows, custom rules, order volume and testing. A native connector is mostly a subscription, middleware is a build plus small hosting, and a custom integration is the largest build. Ask for a written quote after the team has read your ERP documentation.

How long does an ERP integration for an online store take?

For a mid-sized store with a documented ERP API, a project typically runs a couple of months from kickoff to go live, including a parallel run. A native connector can be live in days, and an older ERP without a modern API takes longer.

Should I use a native connector, middleware or a custom API integration?

Use a native connector when it covers orders, stock, variants and partial refunds for your exact systems. Choose middleware such as n8n for mid-sized volume and rules that change, and a custom API integration for very high volume, complex rules or an older ERP protocol.

How do I stop overselling when stock lives in the ERP?

Have the ERP send available quantity (on hand minus reserved) as a total, never as a change. Add a small buffer on fast movers, push the number after every sale for items that sell out quickly, and reconcile stock nightly.

What happens to orders if the ERP is down when they come in?

The store keeps taking orders and the integration retries them with growing waits until the ERP answers. An order the ERP rejects moves to a failed-orders list and alerts a named person, who fixes it and replays it once without creating a duplicate.

Running into this on your own stack?

Tell us the platform and the problem. We'll tell you what it takes and who does it.

Start a conversation No commitment. Just a conversation.