Typical lifecycle
Cart validation → address/shipping selection → server-side total calculation → payment initiation/confirmation → order persistence → fulfillment and status updates. The exact sequence may vary by payment method and implementation.Order integrity
- Snapshot item names, SKUs, prices, tax, discounts, and quantities at purchase time.
- Use database transactions for related writes where appropriate.
- Make retries and payment callbacks idempotent.
- Validate that a caller can access the requested order.
- Keep payment status separate from fulfillment/order status if the data model does so.
- Audit manual status changes and refunds.
