**You can start building tomorrow if you settle the first four items below before you write the checkout code.** The core design is sound. The order of reserve, then charge outside the transaction, then settle, plus the provider idempotency key and the reconciliation job, is the right shape for 2,000 orders a day, and it isn't over-built. The problems are gaps and one missing safety rule, not a wrong approach.

## Blocking: decide before building

1. **No source for prices.** The flow takes "the cart", but nothing says who sets `unit_price` and `total`. There is no catalog or price table. If the client sends prices, anyone can buy a SKU at 1 cent. Decide where prices come from (a catalog table or another service), and have the server compute the total. Also say how the payment method reaches the provider, since the cart doesn't carry it.

2. **A crash between step 2 and step 3 has no defined outcome.** Case: the instance dies after the commit that reserves stock and creates the `PENDING` order, before any charge call. The reconciliation job asks the provider about that order and gets "no such charge". The design never says what happens next. Options are to fail the order and restore stock, or to retry the charge. Either choice can race with a slow in-flight charge. Without a rule, stock stays reserved until the 30-minute alert.

3. **State changes are not guarded, so stock can be restored twice.** Step 5 (decline) and the reconciliation job can both settle the same order. Case: the request thread is slow, reconciliation marks the order `FAILED` and restores 2 units, then the request thread's decline path restores 2 more. Stock is now 2 too high, which means overselling. Both paths also run on two instances. Fix: every transition is `UPDATE orders SET status=… WHERE id=… AND status='PENDING'`, and stock is restored only if that update changed a row, in the same transaction. Add a lock (or `FOR UPDATE SKIP LOCKED`) for the reconciliation job.

4. **The client can't learn the outcome of a `202`.** There is no `GET /orders/{id}`, and no response shapes for `201`, `202`, `409` or the decline case. A client holding a `202` has nothing to poll.

## High

5. **The idempotency key is unique across all customers.** The design says "unique constraint" on `idempotency_key` alone. Case: two customers' apps generate the same key, and the second gets the first customer's order back. Make it unique on `(customer_id, idempotency_key)`.

6. **Duplicate requests aren't fully specified.** Two cases are missing:
   - Two identical requests arrive at the same moment. The second hits the unique violation after it has already decremented stock. The rollback is correct, but the design should say the handler catches the violation and returns the existing order.
   - The same key arrives with a different cart. Reject it with `422`.
   - The first request may still be `PENDING`, so say what the duplicate returns in that case.

7. **The tests skip the riskiest parts.**
   - There are no reconciliation tests at all.
   - There is no concurrency test for the last unit (two simultaneous buyers, one wins).
   - Nothing covers a decline restoring stock.
   - Nothing covers a crash between steps.
   - Nothing covers two instances settling the same order.
   - Nothing covers the email queue failing.

8. **Provider errors aren't classified.** "Declined", "timeout" and "unknown" are the only outcomes. A `5xx`, a `4xx` validation error, a network reset and a rate limit each need a decision: retry, fail, or leave `PENDING`. A `400` should never be retried, and should never become `PENDING` forever.

## Medium

9. **The `PAID` commit and the email queueing aren't atomic.** Case: a crash between the commit and the enqueue means the order is paid and no email is ever sent. Nothing detects this. The context lists only Postgres, so the queue technology is also unnamed. The simplest fix is an outbox table written in the `PAID` transaction.

10. **The module rule conflicts with the transactions.** Orders and inventory are separate modules that may not read each other's tables, but step 2 needs one transaction across both. Name the mechanism, for example a unit-of-work or shared connection passed in by `OrderCheckout`. Otherwise this gets improvised during the build.

11. **Possible deadlocks when reserving several SKUs.** Case: one cart holds A then B and another holds B then A, and each locks one row. Sort items by SKU before updating.

12. **Request latency is unbounded for the client.** "Up to 3 retries" means 4 attempts. At 5 s each plus backoff, a request can run 25 seconds or more, which may exceed the load balancer's timeout. State the overall deadline, and decide whether to return `202` sooner.

13. **The schema is missing constraints and indexes.**
    - No primary keys on `orders` and `stock`, and no composite key on `order_items`.
    - No foreign keys.
    - No `CHECK (available >= 0)`, which is a cheap backstop against overselling.
    - No `CHECK` on `status`.
    - No index for the reconciliation query (`status, created_at`).
    - No unique index for the idempotency key.

## Low

14. **Monitoring is thin.** There is one alert, on a stuck `PENDING` order. Nothing alerts if the reconciliation job stops running, and there are no metrics (charge latency, retry counts, 409 rate).
15. **Reconciliation timing is loose.** It runs every 5 minutes and picks up orders older than 2, so the worst case is about 7 minutes. That is fine, but state it so the client-facing guidance matches.
16. **Provider idempotency retention is unstated.** Confirm the provider remembers an idempotency key longer than your longest reconciliation delay.
17. **`total` can disagree with the line items.** Either compute it from the items in code with a test, or state that it is derived.
18. **Missing lifecycle states.** There is no `CANCELLED` or `REFUNDED`, and no stock-expiry rule for abandoned `PENDING` orders. This is fine if it's out of scope, but say so in the doc.
19. **Housekeeping.**
    - The doc has no "out of scope" or "open questions" section.
    - There is no migration or rollout note.
    - The `409` should say which SKU is short.

Items 1 to 4 are about half a day of decisions, mostly written into the doc rather than coded. Items 5 to 8 can be settled while you build. The rest can follow as tickets.

VERDICT: READY WITH CHANGES
