**Short answer:** the core design is sound, but fix a few gaps before you start. Most are small. The first two would cause real bugs.

## Must fix before building

1. **Stock is never restored when reconciliation settles an order as `FAILED`.**
   - Step 5 restores stock on a decline. Step 6 only says reconciliation "settles" orders, and it doesn't mention stock.
   - Failing case: a charge times out four times, so the order is left `PENDING` and the client gets `202`. The provider later reports the charge as declined. Reconciliation marks the order `FAILED`, but the reserved units are never put back. Stock leaks permanently.
   - Fix: put "mark `FAILED` and restore stock" in one shared operation that both step 5 and the job call.

2. **Nothing stops stock being restored twice, or two settlements racing.**
   - There are two instances, so the reconciliation job runs on both. The request path can also settle the same order.
   - Fix: make every status change conditional, for example `UPDATE orders SET status=… WHERE id=:id AND status='PENDING'`. Restore stock only if that update changed a row. Alternatively, have the job take a lock, such as `SELECT … FOR UPDATE SKIP LOCKED`.

3. **"Provider has no record of this charge" has no defined outcome.**
   - Failing case: the service crashes after step 2 commits and before the charge is sent. The order is `PENDING`, and the provider has never seen it.
   - The design must say what reconciliation does here. The likely answer is to treat "not found" as `FAILED` and restore stock, or to retry the charge. Pick one and write it down.

## Should fix (cheap now, costly later)

- **Lost confirmation email.** Step 4 commits `PAID` and then queues the email. A crash between the two loses the email silently. Either write an outbox row in the same transaction as `PAID`, or state that you accept this loss.
- **Where do `unit_price` and `total` come from?** If they come from the client's cart, a client can set its own prices. Say the server looks prices up and computes the total.
- **Schema constraints are missing.**
  - Add a primary key on `stock.sku`.
  - Add a primary key or index on `order_items`.
  - Add a `CHECK` on `status`.
  - Add `CHECK (available >= 0)`.
  - Add an index on `(status, created_at)` for the reconciliation query.
  - Decide whether the idempotency key is unique globally or per customer.
- **Idempotency edge case.** Say what happens when a repeated key arrives with a different cart. Returning the old order silently is risky. `422` is the usual answer.
- **Retry rules.** State that only timeouts and 5xx responses are retried, and that a decline is final.

## Test plan gaps

The listed cases are good, but these are missing:
- Reconciliation itself, which is where most of the risk is: settles to `PAID`, settles to `FAILED` with stock restored, and provider reports "not found".
- Two concurrent `POST /orders` with the same key.
- A decline restores stock.
- Two reconciliation runs at the same time settle an order only once.

## What is already good
The charge runs outside the transaction. The provider receives the order id as its idempotency key. The stock reservation is a single conditional `UPDATE`. There is a 30-minute alert on stuck orders. Module boundaries and the load assumptions are sensible. Postgres with two instances is plenty for 2,000 orders a day.

Add the fixes above to design.md, and then you can build.

VERDICT: READY WITH CHANGES
