**The design is sound enough to start building tomorrow, but one gap can corrupt stock counts and should be fixed in the doc first.** A few smaller rules are also unstated and are worth an hour tonight.

## Fix before building

**1. Settling an order is not guarded against running twice (steps 4–6).**
- **Failing case:** Both instances run the 5-minute reconciliation job. Each picks up the same `PENDING` order for 1 unit of SKU A, each hears "declined" from the provider, and each marks it `FAILED` and restores stock.
- **Wrong output:** `available` rises by 2, so you later sell a unit you don't have. Expected: it rises by 1.
- **Fix:** Make every status change conditional: `UPDATE orders SET status = … WHERE id = :id AND status = 'PENDING'`. Restore stock or queue the email only if that update changed a row.
- **Also:** Run the job on one instance at a time, with a Postgres advisory lock or `SELECT … FOR UPDATE SKIP LOCKED`.

**2. The reconciliation job's outcomes are underspecified (step 6).**
- **Provider has no record of the charge:** This happens if an instance crashes between the step 2 commit and the step 3 call. The doc should say this becomes `FAILED` with stock restored.
- **Provider says the charge is still processing:** The doc should say the order stays `PENDING`.
- **Job settles an order as `PAID`:** It must queue the confirmation email, or customers whose request timed out never get one.
- **Job settles an order as `FAILED`:** It must restore stock; step 5 says this only for the in-request path.

**3. The idempotency key's uniqueness scope is not stated (step 1).**
- **Failing case:** If the key is unique globally, customer B sending a key that customer A already used gets A's order back.
- **Fix:** Make it unique on `(customer_id, idempotency_key)`.
- **Also decide:** What happens when the same key arrives with a different cart; the usual answer is `422`.

**4. The doc doesn't say where prices come from.**
There is no price table, and step 1 says the client sends the cart. If `unit_price` and `total` come from the client, a customer can set their own price. State which server-side source prices are read from.

## Smaller additions

- **Deadlocks in step 2:** Two orders reserving SKUs A and B in opposite order can deadlock. Reserve in sorted SKU order.
- **Lost email in step 4:** A crash between the `PAID` commit and queueing loses the email, and nothing retries it because the order is no longer `PENDING`. Either accept this explicitly or write an "email owed" row in the same transaction.
- **Missing constraints:** Add a primary key on `stock.sku`, a primary key on `order_items`, `CHECK (available >= 0)`, and an index on `(status, created_at)` for the job.
- **After a `202`:** Name the endpoint the client polls for the result, presumably `GET /orders/{id}`.
- **Request duration:** Four 5-second attempts plus backoff approaches 30 seconds. Check that the load balancer timeout is longer.
- **Module boundary:** Steps 2 and 5 span orders and inventory in one transaction. Say that `OrderCheckout` owns the transaction and calls each module's API inside it, so the "no module reads another's tables" rule holds.

## Test plan gaps

The listed tests cover the request path only. Add:
- Reconciliation job tests for each provider answer: paid, declined, not found, still processing.
- The job running twice on the same order, asserting stock is restored once.
- Two concurrent requests for the last unit, asserting one `201` and one `409`.
- Two concurrent requests with the same idempotency key.
- A crash after a successful charge but before `PAID` is written, asserting the job settles it and sends the email.

## What is already right

- Stock is reserved with a conditional update, which prevents overselling.
- The payment call is outside any database transaction.
- The order id is the provider idempotency key, so retries cannot double-charge.
- Unknown outcomes are left `PENDING` rather than guessed.
- The scale fits one Postgres and two instances without extra infrastructure.

VERDICT: READY WITH CHANGES
