Milestone 5.2f — Invoice PDF generation and download
Status: Shipped (preview)
Tracking: ehx-api#16
Behavior
When a checkout session reaches confirmed, the API:
- Upserts subscription (existing)
- Creates an
invoicesrow (idempotent percheckout_session_id) - Stores a PDF built with
fpdf2inpdf_bytes
API
| Method | Path | Auth |
|---|---|---|
GET | /api/v1/account/invoices | Bearer / X-Ehx-Session / ehx_session cookie |
GET | /api/v1/account/invoices/{id}/download | Same; must own invoice |
Web
/account/invoices— list + client-side PDF download (sends Bearer from session)- Link from
/account/plan
Invoice contents
- Invoice number
INV-… - Plan tier, amount, chain, asset
- Transaction hash and deposit address when present
- Line items (plan + quoted minor units)
- Footer: crypto preview — not a tax invoice