**The design isn't ready to build as written, because step 4 can charge a customer twice. The fixes are small and you can make them in the doc tonight.**

## Must fix before building

**1. Retrying the charge can double-charge.** In step 4, a 5 s timeout doesn't mean the charge failed. The provider may have charged the card and answered too slowly. Retrying with no idempotency key then charges again.
- Case: the charge for a $40 order times out after the provider captured it. Retry 1 captures another $40. The customer is out $80.
- Fix: generate one idempotency key per order, for example the order id, and send it on every attempt. Most payment providers support this. Confirm yours does.

**2. A charge can succeed while the order is lost.** The `PENDING` insert sits in a transaction that stays open during the payment call, and step 6 rolls it back on failure.
- Case: all 3 attempts time out, but the first one actually went through. Step 6 rolls back, so no order row exists. The customer is charged and you have no record of it.
- Case: the charge succeeds, then the process crashes before commit. Same result.
- Fix: commit the `PENDING` order first, in its own short transaction. Then call the provider. Then update the order to `PAID` or `FAILED` in a second transaction. Add a small reconciliation job that finds `PENDING` orders older than N minutes and asks the provider for the real status using the idempotency key.
- This also stops the transaction holding a database connection for up to 15 s plus retries.

**3. Failure paths are untested.** The test plan covers unit tests plus one happy-path integration test. The risky behavior is all in failures: timeout then retry, decline, timeout where the charge actually succeeded, and a crash between charge and commit. Add integration tests with a fake payment provider that can time out, decline, or succeed late.

## Should fix, but won't block you

- **No client-side duplicate protection.** A double-clicked `POST /orders` creates two orders. Accept an `Idempotency-Key` header from the client and enforce it with a unique constraint.
- **Oversell policy is missing.** The 5-minute stock cache is fine at your volume, and you've already accepted that tradeoff. But the doc doesn't say what happens when you sell something that's out of stock. Pick one: cancel and refund, or backorder.
- **Email failure is unspecified.** If the email send fails after commit, the client shouldn't get an error for a paid order. Send it asynchronously, or log the failure and retry.
- **Backups are weak for payment data.** Nightly backups on a single instance mean a crash can lose up to 24 hours of paid orders. This is acceptable for a first release, but write it down as known debt. Point-in-time recovery (WAL archiving) is the cheap fix.

## What's good

The module boundaries, thin routes with an `OrderCheckout` class, and structured logging with the order id are sound. Sizing for 2,000 orders a day is realistic, and nothing here needs more infrastructure than you have.

VERDICT: READY WITH CHANGES
