# Checkout Module

Locking, payment, purchase/order creation.

## Responsibilities
- Cart validation (items active, stores active, minimums met)
- Price and shipping calculation (per-store grouping)
- Redis checkout locking (atomic, Lua script)
- Stripe PaymentIntent creation
- Webhook handling (payment_intent.succeeded)
- Purchase/Order/OrderItem creation
- Discount application

## Key Rules
- Amount is ALWAYS calculated server-side — frontend never sends prices
- Lock TTL: 10 minutes, extended +5 min when PaymentIntent created
- All order creation happens inside a DB transaction
- OrderItems are immutable snapshots — write-once, never updated
- Partial failures handled per-store (some stores can fail, others succeed)
