The design is close to ready. The core flow is sound: reserving stock before charging, using the order id as the provider's idempotency key, and keeping the charge outside the transaction are all the right calls. The problems below are mostly gaps in the failure paths, and you can settle them in a short design pass before you start coding.

## High (decide before writing code)

1. **A crash after step 2 leaves an order that nothing ever charges.** The service commits `PENDING` plus the stock reservation, then dies before calling the provider. The client retries with the same key and gets the existing `PENDING` order back, and nobody charges it. The reconciler asks the provider about a charge that doesn't exist, and the design doesn't say what happens next. Decide the rule. For example: if the provider has no charge, the reconciler either charges it or marks it `FAILED` and restores stock.

2. **Settling an order isn't safe against concurrent runs.** Two instances run the 5-minute job, and a slow request can still be working on the same order. Case: both settle order X as `FAILED`, and stock is restored twice, so `available` is now higher than reality and you oversell. Fix: do every status change as `UPDATE … WHERE status='PENDING'` and restore stock only if that update changed a row. Have the job claim rows with `FOR UPDATE SKIP LOCKED`. Step 6 also never says that settling as `FAILED` restores stock.

3. **The reconciler has no "still processing" outcome, and no refund path.** Step 6 settles only as `PAID` or `FAILED`. If the provider says the charge is still in flight or not found yet, and you mark `FAILED`, the charge can land later and the customer pays for an order that was cancelled. Add a "leave it `PENDING`" outcome and decide who refunds a late charge.

4. **The design depends on an unverified provider feature.** Reconciliation needs the provider to look up a charge by your idempotency key or order id. Nothing says that's confirmed. Check the provider's docs first, since the whole of step 6 depends on it.

5. **"No module reads another module's tables" contradicts steps 2 and 5.** Step 2 changes `stock` and inserts into `orders` in one transaction. Step 5 does the same on failure. Either the transaction spans modules, which breaks the rule, or you need a defined mechanism. For example, `OrderCheckout` owns the transaction and passes it into the orders and inventory modules. Name the choice.

6. **Email can be lost between commit and enqueue.** If the service crashes after committing `PAID` and before queueing the email, the confirmation never goes out. The queue also isn't in the infrastructure list. Use a transactional outbox, which is an `outbox` row written in the same transaction as `PAID`, or state that losing an email is acceptable.

## Medium

7. **The data model leaves out constraints.** It has no primary keys, foreign keys, or indexes. Specifically:
   - The unique constraint on `idempotency_key` is not in the table.
   - It should be unique per `customer_id`, not global. Otherwise one customer's key can collide with another's.
   - `stock.available` needs `CHECK (available >= 0)`.
   - The reconciler needs an index on `(status, created_at)`.

8. **Concurrent duplicate requests aren't specified.** Two identical `POST`s arrive together. The second hits the unique violation, but the first hasn't committed, so there's no "existing order" to return yet. Specify the handling, for example: catch the violation, re-read, and return the winner. Also say what happens when the same key arrives with a different cart. The usual answer is `422`.

9. **Deadlocks on multi-item carts.** Case: request A reserves SKU1 then SKU2, and request B reserves SKU2 then SKU1. They deadlock. Sort SKUs before updating. Also say what happens when a cart lists the same SKU twice, or has a quantity of 0 or less.

10. **Where do prices and `total` come from?** If the client's cart carries `unit_price`, the client sets what it pays. Say that the server looks prices up and computes `total`.

11. **The API contract is incomplete.**
    - There is no `GET /orders/{id}`, so a client holding a `202` can't learn the outcome.
    - `409` is used for out-of-stock, and it's a natural choice for idempotency conflicts too, so the two will be confused.
    - The response for a declined payment isn't defined.
    - Authentication and ownership checks aren't mentioned.

12. **The request can hang for 20 seconds or more.** Four attempts at 5 s each, plus backoff, will exceed most load balancer and client timeouts. The client then retries, which is safe because of the key, but pick the timeouts on purpose. Also say which errors are retried: network errors and 5xx, never declines or 4xx.

13. **The tests skip the hardest parts.** The list has no reconciler tests at all. These are missing:
    - reconciler settles `PAID` and `FAILED`
    - two reconciler runs on the same order
    - concurrent duplicate keys
    - two buyers racing for the last unit
    - a multi-item cart where the second item is out of stock and the first is rolled back
    - decline restores stock
    - email failure doesn't fail the order
    - a crash between steps 2 and 3

## Low

14. The retry policy has no jitter or backoff cap, and the exact delays aren't given.
15. Alerting covers only old `PENDING` orders. Add alerts for the reconciler not running, email queue depth, and a spike in `FAILED`.
16. One Postgres is a single point of failure. PITR is a backup, not failover. That's fine at 2,000 orders a day, but write it down as a deliberate choice.
17. The only statuses are `PENDING`, `PAID`, `FAILED`. There is no cancelled or refunded state. Say that's out of scope for this revision.
18. The design has no file or module layout and no migration or rollout notes. Your standards ask for the layout and test plan up front, so add a short section before building.
19. Make the stock restore idempotent by deriving it from `order_items`, and note that logs must never contain card data.

**Suggested path for tomorrow:** spend the first hour on items 1–6, and write the answers into revision 4. Then write the tests from item 13 first and build to them.

VERDICT: READY WITH CHANGES
