Keep the Model Away From the Money Path in Checkout
The ticket came in at 4:50 on a Tuesday afternoon. A customer on mobile Safari had been charged $212.40 for a cart that showed $186.10 at the review step. Nobody had touched the cart. The difference was sales tax, and the tax was wrong because of something we had added to the flow that week for a Fortune 500 apparel brand: an LLM that "cleaned up" the shipping address before it reached the tax calculation.
The model was supposed to fix typos and normalize addresses. On about one order in two hundred, it also changed the ZIP code. A street name that existed in two states got resolved to the wrong one, and the tax engine computed rates for the wrong jurisdiction. We caught 212 mis-taxed orders in the first sweep. I still think about how the change passed review. The demo looked great.
Why it was in the path at all
The pitch was reasonable on paper. Customers mistype addresses, address validation APIs are strict and unforgiving, and a model can bridge the gap between what someone typed and what the carrier expects. I have no quarrel with the goal. My quarrel is with where we put the call. It sat synchronously between the address form and the tax request, which meant the model was now the authority on what the customer owed.
Failure one: latency is a tax on every session
Before the change, p95 for the step from address submit to shipping rates was about 1.1 seconds. With a synchronous model call, it climbed to 3.4 seconds. Over three days and roughly 41,000 checkout sessions, abandonment on the payment step rose 2.8 percent. That number is small in a dashboard and expensive on a P&L.
The PHP side made it worse. Each checkout request held a PHP-FPM worker for the full duration of the upstream call. Under peak traffic, the pool saturated, and requests that had nothing to do with the model queued behind it. WooCommerce's session handling adds its own lock on the cart row, so slow requests on the same session serialized in ways that looked like random double-submits in our logs.
Failure two: nondeterminism leaks into totals
A deterministic function returns the same output for the same input. A model does not, not exactly, and not always. We had cached the normalized address for performance, but the cache key was the raw string plus the session ID. Two customers with the same typo in different states could collide once the session expired and the key was reused in a tenant-shared cache. That is the cache key collision you only find after a customer tells you their tax is in the wrong state.
Failure three: user input is now an injection surface
The delivery-instructions field was passed into the prompt as free text. A tester typed a note that began with instructions to ignore prior rules and return a specific ZIP code. The model complied in a sandbox run. It would have been a much worse day in production. Anything a customer can type into checkout is untrusted input, whether or not you call it a prompt.
The fix was structural. We passed user fields as data inside a JSON object with a fixed schema, validated the model's response against that schema, and rejected any output that changed fields it had no business changing. The model could suggest. It could not set price, tax, or shipping.
Failure four: provider incidents are normal weather
During a 40-minute upstream incident, the provider returned overloaded errors at a rate that pushed our checkout error rate from roughly 0.2 percent to 1.9 percent. Retries made it worse, because every retry held a worker. We had no circuit breaker on that path, which is embarrassing to write down but honest. We now run the same kill switch and per-day budget guardrails I built into the AI Showcase: when the breaker trips, checkout skips the model entirely and falls back to the deterministic validator.
What I'd do instead
There are three reasonable architectures, and each has a different cost profile.
- Synchronous and authoritative. The model's output directly changes the order. This is the one that broke for us. I would not ship it for anything that touches price, tax, or shipping, under any circumstances.
- Synchronous and advisory. The model suggests a correction, the customer confirms it, and the deterministic validator runs on the confirmed value. With a hard 400 ms timeout and a silent fallback to plain validation, this is acceptable for address hints. It costs some UI complexity and a bit of conversion friction.
- Asynchronous or precomputed. Use the model where latency does not matter: search query rewriting that warms a cache, product copy generated offline, support triage after the order is placed. This has the best reliability profile and the least glamour.
For the apparel client, we settled on the second option for address hints only, with the validator as the source of truth. We moved everything else off the critical path. After the rollback and the redesign, p95 returned to 1.2 seconds, and the mis-tax rate went to zero because the model no longer had any way to change a jurisdiction.
The conventional wisdom says an LLM in checkout is a conversion win waiting to be unlocked. I think that framing is backwards. Checkout is the one place where the system's correctness is measured in customer money, and every probabilistic component you add there needs to earn its place by being unable to do damage.
The model can suggest the address. It does not get to decide what the customer owes.
If you are weighing a similar change for your own store, the useful exercise is to list every value the model could influence and mark which ones a deterministic system is allowed to overwrite. That list is usually short, and it tells you where the model is safe to sit. We apply the same discipline on client work at Champlin Enterprises, where the boundary between advisory and authoritative gets drawn before any code is written.