Your design is sound at its core and you can start building tomorrow, but the reconciliation job (step 6) needs two gaps closed in the doc first, because both can corrupt stock counts. The rest are small additions.

## Fix before building the reconciliation job

**1. Step 6 doesn't say what happens when the provider has no record of the charge (high).**
- **Case:** an instance crashes after step 2 commits and before step 3 sends the charge. The order is `PENDING` with stock reserved, and the provider answers "no such charge".
- **Result:** the doc only allows `PAID` or `FAILED`, so the order stays `PENDING` forever and the units stay reserved. The 30-minute alert fires, but nothing resolves it.
- **Fix:** treat "not found" as `FAILED`. Also state that every `FAILED` settlement by the job restores stock, as step 5 does; step 6 currently doesn't say so.

**2. Status changes are not guarded, so stock can be restored twice (high).**
- **Case:** the doc doesn't say where the job runs, and there are two instances. Both run it, both see order A as `PENDING` and declined, and both mark it `FAILED` and restore stock.
- **Result:** a 1-unit order puts 2 units back, `available` is one too high, and you later sell a unit you don't have.
- **Fix:** make every transition conditional (`UPDATE orders SET status = 'FAILED' WHERE id = :id AND status = 'PENDING'`) and restore stock only if that changed a row. Apply the same rule to steps 4 and 5.

## Fix during the build

**3. Confirmation email can be lost or never sent (medium).**
- Step 4 queues the email after the commit, so a crash between the two leaves a paid order with no email.
- Step 6 never mentions email, so orders the job settles as `PAID` get none. Those customers only saw a `202`, so they need it most.
- **Fix:** a job that sends for `PAID` orders with no `confirmation_sent_at`, or an outbox row written in the same transaction as `PAID`.

**4. Idempotency key scope and mismatched retries are undefined (medium).**
- **Case:** a client retries with the same key after adding an item to the cart. It gets back the old order with the old total and believes the new cart was ordered.
- **Fix:** store a hash of the request and return `422` when the same key arrives with a different body.
- Also make the unique constraint `(customer_id, idempotency_key)`, so one customer's key can never return another customer's order.

**5. The test plan skips the riskiest paths (medium).**
- There are no tests for the reconciliation job: provider says paid, declined, not found, or is still unreachable.
- There are no concurrency tests: two simultaneous requests with the same key, two buyers racing for the last unit, and the job running twice on one order.

**6. Concurrent multi-item orders can deadlock (low).**
- **Case:** order 1 updates SKU A then B while order 2 updates B then A. Postgres aborts one, and that customer gets a `500` instead of an order.
- **Fix:** update SKUs in sorted order.

**7. The data model lists no keys or constraints (low).**
- Add primary keys, the foreign key from `order_items.order_id`, and `CHECK (available >= 0)`.
- Add a `CHECK` on `status`, and a column for the provider's charge id, which refunds and support will need.

**8. The doc doesn't say how a client that got `202` learns the outcome (low).**
- Add `GET /orders/{id}` to the doc.

## Verify, not confirmed problems

- **Provider lookup:** step 6 assumes the provider can look up a charge by your order id. Some only look up by their own charge id, which you won't have after a timeout. Check this tomorrow morning, because the job depends on it.
- **Request duration:** four attempts at 5 s plus backoff can hold a request for about 30 s. Check that the load balancer timeout is longer.
- **Prices:** the doc doesn't say where `unit_price` comes from. It should be looked up on the server, never taken from the cart payload.

## What is already right

- Charging outside the transaction, with the order id as the provider's idempotency key.
- The conditional stock update, which prevents overselling.
- Email that never fails the order.
- The `PENDING` alert.
- The module boundaries.
- The size of the design: it fits 2,000 orders a day and a team of four, and needs no extra infrastructure.

VERDICT: READY WITH CHANGES
