Skip to content

ERP Integration Patterns

intermediate
📜Corecommerce

Commerce handles the customer-facing transaction, but the business runs on ERP. Inventory levels, customer credit limits, contract pricing, order fulfillment, invoicing, and financial reporting all live in systems like SAP, Microsoft Dynamics, Oracle, or NetSuite. Without integration, your storefront and your back office operate on different versions of the truth. Customers see stale inventory. Orders require manual re-entry. Pricing drifts between systems.

Optimizely Commerce provides event-driven and API-based integration points designed for ERP connectivity. The challenge is not whether to integrate, but how — and the pattern you choose determines your data freshness, system resilience, and operational complexity.

Integration is bidirectional. Some data originates in the ERP and flows into Commerce. Other data originates in Commerce and flows back.

DataSource of truthDirection
Product master dataERPERP to Commerce
Inventory levelsERP / WarehouseERP to Commerce
Contract pricingERPERP to Commerce
Customer accountsERP (often)ERP to Commerce
OrdersCommerceCommerce to ERP
Payment statusCommerceCommerce to ERP
Shipment trackingERP / 3PLERP to Commerce
Returns / CreditsBothBidirectional

Identifying the source of truth for each data type is the first and most important step in integration design. When two systems both believe they own the same data, conflicts are inevitable.

The two fundamental integration approaches offer different trade-offs.

Commerce publishes events (order placed, payment captured, return requested) that trigger immediate sync to the ERP. The ERP can also push changes (inventory updated, price changed) to Commerce through webhooks or API calls.

Advantages:

  • Customers see current inventory and pricing
  • Orders appear in ERP within seconds
  • Problems surface immediately

Disadvantages:

  • Requires both systems to be available simultaneously
  • Network latency affects storefront performance if sync is inline
  • High-volume spikes can overwhelm the receiving system

A scheduled job collects changes since the last run and syncs them in bulk. Batch jobs might run every 5 minutes, every hour, or overnight depending on the data type.

Advantages:

  • Tolerates temporary system outages
  • Handles high volumes efficiently
  • Does not affect storefront performance

Disadvantages:

  • Data staleness — inventory shown to the customer may not reflect the latest warehouse state
  • Larger error batches to diagnose when something fails
  • Delayed order visibility in ERP

Most production integrations use both patterns. Orders sync in real-time because timely fulfillment matters. Inventory syncs in near-real-time batches (every 5-15 minutes) to balance freshness with performance. Product master data syncs in nightly batches because it changes infrequently.

Data typeRecommended patternTypical frequency
OrdersReal-time eventImmediate on order completion
InventoryNear-real-time batchEvery 5-15 minutes
PricingScheduled batchHourly or on-demand
Product dataScheduled batchNightly or on catalog publish
Customer dataEvent-driven or batchOn account creation or nightly

When two systems modify the same data, conflicts arise. A customer updates their address in Commerce while a service agent updates it in the ERP. Which change wins?

Common conflict resolution strategies:

Last-write-wins. The most recent change overwrites the other. Simple but dangerous — you can lose intentional changes.

Source-of-truth-wins. The designated source of truth always overwrites the other system. If the ERP owns customer data, Commerce changes are treated as suggestions that get overwritten on the next sync.

Merge with review. Conflicting changes are flagged for manual review. A queue of conflicts lets an operator decide which change to keep. This is the safest approach but adds operational overhead.

Field-level resolution. Different fields have different owners. The ERP owns the billing address. Commerce owns marketing preferences. Changes to each field follow its owner’s authority.

Commerce and ERP systems rarely use the same data structures. A Commerce “variant” maps to an ERP “SKU item.” A Commerce “order” maps to an ERP “sales order” with different field names, required fields, and validation rules.

Data mapping involves:

  • Field mapping — Which Commerce field corresponds to which ERP field
  • Value transformation — Converting between data formats (dates, currencies, units of measure)
  • Default values — Filling in ERP-required fields that Commerce does not capture
  • Validation — Ensuring mapped data meets the target system’s constraints before sending

Place mapping logic in a dedicated integration layer — not in Commerce and not in the ERP. This middleware (whether a custom service, an integration platform like MuleSoft or Azure Logic Apps, or a message queue) handles:

  • Receiving events or pulling batch data from Commerce
  • Transforming data to the ERP’s expected format
  • Delivering data to the ERP
  • Handling errors, retries, and dead-letter queues
  • Logging all sync activity for auditing

This separation means changes to the ERP schema do not require Commerce deployments, and vice versa.

ERP integrations fail. Networks go down. ERP systems have maintenance windows. Commerce must continue operating when the ERP is unavailable.

Design principles for resilient integration:

  • Queue-based delivery — Use message queues between Commerce and ERP so orders are not lost during ERP downtime
  • Retry with backoff — Failed sync attempts retry with increasing delays rather than hammering the unavailable system
  • Dead-letter handling — Messages that fail after all retries go to a dead-letter queue for manual investigation
  • Circuit breaker — If the ERP is consistently failing, stop sending requests and alert operations rather than queuing up thousands of failed attempts
  • Compensating transactions — If an order syncs to the ERP but the ERP rejects it, Commerce needs a process to handle the rejected order (cancel, hold for review, or retry with corrections)

Integration health requires active monitoring. Track these metrics:

  • Sync latency — Time between a Commerce event and its appearance in the ERP
  • Error rate — Percentage of sync attempts that fail
  • Queue depth — Number of unprocessed messages waiting for sync
  • Data freshness — Age of the last successful sync per data type

Set alerts on thresholds. A queue depth that grows steadily indicates the ERP cannot keep up. A spike in error rate might signal a schema change or network issue.