Blog Details

blog
about

The B2B Order Your ERP Never Accepted

The B2B Order Your ERP Never Accepted

A buyer submits a $140,000 order on a wholesale portal at 4:50 on a Friday. The confirmation page renders. The email goes out. The order shows as complete in the portal's admin view. On Monday, accounts receivable calls: the order is sitting on credit hold in the ERP, nobody told the buyer, and the stock they expected has already been promised to another account.

Nothing in that story is a bug in the usual sense. Every system did what it was built to do. The portal treated order placement as the end of the transaction. The ERP treated it as the start of a request. Both were right about their own job. The space between those two assumptions is where B2B commerce projects quietly lose money, and it is almost always designed in during week one.

McKinsey's 2026 Global B2B Pulse found that 71 percent of B2B organizations now run some form of ecommerce, with about a third of revenue moving through it. The same body of research keeps finding that a large majority of buyers will place orders above $50,000 through self-service. Buyers are ready. What they are not ready for is a portal that says "confirmed" and means "we wrote it down somewhere."

A confirmation is a promise, not a receipt

Consumer checkout has a clean gate: the card authorizes or it does not. B2B checkout has no such gate. Payment terms of net 30 or net 60 mean money does not move at checkout, so the things that actually decide whether an order proceeds live somewhere else. Credit exposure, contract compliance, stock availability and the approval thresholds set by the customer's own procurement policy all get settled there, along with discount authority and export control screening.

Every one of those checks belongs to the ERP or the finance system, because that is where the customer master and the ledger live. The storefront has none of that context and should not pretend to.

That leaves the portal with one honest verb: submitted. The order has been captured, validated against what the portal knows, and handed to the system that can accept it. Anything stronger than that is a UI telling a story the backend cannot back up. "Submitted, awaiting acceptance" is uglier than a green checkmark and it prevents the Monday phone call.

Punchout moves a cart, not an order

The integration request usually arrives as one sentence: "Our buyer needs punchout." What that sentence actually covers is a session plus at least two documents, and the second one gets missed constantly.

A cXML punchout session opens with a PunchOutSetupRequest. It carries a credential proving which buyer is calling, a BuyerCookie identifying the session, a BrowserFormPost URL where the cart must be returned, and the buyer contact's email. The supplier opens a catalog scoped to that buyer's pricing, the buyer fills a cart, and the cart posts back to the procurement system. OCI does the same job for SAP-led procurement; OCI 5.0 is the widely deployed release, and a 5.0 catalog is expected to remain 4.0 compliant.

That is the shopping half. The purchase order is a separate message that arrives after the buyer's own approval workflow runs. It may come as a cXML OrderRequest to your order endpoint, as an EDI 850, or as a push from the buyer's procurement platform. It may need an OrderResponse acknowledgement, and later an invoice and a ship notice.

A current example of how easily that splits: the nopCommerce punchout plugin shipped in 5.00 handles the shopping session well, but support for receiving the cXML purchase order at its /punchout/order address was still listed as an open, on-hold item on the project tracker in late November 2026. A store can look punchout-ready in a demo and still require a human to key in every purchase order that follows.

Scope the documents before quoting the work. Setup request, cart return, purchase order, order acknowledgement, invoice, ship notice. Ask the buyer which of those they send, in which format, to which endpoint, with what retry behavior. "Punchout" as a word does not answer any of it.

Unit of measure is the one that bites hardest in the same handoff. The buyer's item master says a case of 12; your catalog sells eaches; the purchase order arrives with a quantity that means something different on each side. Someone keys it in wrong once, and now the warehouse ships twelve pallets instead of twelve cases. Map UOM explicitly per buyer and reject the order at the boundary rather than guessing.

Two security details are worth settling early. The BuyerCookie should be unguessable, single use, and bound to the buyer identity that opened the session. And the buyer's contract pricing belongs in the session record on your side, not in a URL parameter that anyone can edit.

Contract pricing is a lifecycle, not a column

"Show the customer their negotiated price" sounds like a lookup. In practice a price for one line item can depend on the account, the ship-to region, the currency, the quantity on this order, cumulative spend across the contract year, an active promotion, and whether the item is in a contracted bundle. Volume tiers come in two shapes that behave differently: quantity breaks on the current order, and cumulative tiers that move the account into a new price band as annual spend crosses a milestone.

The dangerous part is not resolving the price. It is resolving it twice.

If the checkout resolves a price at cart time and the invoice resolves it again weeks later, any change in between becomes a customer dispute. A contract that expired, a tier that reset, a price list update that landed on the first of the month. The invoice is then technically correct and commercially wrong.

Resolve once, then snapshot. Every order line should store the unit price, the currency, the rule that produced it, the version of that rule, and the inputs that mattered: account, quantity, effective date. The invoice reads the snapshot. Finance can still reprice deliberately, with a credit memo, which is an auditable act rather than an accident. The same discipline applies to rounding and discount allocation, which is its own separate failure mode.

