How do you connect B2B ecommerce, ERP and PIM in a MACH architecture?

In B2B the slowest delays rarely come from the buy button colour; they come from ERP and storefront drift: price, credit limit and lead time disagree. MACH pays off when those rules are explicit in APIs and logs, not in inbox threads.
Why does B2B break a simple SaaS shop?
Manufacturers and distributors need multiple price lists, conditional rebates, credit limits, multi-step order approvals and often split fulfilment. Retail-first SaaS templates rarely encode the legal and finance rules living in ERP.
MACH lets you isolate a policy layer (NestJS, coded rules or a rules service) from the Next.js storefront so a rule change does not force a full frontend rewrite.
Where is the system of record for price and stock in MACH?
A common pattern: ERP or PIM owns the golden SKU record, MedusaJS v2 owns carts, orders and channel promos, Redis shields ERP from a hit on every catalogue refresh.
You must define which source wins when ERP and Medusa disagree during checkout. Without a clear precedence order you get Friday-afternoon sales escalations.
How do you design API-first ERP integrations (Comarch, SAP)?
Instead of wiring the storefront straight to ERP, we add an adapter in Node.js/NestJS with a queue (RabbitMQ, SQS) and idempotent workers. ERP outages pause sync with a controlled user message instead of taking the shop down.
At GMI Software we document JSON contracts (OpenAPI or AsyncAPI), rate limits and retry scenarios during DDT so budgets are protected from open-ended integration surprises.
How does PIM affect MACH with large catalogues?
PIM aggregates copy, media, technical attributes and marketing approvals. In a headless setup Medusa keeps references and IDs while rich content is served from PIM or a CDN with edge caching.
If PIM discipline is weak, teams fall back to spreadsheets. MACH cannot fix a process problem. We often clean data sources before optimising traffic scale.
Payments and trade credit in MACH: what to ship first?
Stripe-style gateways cover cards and instant payments, but B2B often needs invoicing, deferred terms and ERP-backed limits. In MACH we isolate a credit-policy module with payment webhooks and synchronous calls only where UX demands it.
PCI and GDPR need clear boundaries: what Medusa stores, what ERP stores, what stays tokenised with the PSP. A pre-peak security review costs less than an incident.
How does GMI Software measure B2B integration success?
We track ERP order sync latency, the share of orders needing manual fixes and webhook SLAs. The business goal is a shorter click-to-invoice cycle measured in business days, not vague “faster” claims.
If you are heading toward B2B marketplaces or split checkout, pair this with our order-domain and OMS notes; the topics intersect directly with MACH.
Frequently asked questions
- Is MedusaJS v2 suitable for B2B with credit limits?
- Yes, provided limits and scoring are expressed in APIs and integration tests with ERP. The core does not replace your finance policy.
- Do I need PIM before headless B2B?
- Not always. Below a few thousand SKUs a disciplined CSV pipeline and content approvals can be enough. Add PIM when SKU count, locales or channels grow quickly.
- How often should we sync stock with ERP?
- It depends on oversell tolerance: q-commerce needs seconds or events, long-lead B2B may use minute-level polling plus alert thresholds. We set this in DDT from the cost of failure.
- Who owns the message queues in production?
- In GMI Software engagements we spell it out in the contract: we can run operations or hand a runbook to your DevOps. Alerts must reach an on-call owner during peak season.
- What does a project like this cost roughly?
- MedusaJS v2, Next.js, ERP integration and baseline B2B usually land around PLN 160,000-240,000; deep marketplace or CPQ goes higher. After DDT we quote with a fixed-price guarantee; first numbers within 48 hours.
Content updated: April 7, 2026