**design.md is mostly sound, but I'd fix four items before building, and two of them are real bugs.** The core flow holds up. Charging outside the transaction, reserving stock with a conditional update, using the order id as the provider's idempotency key, and reconciling `PENDING` orders are all the right calls. The gaps are in the failure paths.

## Problems, by severity

**High**
1. **The reconciliation job can run twice at once, and the design doesn't guard against it.**
   - Two instances each run the job every 5 minutes, and the original request may still be settling the same order.
   - Concrete case: both settle order X as `FAILED`, and each restores 2 units of stock. The stock is now 2 units too high, so the service oversells.
   - Fix: make every status change conditional, for example `UPDATE orders SET status='FAILED' WHERE id=:id AND status='PENDING'`. Restore stock only if that update changed a row. Use `FOR UPDATE SKIP LOCKED` or an advisory lock so the job is also single-runner. This applies to step 5 as well as step 6.

2. **Step 6 doesn't say what happens when the provider has no record of the charge.**
   - The process can die after step 2 commits but before the charge is sent, which leaves a `PENDING` order that was never charged.
   - Fix: state the rule. A natural one is that "no charge found" means `FAILED` plus a stock restore, but only after a safe delay. That delay has to be longer than the provider's idempotency-key retention window and longer than any in-flight retry. Also say what "provider unreachable" does: leave the order `PENDING`.

**Medium**
3. **Reconciliation's side effects are unspecified.**
   - Step 6 says "settles as PAID or FAILED", but only steps 4 and 5 say to queue the email on `PAID` and restore stock on `FAILED`.
   - Fix: route all settlement through one shared function used by the request path and the job.

4. **The module rule conflicts with step 2.**
   - "No module reads another module's tables" contradicts a single transaction that updates `stock` and inserts into `orders`.
   - Fix: state that `OrderCheckout` owns the transaction and passes a transaction handle into the inventory and orders modules.

5. **The idempotency race isn't covered.**
   - Two simultaneous requests with the same key both pass any "does it exist" check. One hits the unique violation, and that path must roll back its stock reservation and return the existing order.
   - Fix: state that this is handled, and add a test for it. The current test list only covers sequential duplicates.
   - Also decide what happens when the same key arrives with a different cart (probably `422`).
   - The unique constraint appears in the flow text but not in the data model table.

6. **The schema is underspecified.**
   - No primary keys or foreign keys are listed: `stock.sku`, `order_items.order_id`, `orders.id`.
   - There is no `CHECK (available >= 0)` as a backstop for stock.
   - There is no index on `(status, created_at)` for the reconciliation query and the alert.

**Low**
7. **The source of price and total isn't stated.** The design should say they come from the server's catalog, not the client's cart.
8. **An email can be lost.** If the process dies between the commit and queueing the email, the confirmation is lost. An outbox row written in the same transaction as the `PAID` update would close this. You can accept the risk, but write that down.
9. **The tests miss the cases above.** Add tests for the concurrent duplicate key, two reconcilers running at once, a crash before the charge, and a decline arriving after a timeout.
10. **The client can wait roughly 25 s or more.** That's 4 attempts at 5 s each plus backoff, before the `202`. This is fine at your volume, but confirm the load balancer timeout is longer.

## Next step
Items 1–5 are edits to the doc, not redesigns, and should take well under a day. You can start building the `orders`, `inventory` and `payments` scaffolding tomorrow while you settle them. Write the settlement function and the reconciliation job only after items 1–3 are written down.

VERDICT: READY WITH CHANGES