Minimum order quantities and pack sizes deserve the same treatment. Check them when the item enters the cart and again at submit; a buyer who edits a quantity down to 9 on a 10-pack minimum should learn that immediately, not from a rejection email.

Credit is a reservation problem

Available credit is not a stored number: it is a limit minus posted exposure minus whatever has been promised but not yet posted.

Most portal integrations skip the third term. A buyer with a $500,000 limit and $480,000 of open invoices appears to have $20,000 available. They then place four orders of $15,000 in an afternoon, and each one passes the check because nothing has posted yet. The ERP catches it later and holds everything, and now four orders are stuck instead of one.

The fix is a reservation record created atomically when an order is submitted: account, amount, order reference, expiry, and release conditions. Availability becomes limit minus posted minus active reservations. Creating that record has to be a single atomic operation, not a read followed by a write, or two concurrent submissions will both see the same headroom. A row lock on the account, or a conditional update with a version check, does the job.

Then write down which statuses hold a reservation. Submitted and pending approval: yes. Draft: no. Rejected or cancelled: released immediately. Shipped and invoiced: converted to posted exposure, not double counted. Partial cancellation releases the difference. This is a decision table finance should sign, not something a developer infers at 6pm.

Model the order as a state machine both sides agree on

The portal and the ERP need a shared vocabulary for order state, and the storefront's labels need to match what the backend can prove.

A workable set: draft, submitted, validating, accepted, held for approval, held for credit, rejected, cancelled, fulfilled. The portal owns draft and submitted. The ERP owns accepted, held, rejected, and fulfilled. Every transition is an event with a timestamp, an actor, and a source system, and the events are append-only.

The customer-facing labels carry real weight. A $25,000 order that needs a controller's signature does not become approved because the storefront rendered a thank-you page. "Order confirmed" should only ever appear after the ERP returns an accepted state. Everything before that reads as "submitted, awaiting acceptance" or "on hold, credit review" with a reason in plain language. Buyers tolerate a hold. They do not tolerate discovering it three days later from their own finance team.

Idempotency has to exist at both ends. A buyer double-clicks, a browser retries a slow POST, a cXML sender retries because it did not get an acknowledgement in time. All three can create duplicate orders. A client-supplied key, typically the buyer's PO number combined with the session or account, plus a unique index at the database level, collapses them into one.

The integration contract

Assume asynchronous delivery by default. The ERP is the system of record for orders, the portal is not, and a synchronous call that blocks a buyer's browser on an ERP response is a fragile design dressed up as a simple one.

Publish the order to a queue through an outbox table written in the same transaction as the order record. That removes the classic failure where the order exists and the message does not, or the reverse. Send with an idempotency key. Consume acknowledgements and write them back as state transitions.

Treat a timeout as unknown, never as failure. An ERP call that times out may have committed. Retry with the same key, and reconcile by polling order status rather than assuming the write did not land.

Legacy ERPs add their own trap: an HTTP 200 that contains a rejection in the body. BAPI and SOAP wrappers do this routinely. Parse the payload, not the status code.

Anything that cannot be accepted after a bounded number of attempts goes to an exception queue with the raw request and response preserved, plus an alert. Silent drops are how a week of orders disappears. A nightly reconciliation that compares submitted order references against ERP sales documents and flags anything older than a set threshold without a match catches the rest.

One more rule that saves arguments: never let the integration change a price the buyer already saw. If the price moved between cart and submit, send the order back for approval with the new number. Absorbing the difference silently destroys the audit trail you will need when someone asks why margin slipped.

What to test before launch

A single happy path proves nothing. The test plan should include at minimum:

  • An order exactly at the available credit limit, and an order one cent over it.
  • Two concurrent submissions from the same account where either alone would fit.
  • An ERP response of 200 with a rejection inside the body.
  • An ERP timeout after the transaction commits.
  • A contract expiring between cart and submit.
  • A partial cancellation, then a check that the released credit is exact.
  • The same cXML OrderRequest replayed three times, expecting one order.
  • An ERP outage during submit, expecting a queued order and a visible pending state, not a lost one.

Each of those has a known correct outcome. Write the outcomes down before the tests run, or the tests become a debate.

A build order that holds up

Start with the state machine and the decision table, in a room with finance, sales, and whoever administers the ERP. That document settles credit reservation, approval thresholds, and what "confirmed" means. It is cheap to write and expensive to skip.

Then choose integration style per document rather than per project. Cart return can be synchronous. Purchase order acceptance should not be.

Build the price resolver as its own service with versioned rules and a snapshot written on every line. Build credit reservation as one atomic operation with an expiry. Buy punchout middleware if the buyer list is short and standard, and budget the order endpoint as separate work either way.

Instrument the pipeline from day one: correlation id on every transition, lag from submitted to accepted, exception queue depth, and a dashboard finance can read without calling engineering. The first month of production traffic will find edge cases nobody imagined in design. The goal is to see them before the buyer does.

A B2B portal is not where an order gets approved, and building it as if it were produces the Friday confirmation and the Monday phone call. It is where a request gets captured cleanly enough that the ERP can approve it without anyone picking up the phone.

Send Us a Message