**Not quite ready, but close.** The core design is sound for 200–2,000 orders a day. The charge happens outside the DB transaction, retries use a stable idempotency key, and there's a reconciliation job. But there are gaps that could leave stock stuck or double-restored. They are cheap to fix in the doc today. You could start on the schema and the happy path tomorrow.

## Must fix before building

1. **An order can stay `PENDING` forever if the service crashes after step 2 commits but before the charge is sent.**
   - The provider has no charge, so the reconciler asking it for status gets "not found".
   - The doc doesn't say what happens then. The stock stays reserved and the alert fires at 30 minutes, but nothing resolves it.
   - Decide: "not found" means either retry the charge or mark `FAILED` and restore stock. I'd retry the charge using the order id, since that is safe with the idempotency key.

2. **Two writers can settle the same order, and stock can be restored twice.**
   - Example: a request times out, the client gets `202`, and the charge actually succeeds. The in-flight request and the reconciler both try to settle the order. If one marks it `FAILED` and restores stock while the other marks it `PAID`, you have a paid order with released stock.
   - Fix: every settlement is `UPDATE orders SET status=… WHERE id=:id AND status='PENDING'`. Restore stock only if that update changed a row.
   - Step 6 also never says that settling as `FAILED` restores stock. It must.

3. **The reconciler runs on both instances.** Specify one of: `SELECT … FOR UPDATE SKIP LOCKED`, an advisory lock, or running it on a single instance.

4. **The idempotency key's scope and the concurrent-duplicate case are undefined.**
   - A globally unique key can collide across customers. Make it unique on `(customer_id, idempotency_key)`.
   - Two simultaneous requests with the same key: the loser hits the unique violation inside the step 2 transaction. Per the doc that is a `409` "out of stock". It should return the existing order.
   - A repeated key with a different cart should be rejected (`422`) rather than silently returning the old order.

5. **The confirmation email can be lost.** If the process dies between the `PAID` commit and queueing the email, no email is ever sent. Either write an outbox row in the same transaction as `PAID`, or accept the loss and say so. The doc also doesn't name the queue technology.

## Should fix (small)

- **Deadlocks:** stock updates for several SKUs can lock rows in different orders across concurrent orders. Sort SKUs before updating, and merge duplicate SKUs in one cart.
- **Pricing:** the doc doesn't say whether `unit_price` and `total` come from the server or the client. They must come from the server.
- **Schema gaps:**
  - No primary keys, foreign keys or indexes are listed. An index on `(status, created_at)` is needed for the reconciler.
  - No `CHECK` on `status`.
  - No column for the provider's charge id.
- **Error handling:** don't treat every provider error as retryable. Split declines, 4xx errors and 5xx/timeouts.

## Tests

The list covers the checkout flow well but misses the riskiest parts. Add:
- the reconciler, covering `PAID`, `FAILED` and "not found";
- the reconciler racing an in-flight request;
- concurrent duplicate keys;
- two orders competing for the last unit of stock;
- stock restored exactly once;
- email failure not failing the order.

Per your standards, write these tests before the matching code.

VERDICT: READY WITH CHANGES
