**Not ready to build tomorrow.** As written, the flow can charge a customer twice, or charge them and lose the order. Both are fixable in the design in about a day, so this is a rewrite of steps 3–6, not a restart.

## Must fix before building

**1. Retrying on timeout can double-charge (step 4).**
- A timeout means you don't know whether the charge went through. It does not mean the charge failed.
- Failing case: the charge succeeds at the provider, the response is slow, and your 5 s timer fires. You retry, and the card is charged twice. Expected: one charge.
- Fix: send an idempotency key with every charge call, for example the order id. Most providers support one, and the retry then returns the original result. Confirm that yours does.

**2. A charged customer can end up with no order (steps 3–6).**
- The order sits in an open transaction, and the charge happens inside it. If the service crashes after the charge, or all 3 retries time out but one charge actually succeeded, step 6 rolls back. The `PENDING` row disappears and the money stays taken.
- Failing case: the charge succeeds, the process is killed before commit, and the customer has paid with no order record and nothing to reconcile against.
- Fix: commit `PENDING` first, outside any transaction that spans the charge, then call the provider. Record the outcome as `PAID`, `FAILED` or `PAYMENT_UNKNOWN`. Add a small reconciliation job that asks the provider about every order stuck in `PENDING` or `PAYMENT_UNKNOWN`.
- This also stops the database connection being held for up to 15 s or more (3 attempts × 5 s) per checkout.

**3. Retrying `POST /orders` from the client creates duplicate orders.**
- The design has no idempotency key at the API level. A double-click or a mobile retry produces two orders and two charges.
- Fix: the client sends an `Idempotency-Key` header. The service stores it with a unique constraint and returns the existing order on a repeat.

**4. Nothing handles overselling, and nothing reserves stock (step 2).**
- Accepting a 5-minute-stale cache is a reasonable tradeoff. But the design never says how the warehouse learns about the order, and it never decrements the cache.
- Failing case: 1 unit left, two customers order within the same 5 minutes. Both pass the check and both pay.
- Fix: decide the oversell policy now (cancel and refund, or backorder). At minimum, decrement the cache locally on order. Write the policy into the doc and add a refund path.

**5. A nightly backup on a single Postgres is the wrong recovery target for paid orders.**
- A disk failure at 5 pm loses up to 24 hours of orders, including ones where money has already moved.
- Fix: turn on WAL archiving or point-in-time recovery, which managed Postgres usually offers. Also state the recovery time and recovery point you accept. This is the least urgent of the five. It must be decided before launch, but it doesn't block starting the code.

## Gaps to settle in the doc

- **Confirmation email after commit (step 5):** if the process dies between commit and send, the email is lost silently. Write an outbox row in the same transaction as the `PAID` update and send from a worker, with retries.
- **No data model or API contract:** the doc has no order states and transitions, no error codes, no auth, and no cancel or refund flow. You will need these in the first week.
- **Module rule versus flow:** "no module reads another module's tables" is good. But the doc doesn't say where payment records live, or which module owns the `PENDING` → `PAID` transition. Name the owner.
- **Client-facing latency:** 3 × 5 s plus backoff exceeds most client timeouts, so clients will retry. That makes item 3 mandatory, not optional.
- **Async payment flows:** 3-D Secure and other extra authentication steps need a webhook from the provider, not a synchronous charge. If your market needs them, step 4 changes shape.
- **Observability:** the doc only mentions logging. Add metrics and alerts on orders stuck in `PENDING` or `PAYMENT_UNKNOWN`, charge error rate and provider latency.

## Test plan conflicts with your standards

The doc plans unit tests per module and one happy-path integration test. Every bug above lives in a failure path. Before coding, add tests for these cases:
- The charge times out and then succeeds on retry, and only one charge results.
- The service crashes after the charge and before the outcome is recorded.
- A duplicate `POST /orders` with the same idempotency key.
- All 3 charge attempts fail.
- Two orders race for the last unit of stock.
- The email send fails.

Write these as the first failing tests against a fake payment provider that can delay, duplicate and drop responses.

## What is fine

- The 800 ms warehouse call against a 5-minute cache is a sound, explicitly reasoned tradeoff.
- Thin routes, an `OrderCheckout` service and separate modules are the right layering.
- Order id on every log line is good.
- Volume (2,000 orders a day) is low enough that a single Postgres and synchronous flow are fine. None of the problems above are about scale.

VERDICT: NOT READY
