**The design isn't ready to build tomorrow. The payment step can charge customers twice, or charge them and lose the order.** Those are fixable in a day or two of design work, but the flow has to change first.

## Blockers (fix before writing code)

**1. Retrying a charge on timeout can double-charge.**
- A 5 s timeout doesn't mean the charge failed. The provider may have charged the card and answered too slowly.
- Failing case: the charge succeeds at 5.2 s, the client times out, and the service retries. The customer is charged twice, and the design has no way to notice.
- The fix is an idempotency key on every charge call. Derive it from the order id so all retries share it. Also treat decline, timeout and 5xx as different outcomes. Only timeouts and 5xx should be retried, and a decline should never be.

**2. A charge can succeed while the order is rolled back.**
- Step 6 rolls back on any failure. If the charge succeeded but the commit or the `PAID` update fails, or the process crashes between steps 4 and 5, the customer is charged and no order exists. The `PENDING` row vanishes with the rollback, so there's nothing to reconcile against.
- Fix: commit the `PENDING` order before calling the provider. After the call, move it to `PAID` or `FAILED`. Add a reconciliation job that finds stale `PENDING` orders and asks the provider what happened.
- Expected outcome for the case above: a `PENDING` row exists, and the job finds the charge and marks it `PAID`.

**3. A database transaction stays open during an external call.**
- Worst case is 3 × 5 s of retries, about 15 s, holding a connection and row locks. A provider slowdown will exhaust the connection pool and take down order reads as well.
- Committing `PENDING` first (see #2) solves this too.

**4. Client retries create duplicate orders.**
- `POST /orders` has no idempotency key. A mobile client that times out and resubmits creates a second order and a second charge.
- Fix: require an `Idempotency-Key` header, store it with a unique constraint, and return the original result on a repeat.

**5. Backups can't protect paid orders.**
- Single Postgres with nightly backups means a failure can lose up to 24 hours of orders. Customers will have been charged for those orders.
- The provider would still hold the charges, but you'd have no orders to match them to.
- Minimum fix: continuous WAL archiving (point-in-time recovery). Also write down your recovery time and data-loss targets.

**6. The test plan skips the risky paths.**
- Unit tests plus one happy-path integration test won't catch #1 to #4. Every one of those bugs lives in a failure path.
- Required tests: timeout then retry with the same idempotency key; a decline that isn't retried; a crash after the charge and before `PAID`; a duplicate `POST` with the same key; email failure after commit.

## Should fix (decide before building, can be small)

- **Stock check has no reservation.** A 5-minute-old cache with no decrement means two buyers can both get the last item. At 200 orders a day this may be fine, but then write down the policy: oversell and then cancel or backorder, or reserve stock. "We accept the cache" covers the latency but not the oversell.
- **Order states are incomplete.** Only `PENDING` and `PAID` are named. You need at least `FAILED` and `CANCELLED`, plus the allowed transitions. Refunds are missing too.
- **Confirmation email is sent inline.** If it fails, either the request errors for a paid order or the email is silently lost. Use a transactional outbox row, or a retried background send.
- **Prices come from the cart.** Say explicitly that the server recomputes the total from its own catalog and ignores client prices.
- **Payment records have no home.** The design doesn't say where provider charge ids and statuses are stored. Following the "no module reads another's tables" rule, that is a payments table owned by the payments module.
- **Missing basics:** authentication, currency and money type (use integer minor units), metrics and alerts (stuck `PENDING` count, charge failure rate), and a provider webhook as a second source of truth.

## What's good
The module boundaries, thin routes and structured logging with order id are sound. The 800 ms reasoning for the cache is clear.

Redo the flow as: validate, insert `PENDING` with idempotency key, commit, charge with idempotency key, update the state, enqueue the email, and add the reconciliation job. Then write the failure-path test list first. I can draft that revised flow and test plan if you want.

VERDICT: NOT READY
