**design.md is not ready to build from as written.** The payment flow in steps 3–6 can charge customers twice or charge them with no order recorded. The rest is sound, and the fixes are small enough to make before you start tomorrow.

## Blocking issues

1. **Retrying the charge can double-charge (step 4).** A timeout doesn't mean the charge failed. It may have succeeded and the response was lost. The design retries up to 3 times and doesn't mention an idempotency key. Generate one per order, for example the order id, and send it on every charge attempt. Confirm the provider supports it.

2. **A charge can succeed while the order is rolled back (steps 4–6).** There are two ways this happens:
   - All retries time out, but one of the charges actually went through. Step 6 then rolls back and tells the client it failed, so the customer is charged for an order that doesn't exist.
   - The charge succeeds but the commit in step 5 fails. The same thing happens.

   Commit the `PENDING` order first, outside the payment call. Then charge, then update the status to `PAID` or `FAILED` in a second transaction. For an unknown outcome such as a timeout after all retries, use a `PAYMENT_UNKNOWN` state and a reconciliation job that queries the provider. Say in the doc what happens to money that was taken without a recorded order.

3. **The database transaction stays open during the payment call (steps 3–5).** With 5 s timeouts and 3 retries, that is 15 s or more per order. It holds a connection and row locks while waiting on a third party. This goes away once you apply fix 2.

## Should fix before building

- **No idempotency for `POST /orders`.** A client retry or double-click creates a second order. Take a client-supplied idempotency key and enforce it with a unique constraint.
- **Confirmation email.** The doc doesn't say what happens if it fails after commit. Say whether it is best-effort or goes through an outbox or retry. Make sure a failed email never affects the order status.
- **Stock check against the cache.** Accepting a 5-minute-stale cache is reasonable at 200–2,000 orders a day. But nothing reserves or decrements stock, so oversells are possible. Write down that this is accepted and what happens when one occurs, for example a manual refund or backorder.
- **Tests.** Only the happy path is covered. The problems above are all failure paths. Add tests for charge timeout then success, all retries timing out, commit failure after charge, and duplicate requests.
- **Backups.** Nightly backups on a single instance mean up to 24 hours of lost orders and payments. That may be acceptable, but make it an explicit decision. With payments involved, consider point-in-time recovery (WAL archiving), which is usually cheap.

## What's fine

The module boundaries, the thin routes, the `OrderCheckout` class and the structured logging with order id all look good. The scale assumptions fit a single Postgres instance and a four-person team.

VERDICT: NOT READY
