**Your design is close to ready. It needs about a day of tightening before you build, and most of the fixes are one-line decisions.**

**What's strong**
- The charge happens outside the database transaction. This is the mistake most checkout designs make.
- You send the order id as the provider's idempotency key, so retries can't double-charge.
- The conditional `UPDATE ... WHERE available >= :qty` prevents overselling without explicit locks.
- The reconciliation job and the 30-minute `PENDING` alert show you've thought about the "unknown" outcome.
- A failed email never fails the order.

**Settle these before writing code**
1. **The module rule contradicts step 2.** "No module reads another module's tables" conflicts with one transaction that updates `stock` and inserts into `orders`. Pick one:
   - Inventory and orders share a transaction that `OrderCheckout` passes in.
   - Inventory exposes a `reserve(tx, items)` function.

   I'd choose the second because it keeps the module boundary.
2. **Status changes need a guard.** The request thread and the reconciliation job can both settle the same order. Every change from `PENDING` should be `UPDATE ... WHERE status = 'PENDING'`, and the stock restore should only run if that update changed a row. Otherwise stock can be restored twice, or a `PAID` order can flip to `FAILED`.
3. **Say what reconciliation does when the provider has no record of the charge.** This happens if the process crashes after step 2 commits but before the charge call. I'd treat "not found" as `FAILED` and restore stock, but only once the order is older than your longest possible retry window. Write that rule down.
4. **Two instances both run the reconciliation job.** Use `SELECT ... FOR UPDATE SKIP LOCKED` or an advisory lock so they don't both settle the same order.
5. **Reserve multiple SKUs in a fixed order, such as sorted by `sku`.** Two carts with the same items in different orders will otherwise deadlock.
6. **The client has no way to learn the outcome of a `202`.** Add `GET /orders/{id}`, and list the response codes for `POST /orders` (201, 200 for a repeated key, 202, 402 or 409 for a decline, 409 for no stock).
7. **Say where `unit_price` and `total` come from.** If the client sends prices in the cart, a client can set its own price. Compute them server-side.
8. **Define "declined" versus "unknown".** For example, a provider 4xx decline is `FAILED`, while a timeout or 5xx is unknown and gets retried.

**Smaller items you can accept as known debt**
- **Lost email on a crash.** A crash between the `PAID` commit and queueing the email loses the email. At 2,000 orders a day, a small outbox table fixes it later.
- **Missing keys and constraints.** `stock` and `order_items` have no primary keys or foreign keys listed, and `idempotency_key` is probably better unique per customer. Add `CHECK (available >= 0)` on `stock` as a backstop.
- **Long requests.** The synchronous charge can hold a request for 20 seconds or more with 4 attempts at 5 s each plus backoff. That's fine now, but note it.
- **Not mentioned at all:** authentication, how the payment method reaches the provider, and refunds.

**The test plan is missing the riskiest part.** None of the six integration cases exercise reconciliation. Add:
- Reconciliation settles a `PENDING` order as `PAID`.
- Reconciliation settles a `PENDING` order as `FAILED`, and stock is restored exactly once.
- Reconciliation finds no provider record.
- The request thread and reconciliation race on the same order.
- Two concurrent requests with the same idempotency key.
- A multi-SKU cart that contends with another cart (the deadlock case).

Writing these first fits your TDD approach and will pin down items 2 to 5 before any implementation.

You can start tomorrow. Spend the first hour amending design.md for items 1 to 8, then begin with the failing reconciliation and duplicate-key tests.

VERDICT: READY WITH CHANGES
