The design is close: you can start building tomorrow once you make about four small changes to it, each a sentence or two. The core checkout flow is well thought out. The stock reservation can't oversell, payment runs outside the database transaction, the order id is reused as the payment idempotency key, and unknown payment results have a recovery path with a 30-minute alert behind it. Most designs at this stage are missing at least one of those.

## Changes to make before building

**1. Only change an order's status if it is still `PENDING`.** Right now nothing stops an order from being settled twice. You run two instances, and the design doesn't say the reconciliation job runs on only one of them. Here's the failing case: order A is `PENDING` with 1 unit reserved, and both instances' reconciliation jobs ask the provider about it at the same moment. Both hear "declined", both mark it `FAILED`, and both add the unit back, so stock goes up by 2 when it should go up by 1. The fix:
- Write every transition as `UPDATE orders SET status = :new WHERE id = :id AND status = 'PENDING'`.
- Restore stock only if that update changed a row.
- Have the reconciliation job lock the orders it works on (`FOR UPDATE SKIP LOCKED`) or take a Postgres advisory lock.

**2. Say what happens when reconciliation settles an order as `FAILED`.** Step 5 restores stock when a payment is declined. Step 6 only says "settles as `FAILED`", so it's unclear whether stock comes back on that path. State that both paths call the same code. Also decide what happens when the provider has *no record* of the charge (the request never reached them). Either retry the charge or mark the order failed after a cutoff. Without a rule, those orders stay `PENDING` and trigger the 30-minute alert every time.

**3. Don't lose the confirmation email if the service crashes.** Step 4 commits `PAID` and only then queues the email. If the process dies between those two steps, the customer is charged and never hears about it. Write the email job in the same transaction as the `PAID` update (an "outbox" table that a worker reads from) and send it from there.

**4. Scope the idempotency key to the customer.** A global unique constraint means two customers who happen to send the same key collide, and the second customer gets the first customer's order back. Make the constraint `UNIQUE (customer_id, idempotency_key)`. When two duplicate requests arrive at the same time, the second one fails on the constraint. Handle that error by returning the existing order, not a 500.

## Smaller points to settle while you build
- **How the client learns the result after a `202`.** The design needs a `GET /orders/{id}` (or something similar) the client can poll.
- **One transaction, two modules.** Step 2 updates inventory's `stock` table and inserts into the orders table in one transaction, while the code structure section says no module reads another module's tables. Both hold if the inventory module exposes something like `reserve(tx, items)` that runs on the transaction `OrderCheckout` passes in. Write that down so nobody reaches into `stock` directly.
- **Tests to add to the plan:**
  - reconciliation settling as paid
  - reconciliation settling as failed, with stock restored exactly once
  - provider has no record of the charge
  - two duplicate `POST /orders` at the same time
  - two buyers racing for the last unit
  - a crash between marking `PAID` and sending the email

Expected volume (2,000 orders a day) is comfortably within what one Postgres database and two instances can handle. Nothing in this design needs to change for scale.

VERDICT: READY WITH CHANGES
