**Short answer:** the design is solid and close, with one real problem to fix before you build. Splitting orders, payments and inventory into separate modules, keeping routes thin, and logging the order id on every line are all good choices. The cache decision and the single Postgres instance are reasonable for 200 to 2,000 orders a day.

## Fix before building: the payment step can charge a customer and lose the order

Steps 4 to 6 have a gap, because a timeout doesn't mean the charge failed.

Here is a concrete case:
1. The provider charges the card, but the response is slow and takes more than 5 s.
2. We time out and retry. Without an idempotency key, the second call can charge the card again.
3. If all 3 retries time out, step 6 rolls back and tells the client it failed. The customer has been charged, and there is no order row to show for it.

The same thing happens if the commit in step 5 fails after the charge succeeded.

**Changes (all small):**
- Generate an idempotency key per order, such as the order id, and send it on every charge attempt. Most providers support this. It makes retries safe.
- After the retries are exhausted, don't roll back to nothing. Keep the order in a `PAYMENT_UNKNOWN` state, or commit it as `PENDING`. Then have a small reconciliation job ask the provider for the charge status by key and settle the order.
- Consider committing the `PENDING` insert before calling the provider. That way the transaction isn't open for up to about 15 s (3 × 5 s) while the provider call runs, and the order exists whatever happens next.

## Smaller items (not blockers)

- **Email after commit:** say what happens if the send fails. For example, log it and retry from a flag on the order. Today a failed send is silently lost.
- **Stock cache:** with a 5-minute refresh and no reservation, two buyers can both get the last item. This is probably fine at your volume. Just note that oversold orders will happen and say who handles them.
- **Backups:** nightly backups on a single instance mean a crash can lose up to a day of orders and payments. This is acceptable now, but it's worth a note, and point-in-time recovery is a cheap upgrade later.

## Tests

The plan covers the happy path only, and the payment step is where the risk is. Add integration tests for:
- a charge timeout followed by a successful retry (check that the same key is reused);
- all retries timing out;
- a payment decline;
- a failure after the charge succeeds.

Write these first, since they define the behavior in the section above.

None of this should push your start date back. The state change and the idempotency key are about a day of design work, and you can fold them into the first build steps.

VERDICT: READY WITH CHANGES
