**The design is not quite ready to build as written, but it is close: three gaps need a written decision first, and each is a few lines in the doc, not a redesign.** The core is sound: the conditional stock update prevents overselling, the provider idempotency key prevents double charges, and no transaction is held open across the payment call.

## Fix before building

1. **Reconciliation has no rule for "the provider has never heard of this order".**
   - Case: the instance crashes after step 2 commits and before step 3 sends the charge. The order is `PENDING` with stock reserved, and the provider answers "not found", which is neither `PAID` nor `FAILED`.
   - Result: the order stays `PENDING` and holds stock until the 30-minute alert brings in a human. Expected: it settles on its own.
   - Fix: state the rule. The simplest is to treat "not found" as `FAILED` and restore stock.

2. **Status changes are not guarded, so stock can be restored twice.**
   - Case: the reconciliation job runs on both instances at once and both see order A as `PENDING` and declined. Each marks it `FAILED` and adds the stock back, so `available` ends up 1 too high and you can oversell.
   - Fix: make every transition `UPDATE orders SET status = ... WHERE id = :id AND status = 'PENDING'`, and only restore stock or queue the email if a row changed. This also covers the request path racing the job.

3. **The design does not say where prices come from.**
   - Case: `POST /orders` carries "the cart" and there is no price table. If `unit_price` is taken from the request, a client can send 0.01 and be charged that.
   - Fix: state that prices and `total` are computed server-side, and name the source.

## Should fix; cheap to do now

4. **The idempotency key is globally unique.** Two customers sending the same key means the second gets the first customer's order back. Make the constraint `(customer_id, idempotency_key)`. Also decide what happens when the same key arrives with a different cart; I would return `422`.
5. **Concurrent duplicate requests are not handled.** Two requests with the same new key both pass the "does it exist" check, and the second hits the unique constraint. Without handling, that is a `500` where the existing order should be returned.
6. **The confirmation email can be lost or skipped.** A crash between "commit `PAID`" and "queue email" drops it. Step 6 also does not say the reconciliation job queues an email when it settles an order as `PAID`.
7. **Multi-item orders can deadlock.** Order A updates sku1 then sku2 while order B updates sku2 then sku1; Postgres aborts one with an error. Update stock rows in sorted sku order.
8. **Reconciliation depends on an unverified provider capability.** Confirm your provider can look up a charge by your order id or idempotency key, and how long it retains those keys.
9. **The test list misses the riskiest paths.** Add:
   - reconciliation for each outcome: paid, declined, not found;
   - two concurrent buyers of the last unit (the listed test may be single-buyer);
   - concurrent duplicate `POST`;
   - decline restores stock;
   - both instances reconciling the same order.

## Minor

10. **A `202` leaves the client with no stated way to learn the outcome.** Add `GET /orders/{id}` or say what the client polls.
11. **The request can last about 27 s in the worst case** (4 attempts × 5 s plus backoff). Check that the load balancer and client timeouts exceed that, or cut the retries.
12. **Step 3 does not say which errors are retried.** It should be timeouts and 5xx only, never declines or 4xx.
13. **The schema is missing constraints.** Add primary keys on all three tables, a foreign key on `order_items.order_id`, a `CHECK` on `status` and on `available >= 0`, and an index for the reconciliation query on `(status, created_at)`.
14. **The module rule conflicts with steps 2 and 5.** "No module reads another module's tables" needs a note on how orders and inventory share one transaction, for example the checkout service passing the transaction to both.
15. **Retrying after a `FAILED` order is undefined.** The same key returns the failed order, so say that the client must send a new key.
16. **Scope is unstated for cancellations, refunds and payment methods needing customer action (such as 3-D Secure).** If they are out for this revision, say so; they will add statuses later.
17. **The 30-minute alert has no runbook.** Say who gets paged and what they do.

VERDICT: READY WITH CHANGES
