Skip to content

Online store and ERP integration: orders, stock and prices without retyping

B2Bnetwork team · · 8 min

Integrations, data and cloud

In brief

A store and ERP integration works when every piece of data has one source of truth: orders and customers are created in the store, while stock, base prices, documents and invoices live in the ERP. An order reaches the ERP once, carrying the store's order number, which blocks duplicates. The store shows available stock (warehouse stock minus reservations and a safety buffer), not the raw ERP figure. Prices flow from the ERP with their history, because a discount must show the lowest price from the previous 30 days.

What flows in which direction

Most arguments in these projects start because nobody wrote down which system decides a given piece of information. Before the first line of code, fill in a table like the one below and get sales, logistics and accounting to sign it off.

DataDirectionSource of truthTypical frequency
Item master (SKU, EAN, unit, VAT rate)ERP → storeERPon change
Descriptions, images, categoriescontent system or storestoremanual
Available stockERP or warehouse system → storeERP or WMSafter every movement or every few minutes
Base price and B2B price listsERP → storeERPon change
Promotions and discount codesstore → ERP (on the order)storeper order
Order and customerstore → ERPstoreright after payment or placement
Status, tracking numberERP or WMS → storeERP or WMSon change
Invoice, credit noteERP → store (file for the customer)ERPwhen issued

Do not keep descriptions and images in the ERP just because the item master lives there. An ERP is not a content system, and fixing a product description should not require the team that maintains master data. General patterns for connecting systems to an ERP are covered in ERP integration: patterns and pitfalls.

Orders: from cart to ERP document

An order goes through several steps, and each one has its own trap.

  1. Placement and payment. Decide when the order goes to the ERP: right after placement or only after payment. With prepaid orders, sending unpaid ones creates ERP documents that later have to be cancelled.
  2. Handover to the ERP. The message carries the store's order number. The ERP or the integration layer rejects a second message with the same number, so a retry after a timeout does not create a second order. This is the idempotent receiver pattern.
  3. Customer. A retail customer often needs no master record in the ERP; a collective account and the details on the document are enough. A business customer with a tax ID needs a record, because they get an invoice, and since 2026 invoices to Polish businesses are issued in KSeF, Poland's national e-invoicing system (the largest taxpayers from February 1, everyone else from April 1). Invoices to consumers can stay outside KSeF.
  4. Reservation and shipping. The ERP reserves the goods and passes the order to the warehouse. The store gets the status and tracking number back.
  5. Invoice. The ERP issues the invoice and the store shows it in the customer's account. How to connect the ERP to KSeF is described in KSeF integration with ERP and document workflow.

An order the ERP rejects (unknown SKU, blocked customer, wrong VAT rate) must not disappear. It lands in an error queue with the reason, and someone from order handling fixes the data and resends it.

Stock: how not to sell what you do not have

A store that shows ERP warehouse stock directly will sooner or later sell the last unit twice. Available stock is calculated like this:

available stock = warehouse stock − reservations for open orders − safety buffer

A worked example: the warehouse holds 12 units, 7 are reserved for orders waiting to be picked, and the buffer for an item that also sells in a physical shop is 3. The store shows 2 units. If synchronization runs every 15 minutes and the item sells a dozen times an hour during a promotion, the buffer has to be larger or stock has to flow after every movement.

Two rules save the most complaints:

  • The store reserves on its side immediately when an order is placed, without waiting for the ERP to accept the document. Otherwise, in the gap between cart and ERP, the same unit goes to several customers.
  • Stock flows as an event after every movement, and a full comparison of all SKUs once a day corrects the differences the events missed. With several sales channels, the same stock is shared between the store and marketplaces, as described in the case study on integrating a store with marketplaces and a warehouse system.

Prices and promotions

Base prices and business customer price lists are created in the ERP, because that is where margin and contract discounts are calculated. Promotions, discount codes and free shipping usually come from the store. The order sent to the ERP therefore has to carry the price before discount, the discount and the price after it, or the ERP margin report will show sales below list price with no explanation.

When you cut a price for consumers in the EU, you must show the lowest price from the 30 days before the reduction. This is a requirement of the Omnibus Directive, so someone has to keep a price history. If the price comes from the ERP and the promotion from the store, the history has to combine both, because neither source alone knows the price the customer actually saw.

The second trap is rounding. A store usually calculates from the gross price and an ERP from the net price. Under Polish VAT rules an invoice can calculate VAT from the net total or from the gross total, but the store and the ERP must do it the same way. Otherwise, on an order with a dozen lines, the ERP total differs from the amount paid by a few cents, and every such difference comes back to accounting as an underpayment.

Returns, credit notes and the daily reconciliation

A return starts in the store (the customer's form), passes through the warehouse (receiving and inspecting the goods) and ends in the ERP (credit note, refund). Each step changes stock, so returned goods should go back into available stock only after inspection, not at the moment the return is requested.

Once a day, compare three figures: the count and value of orders in the store, in the ERP, and the payouts from the payment provider. A difference points to an order that was lost, duplicated, or paid but never passed on. Stock differences between the ERP, the warehouse and the store are compiled daily by the Stock level checker, an AI Worker from DYNAMINDS Labs, while a person approves any correction in the ERP. The causes of such differences are covered in Stock discrepancies.

Where to start the integration project

  • Write the table of flows and sources of truth from the first section.
  • Clean up master data: every item in the store has an ERP SKU, a unit and a VAT rate.
  • Start with orders and stock, because they take most of people's time today; connect prices and returns in the second step.
  • Build the error queue and the daily reconciliation before you switch on traffic from the whole store.
  • Test the peak: a promotion where orders arrive several times faster than usual.

B2Bnetwork engineers design and build these connections as part of our System integration service: from the flow map, through the integration with contract tests, to monitoring that raises an alert when messages stop flowing.

Questions and answers

Should the store connect to the ERP directly or through a middle layer?

With one store and a simple ERP, a direct connection through the vendor's API is enough. Once marketplaces, a second warehouse or a logistics operator join, a middle layer with a queue and one order model saves work: each channel connects to it rather than to the ERP. Never write data directly into ERP tables.

How often should stock levels be synchronized?

As often as the goods sell. With a few orders a day, synchronizing every 15 minutes or so with a buffer is enough. With promotions and many channels, stock should flow after every movement, and a full daily comparison corrects lost changes. Always reserve in the store immediately when an order is placed.

How long does a store and ERP integration take?

It depends mainly on the state of master data and the ERP's interfaces. When the ERP has a documented API and the SKUs in the store and ERP match, orders and stock can be connected in a few weeks. What takes longest is cleaning data and agreeing rules for exceptions: returns, credit notes, bundles and goods sold by weight.

Do invoices from the store have to go through KSeF?

For a Polish company, invoices to businesses do and invoices to consumers can stay outside KSeF. A store that sells to both groups must recognize a buyer with a tax ID and issue their invoice through KSeF, ideally from the ERP, which already handles sales. Deadlines and exceptions are published by the Polish Ministry of Finance on its KSeF website.

What it looks like in a project

Connecting systems or moving them to the cloud? Talk to an architect.

Let's talk

Read more: Integrations, data and cloud

All in Integrations, data and cloud →