**Not ready to build from. The payment step can charge a customer twice or charge them and lose the order. The fix is a small edit to steps 3 to 6, so you can still start tomorrow once the design is updated.**

## Must fix before building

**1. The charge retry can double-charge (step 4).**
- A 5 s timeout doesn't mean the charge failed. The provider may have taken the money and answered slowly.
- Retrying up to 3 times then charges the card again. Case: a $50 cart times out on try 1 after the provider already charged. Try 2 charges again, and the customer pays $100 for one order. The expected result is one $50 charge.
- The design needs an idempotency key on every charge call, for example the order id. It also needs to say how a timeout is told apart from a decline. Retrying a decline is wrong.

**2. A charge can succeed while the order is lost (steps 3, 5, 6).**
- The `PENDING` insert sits inside an uncommitted transaction. If the service crashes, or the final commit fails, after the provider has charged, the insert rolls back. The customer is charged and no order exists.
- Step 6 has the same flaw. If every retry times out, it rolls back and returns an error, but one of those charges may have gone through.
- Commit `PENDING` first, then charge, then update to `PAID` or `FAILED` in a second step.
- Add a reconciliation job that asks the provider about any order stuck in `PENDING`.
- Without this, any failure between the charge and the commit leaves a charged customer with no order.

**3. The database transaction stays open during the payment call (steps 3 to 5).**
- Three 5 s retries means the transaction can be open for 15 s or more, holding a connection the whole time.
- At 2,000 orders a day that's survivable. It's still the wrong shape, and it goes away with the fix in item 2.

**4. A client retry creates a duplicate order (step 1).**
- `POST /orders` has no idempotency key from the client. If the client's network drops and it resends, you get two orders and two charges.
- Require an `Idempotency-Key` header and enforce it with a unique constraint.

## Should fix (decide, then write it down)

- **Overselling.**
  - The stock cache can be 5 minutes stale, and nothing reserves or decrements stock on order.
  - Two buyers can both get the last item.
  - At your volume that may be fine. The design should say so, and say what happens when the warehouse later reports there's no stock, such as a refund or backorder.
- **Email failure.** Step 5 doesn't say what happens if the confirmation email fails. It should not fail or undo a paid order. A retried background send is enough.
- **Backups.**
  - Nightly backups on a single instance means a crash can lose up to a day of orders and payment records.
  - Once payments are involved, that's a real risk.
  - At minimum, enable point-in-time recovery (WAL archiving), or record that you're accepting the risk.

## Tests don't match your standards
The plan is unit tests plus one happy-path integration test. The risky parts are the failure paths, and none of them is tested. Add these tests before writing the flow:
- Charge times out and then succeeds on retry, with exactly one charge made.
- Charge is declined, and the order ends `FAILED`.
- Process crashes after charging and before the final update, and reconciliation fixes the order.
- Duplicate `POST /orders` with the same key returns the same order.
- Email failure leaves the order `PAID`.

## What's good
The module boundaries, thin routes, the `OrderCheckout` service class and logging with the order id are sound. The decision to accept the stale cache is reasoned and fits the volume.

VERDICT: NOT READY
