-
Notifications
You must be signed in to change notification settings - Fork 21
API: Invoice CRUD Endpoints & PDF Generation #66
Copy link
Copy link
Labels
Milestone
Description
Summary
Implement full Invoice CRUD API endpoints and server-side PDF generation using Puppeteer.
Requirements
POST /v1/invoices— Create invoice with line items, tax, discount, customer detailsGET /v1/invoices— List merchant invoices (paginated, filterable by status)GET /v1/invoices/:id— Get invoice detailPATCH /v1/invoices/:id— Update draft invoiceDELETE /v1/invoices/:id— Cancel/delete draft invoiceGET /v1/invoices/:id/pdf— Generate and return PDF- PDF generation using Puppeteer rendering a React template
- Store PDFs in Cloudflare R2, save URL to
pdfUrlfield - Multi-currency support (USD, EUR, NGN, etc.)
- Partial payment tracking
- Status lifecycle:
DRAFT → SENT → VIEWED → PARTIALLY_PAID → PAID → OVERDUE → CANCELLED
Database
Invoice model already exists in Prisma schema. May need migration for additional fields.
Acceptance Criteria
- All CRUD endpoints functional with proper validation (Zod)
- PDF renders with merchant branding (logo, color)
- PDF stored in R2 and accessible via signed URL
- Partial payments update invoice status correctly
- Proper error handling with descriptive messages
Reactions are currently unavailable