Skip to main content

Milestone 5.2f — Invoice PDF generation and download

Status: Shipped (preview)
Tracking: ehx-api#16

Behavior

When a checkout session reaches confirmed, the API:

  1. Upserts subscription (existing)
  2. Creates an invoices row (idempotent per checkout_session_id)
  3. Stores a PDF built with fpdf2 in pdf_bytes

API

MethodPathAuth
GET/api/v1/account/invoicesBearer / X-Ehx-Session / ehx_session cookie
GET/api/v1/account/invoices/{id}/downloadSame; 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