**The design is sound at its core and you can start building tomorrow, provided you make four additions first.** Each is a few lines in the doc, not a redesign.

The parts that usually go wrong are already right: stock is reserved with a guarded update, the charge happens outside the transaction, the provider gets the order id as its idempotency key, and unknown results go to a reconciliation job with an alert behind it.

## Fix before building

1. **The reconciliation job can restore stock twice.** Step 6 does not say where the job runs or how it settles an order. With two instances both running it, both see order A as `PENDING`, both get "declined" from the provider, and both mark it `FAILED` and add the stock back. A SKU with 5 available and one failed order of 2 ends up at 9 instead of 7.
   - Make every status change conditional: `UPDATE orders SET status = 'FAILED' WHERE id = :id AND status = 'PENDING'`.
   - Restore stock only if that update changed a row, in the same transaction. Apply the same rule to steps 4 and 5.

2. **The reconciliation job has no rule for "provider has never heard of this order".** If an instance crashes after step 2 commits and before step 3 calls the provider, the order is `PENDING` with no charge. Step 6 only allows `PAID` or `FAILED`, so the order holds its stock forever and the 30-minute alert fires with no defined remedy.
   - Charge not found: mark `FAILED` and restore stock.
   - Charge still processing: leave `PENDING`.
   - State explicitly that a `FAILED` settlement by the job restores stock, as step 5 does.

3. **The idempotency key is unique across all customers.** If customer B sends a key that customer A already used, step 1 returns A's order to B.
   - Make the unique constraint `(customer_id, idempotency_key)`.
   - Decide what happens when the same key arrives with a different cart; I recommend rejecting it with `422`.

4. **The design does not say where `unit_price` and `total` come from.** If they come from the cart the client sends, a client can set its own price. State that the service looks up prices itself and computes the total. That also means naming which module owns prices, since none of the three tables holds them.

## Add in the first week

- **Confirmation email for orders settled by the job.** Step 4 queues the email only on the request path. An order that becomes `PAID` through reconciliation gets none, and neither does one where the instance dies between the commit and the queueing. Have one "mark paid" function that both paths call, and record that the email was queued.
- **Deadlocks between overlapping carts.** Order 1 reserves SKU X then Y while order 2 reserves Y then X. Postgres aborts one of them and the customer sees a `500`. Reserve SKUs in sorted order.
- **How the client learns the outcome after a `202`.** Add `GET /orders/{id}` to the design.
- **Missing schema details.**
  - A primary key on `order_items`.
  - A `CHECK (available >= 0)` on `stock`.
  - A column on `orders` for the provider's charge reference, which support and refunds will need.
- **Worst-case request time.** Four attempts at 5 s plus backoff is roughly 30 s. Check that the load balancer and client timeouts are longer, or reduce the retries.

## Test plan additions

The listed integration tests cover the request path well. Add these:

- Two simultaneous buyers for the last unit: exactly one succeeds.
- The reconciliation job for each provider answer: paid, declined, not found, still processing.
- The job running twice on the same order: stock is restored once.
- The same idempotency key from two different customers.

VERDICT: READY WITH CHANGES
