**Not ready to build.** The payment step in the flow can charge a customer more than once, or charge them and leave no order. Fixing this is a design change to the flow, so it is better to make it before you write code.

## Blockers

**1. Retrying the charge can double-charge.** Step 4 retries on a 5 s timeout, up to 3 times. A timeout doesn't mean the charge failed. The provider may have charged the card and answered too slowly.
- **Failing case:** the first charge of $80 succeeds at the provider but the response takes 6 s. The service retries, and the provider charges again. The customer pays $160 for one order.
- **Fix:** send an idempotency key on every charge call, for example the order id. Most providers support this. The provider then returns the first result instead of charging twice. Add a test that makes the provider time out and checks that only one charge exists.

**2. A charge can succeed without a matching order.** Step 5 charges, then commits, and step 6 rolls back on any failure.
- **Failing case:** the card is charged, then the commit fails (database restart, connection dropped). Or all 3 attempts time out, but one of them actually went through. In both cases the customer is charged and the rollback leaves no order record.
- **Fix:**
  - Commit the `PENDING` order *before* calling the provider, and never hold a transaction open across the network call.
  - Move the order to `PAID` or `FAILED` after the call.
  - Add a status for "payment outcome unknown".
  - Add a reconciliation job that asks the provider about those orders, plus a refund path.
  - Keep failed attempts as `FAILED` rows instead of deleting them. Right now you have no record of them.

**3. Duplicate orders from client retries.** `POST /orders` has no idempotency key from the client.
- **Failing case:** a user double-clicks Pay, or a mobile client retries after a dropped connection. Two orders are created, and with blocker 1 unfixed, two charges.
- **Fix:** require an `Idempotency-Key` header and put a unique constraint on it.

**4. Stock is never reserved, so you can oversell.** The check reads a cache that is up to 5 minutes old, and nothing decrements or holds stock when an order is placed.
- **Failing case:** 1 unit is left. Two customers check out within the same 5 minutes and both see it in stock. Both are charged for one item.
- **Fix:** reserve stock atomically at order creation, and treat the cache as a hint only. Or decide that overselling is acceptable and define what happens then (backorder, or refund and apology). The design currently says neither. The 800 ms warehouse call is not the real problem; that latency is fine for a checkout.

## Should fix before launch, though not blocking

- **Nightly backups on a single Postgres.** A failure at 11pm loses up to 24 hours of paid orders, while the provider still holds the charges. Turn on continuous WAL archiving (point-in-time recovery). It is cheap on one instance.
- **Email inside the request.** If the email fails after the commit, the design doesn't say what happens. Write an "email to send" row in the same database transaction and have a worker send it. The email can then never fail the order.
- **Not specified:** price calculation (the server must compute the total, not trust the cart), request validation, authentication, and how a decline differs from a timeout or provider outage. Retrying a decline is wrong.
- **Tests:** the plan has unit tests and one happy-path integration test. For this flow the failure paths are the point. Add tests for:
  - provider timeout then success (one charge only)
  - decline
  - commit failure after charge
  - duplicate idempotency key
  - concurrent last-unit purchase

  This matches your own tests-first standard.
- **Logging:** the order id on every line is good. Add the provider's charge id and the idempotency key, and an alert on orders stuck in `PENDING` or "outcome unknown".

## What is fine

- The module boundaries, thin routes and the `OrderCheckout` service are reasonable.
- The scale (about 2,000 orders a day) doesn't call for queues or extra infrastructure. Everything above is about correctness, not load.

## Suggested corrected flow

```mermaid
sequenceDiagram
    Client->>Service: POST /orders (Idempotency-Key)
    Service->>DB: reserve stock + insert order PENDING, commit
    Service->>Provider: charge (idempotency key = order id)
    alt success
        Service->>DB: mark PAID + queue email, commit
    else decline
        Service->>DB: mark FAILED, release stock
    else timeout after retries
        Service->>DB: mark PAYMENT_UNKNOWN
        Note over Service,Provider: reconciliation job resolves it later
    end
    Service-->>Client: result
```

I'd spend a day revising `design.md` with these changes, including the failure-path test plan, and then start building.

VERDICT: NOT READY
