The structure is sound, but the payment step has two serious bugs and needs reworking before you build on it. It's a small design, so the fix should take an afternoon, not a week.

## Blockers

**1. Retrying the charge on timeout can charge the customer more than once.**
A timeout doesn't mean the charge failed. It means you don't know whether it went through. Step 4 retries up to 3 times, so one checkout could charge the customer up to 4 times. Step 6 then rolls back the order, so you might charge someone 4 times and keep no record of the order.
- **Fix:** send an idempotency key with every charge call; most providers support this. Use the order id as the key. On a final timeout, don't treat it as a failure. Move the order to a `PAYMENT_UNKNOWN` state and settle it with the provider's status API or webhook.

**2. The database transaction stays open during the payment call, so the order record isn't there when you need it.**
- The `PENDING` row is never committed, so no one else can ever see it. If the process crashes after the provider charges but before your commit, the customer has paid and you have no order. Nightly reconciliation won't catch it because there's nothing to match against.
- One checkout can hold a transaction and connection open for 20+ seconds (4 × 5 s timeouts plus backoff). At 2,000 orders a day that's survivable, but it's the wrong shape.
- **Fix:** commit `PENDING` first, then call the provider outside any transaction, then update the order to `PAID`, `FAILED` or `PAYMENT_UNKNOWN` in a second short transaction. The order row becomes your record for reconciling payments.

**3. A client retry of `POST /orders` creates a duplicate order.**
A 20-second worst case means clients and proxies will time out and resend. Each resend creates a new order and a new charge. Even with the payment idempotency key, each new order brings a new key, so the customer gets charged again.
- **Fix:** have the client send an `Idempotency-Key` header and enforce it with a unique constraint.

## Should fix before launch

- **Nothing reserves or decrements stock.** The design checks a cache that can be 5 minutes stale and never tells the warehouse that anything sold. Overselling is guaranteed, not an edge case. Accepting the cache is reasonable at your volume, but then write down what happens on an oversell (who notices, refund or backorder) and how the warehouse learns about each sale.
- **The email is sent inline after commit.** If it fails or hangs, the client still sees an error or a delay. Write a row to an outbox table in the `PAID` transaction and have a worker send the email.
- **Nightly backups mean you could lose up to 24 hours of orders and payment records.** For financial data, turn on WAL archiving or point-in-time recovery. It's cheap on a single instance.
- **Testing covers only the happy path,** but every bug above is on a failure path. Add integration tests for: provider timeout followed by success on retry, a crash between charge and commit, a duplicate `POST`, and an `UNKNOWN` order being settled.

## What's fine
- One Postgres instance easily handles 2,000 orders a day. Don't add queues or sharding beyond the outbox.
- The module boundaries, the thin routes with an `OrderCheckout` class, and logging with the order id are all good. The order-id logging will be essential when you reconcile `PAYMENT_UNKNOWN` orders.

## Revised flow (sketch)
1. `POST /orders` arrives with an idempotency key. If an order with that key exists, return it.
2. Check the stock cache.
3. Insert the order as `PENDING` and commit.
4. Charge the provider, using the order id as the idempotency key. Retries are safe now.
5. In one transaction, set the order to `PAID` and add an email row to the outbox. On a definite decline, set `FAILED`. On a final timeout, set `PAYMENT_UNKNOWN`.
6. Background jobs send outbox emails and settle `PAYMENT_UNKNOWN` orders using webhooks or polling.

Update steps 3–6 of the doc along these lines and you can start building tomorrow.

VERDICT: NOT READY
