**Not ready.** Steps 4 to 6 can charge a customer twice, or charge them and lose the order. Both are cheap to fix on paper today and expensive to fix after launch.

## Blockers

1. **Retrying the charge can double-charge.** A 5 s timeout doesn't tell you the charge failed. It may have succeeded on the provider's side. Step 4 retries up to 3 times with no idempotency key, so one slow response can produce up to 3 charges. Fix: send a stable idempotency key per order, such as the order id plus an attempt scope, on every charge call.

2. **The payment call runs inside the open DB transaction, and rollback can lose paid orders.** There are two failure modes:
   - If the process crashes after the provider accepts the charge but before commit, the `PENDING` insert is gone. The customer is charged and you have no record of the order.
   - If all 3 attempts time out, step 6 rolls back and returns an error. But the charge may have gone through. The customer sees a failure, retries, and pays again.

   Fix: commit `PENDING` first, then call the provider outside any transaction, then update the order in a second transaction. Add a `PAYMENT_UNKNOWN` state, plus a reconciliation job or provider webhook that resolves it by querying the provider.

3. **The order state model is too thin.** `PENDING` and `PAID` are the only states. There is no `FAILED`, `PAYMENT_UNKNOWN` or `CANCELLED`, and no payments table recording attempts, provider references and outcomes. Without these you can't reconcile against the provider or answer "was this customer charged?".

4. **`POST /orders` has no idempotency.** If the client times out after 5 to 15 s and retries, you create a second order. Require a client-supplied idempotency key with a unique constraint.

5. **Nightly backups on a single instance mean up to 24 hours of paid orders can be lost.** That is unacceptable for payment data. Enable WAL archiving and point-in-time recovery, and decide on an RPO and RTO. You also need to test a restore before launch.

## Should fix before or during the first week

6. **Stock handling oversells.** The check reads a cache up to 5 minutes stale and never reserves or decrements anything. Two buyers of the last unit both succeed. Accepting a stale cache is defensible, but only if you also define the oversell policy: backorder, cancel and refund, or a conditional decrement in your own DB. At 2,000 orders a day this will happen, and the design has to say what happens when it does.

7. **The confirmation email is sent inline after commit.** If the send fails or the process dies, there is no email and no retry. Use a transactional outbox row, or at least a `confirmation_sent` flag with a retry job.

8. **Request latency is unbounded.** In the worst case, 3 retries at 5 s each take over 15 s with a DB connection held open. Set a total deadline, put backoff on the retries, and return `202` with a pollable status if payment can't finish in time.

9. **Testing is aimed at the wrong place.** The only integration test covers the happy path, but every bug above is on a failure path. Add a fake payment provider that can time out, succeed late, double-respond and error. Test crash points between each step and idempotent replay.

10. **The module rule conflicts with the flow.** "No module reads another module's tables" is fine, but the doc doesn't say how orders and payments coordinate state changes. `OrderCheckout` needs to own the state machine, with explicit module interfaces.

## Gaps to name, even if you defer them
- Server-side price and total validation. Never trust cart prices from the client.
- Authentication and authorization on the endpoint.
- Metrics and alerts for stuck `PENDING` or `PAYMENT_UNKNOWN` orders, payment error rates and cache staleness.
- Refund and cancel flows, even if manual at first.
- Logging the provider's request and response ids alongside the order id.

## What's good
The module boundaries, the thin routes and the order id in every log line are sound. The scale (200 to 2,000 orders a day, one Postgres) is also modest enough that none of the fixes need new infrastructure. This is a revision of the flow, not a rewrite.

My recommendation is to revise the flow section (items 1 to 4), settle the backup and PITR decision (5), and write down the oversell policy (6). That is probably a day or less of design work. After that, you can start building.

VERDICT: NOT READY
