**Not quite ready to build as written, but close.** The core design is sound: the stock reservation is atomic, the charge happens outside a transaction, and the provider-side idempotency key is there. The gaps are all in step 6 and how it interacts with steps 3 to 5. You can fix them in about an hour of editing before you start.

## Must fix before building

**1. Two writers can settle the same order, and stock gets restored twice.**
- The request handler (step 5) and the reconciliation job (step 6) both move an order out of `PENDING`. Nothing says the update is conditional.
- Take an order that times out. The handler gets a late decline and marks it `FAILED` and restores stock. The reconciler then reads a stale `PENDING` row, asks the provider, gets "declined", and restores stock again. Available stock is now inflated, so you oversell.
- Fix: make every transition `UPDATE orders SET status=… WHERE id=:id AND status='PENDING'`. Restore stock only if that update changed a row. Add a legal-transitions rule: `PENDING` goes to `PAID` or `FAILED`, and nothing else.

**2. The reconciler has no answer for "provider has never heard of this charge."**
- The service can crash after step 2 commits and before step 3 sends the charge. That leaves a `PENDING` order the provider has no record of, with stock held.
- The design doesn't say what the reconciler does when the provider says "not found". Marking it `FAILED` is wrong if a charge request is still in flight. Waiting forever holds stock until the 30-minute alert fires.
- Fix: decide explicitly. One option is to re-send the charge with the same order-id key, since that is safe. Another is to fail the order only after an age threshold well beyond the retry window. Either way, write down the retry window arithmetic: 4 attempts × 5 s plus backoff must be well under the 2-minute reconciler cutoff.

**3. The reconciler runs on both instances.**
- You have two instances, and the design doesn't say the job is singleton. Both will settle the same orders at once. Fix #1 makes this safe, but you should still lock rows with `FOR UPDATE SKIP LOCKED` or elect a single runner, so the provider isn't queried twice per order.

**4. A late success after `FAILED` has no path.**
- If an order is marked `FAILED` and money was actually taken, nobody refunds it. The design should say either "reconciler never fails an order without a definitive provider answer" or "a refund job exists." Fix #2 largely covers this, but state it.

## Should fix (these will bite during the build)

- **Idempotency key scope.** The unique constraint is on `idempotency_key` alone, so it is global across customers. One customer's key can return another customer's order. Make it unique on `(customer_id, idempotency_key)`. Also say what happens when the same key arrives with a different cart. A `422` is the usual answer. As written, it silently returns the old order.
- **Concurrent duplicates.** Two simultaneous requests with the same key will both reserve stock. One then fails on the unique insert and rolls back, which is correct. The design must say the loser re-reads and returns the winner's order instead of returning a `500`.
- **Deadlocks on multi-item carts.** Two carts with `A,B` and `B,A` will lock stock rows in opposite orders. Sort items by SKU before updating.
- **Prices must come from the server.** `unit_price` and `total` are never said to be server-computed. If the client supplies them, anyone can pay 1 cent.
- **Email can be lost.** In step 4 the order commits and then the email is queued. A crash between the two drops the email silently. A transactional outbox row written in the same commit fixes this, or you can accept the loss and name it as a tradeoff.
- **Schema gaps.** The data model has no primary keys, foreign keys, or indexes. You need `stock.sku` as the primary key and an `order_items → orders` foreign key. You also need an index on `(status, created_at)` for the reconciler, or it will scan the whole table.

## Tests are missing the hardest cases

The test list covers the happy paths. It has nothing for:
- the reconciler (settle as `PAID`, settle as `FAILED`, "not found", two runners at once)
- the handler and reconciler racing on one order
- a crash between steps 2 and 3
- a decline restoring stock exactly once
- two concurrent identical `POST`s
- two opposite-order carts (deadlock)
- an email failure not affecting the order

Fix #1 is the most important to cover with a test, ideally written before the code.

## What is good

- Ordering is right: reserve and insert, charge outside a transaction, then settle.
- The provider idempotency key is sent on every retry.
- `202` plus reconciliation is the correct shape for unknown outcomes.
- The 30-minute alert is a real safety net.
- Scale is modest, so one Postgres and `UPDATE … WHERE available >= :qty` is the right amount of machinery. Don't add more.

VERDICT: READY WITH CHANGES
