**Not ready to build as written, but the fixes are small.** Change the payment step before you start, because the current flow can charge a customer twice or charge them and keep no record. The rest of the design is sound for 200 to 2,000 orders a day.

## Must fix before building

**1. The retry in step 4 can double-charge customers.**
- Case: the charge API takes 6 s but succeeds on the provider's side. We time out at 5 s and retry, and the provider charges again. The customer pays twice.
- Fix: send an idempotency key with every charge, such as the order id. This lets the provider recognise a retry and return the first result. Check that your provider supports one; most do.

**2. A charged customer can end up with no order and no record.**
- Case: the charge succeeds, then the service crashes or the commit fails before step 5 finishes. The `PENDING` insert is rolled back, so nothing in our database shows the customer paid. The same happens in step 6 if all three attempts time out but one charge actually went through.
- Fix:
  - Commit the `PENDING` order first, in its own short transaction.
  - Call the provider outside any transaction.
  - Then update the order to `PAID` or `FAILED`.
  - Add a small job that finds old `PENDING` orders and asks the provider whether they were charged.

This also stops a database connection being held for up to 15 s of retries.

**3. The test plan skips the failure paths that matter.**
- It lists one integration test, for the happy path only.
- Add tests for:
  - a charge timeout followed by a successful retry, which must not double-charge
  - a declined card
  - a crash between charge and commit, and the reconciliation job recovering it
  - an out-of-stock cart
  - a failing confirmation email
- Write these before the `OrderCheckout` code, per your TDD standard.

## Should decide now (small, but cheaper before code exists)

- **Overselling:** the stock check reads a cache that can be 5 minutes old, and nothing reserves stock. Two customers can both buy the last item. That may be acceptable at this volume, but write down the policy, for example "oversell happens, support cancels and refunds".
- **Duplicate client requests:** if the client retries `POST /orders` after a network drop, you get two orders. Accept an `Idempotency-Key` header on that endpoint too.
- **Confirmation email:** it is sent in the request path after commit, and a failure isn't described. Say whether it is retried or queued. A failure must not turn a paid order into an error response.
- **Order states:** you use `PENDING` and `PAID` only. Add `FAILED`, and `CANCELLED` or `REFUNDED` if you will ever need them.
- **Backups:** nightly backups on a single instance mean up to 24 hours of paid orders could be lost. Name that as accepted, or add point-in-time recovery, which is a setting on most hosted Postgres.

## Good as is
- The module boundaries, the thin routes with the flow in `OrderCheckout`, and logging the order id on every line.
- Accepting the stale cache to avoid the 800 ms warehouse call, which is reasonable here.

VERDICT: READY WITH CHANGES
