AstroBaaS

Orders & fulfilment

Invoice Generation

Free — GPL coresize Mplanned, not built

Generated from docs/plan/core/invoice-generation/PLAN.md in the AstroBaaS repository. Nothing described below is implemented — it is the written plan for it.

A non-fiscal invoice generation system that creates itemized invoices from orders with customizable templates, sequential numbering, and PDF storage.

The problem

Merchants need to generate invoices for accounting; non-fiscal receipts don’t meet accounting requirements.

What it does

  • Generate non-fiscal invoice from order (itemized list, totals, tax, notes)
  • Template customization (merchant logo, address, payment terms)
  • PDF download or email
  • Invoice numbering (sequential per merchant)
  • Archive (store PDF as artifact)
  • Print to PDF or thermal printer

What it deliberately does NOT do

Each boundary carries its reason. A boundary without a reason gets crossed by the next person who reads this.

  • Fiscal/tax receipt — requires per-country tax authority integration. Reason: paid feature.
  • E-invoicing (XML, EDI) — not supported. Reason: complex per-country standard.
  • Accounting software sync — not included. Reason: vendor-specific integration is paid.

Data model

New tables: Invoice {id, orderId, invoiceNumber, issuedAt, pdfArtifactId, status (‘draft’|‘issued’|‘sent’)}. No migration.

API

  • POST /api/invoices
  • GET /api/invoices/:id
  • GET /api/invoices/:id/pdf

Every route added here must also appear in src/pages/openapi.json.ts — a test fails the build if it does not.

Admin

Invoice generation button on order detail. Invoice list: filter by date, search by order number. Email invoice to customer.

The seam — why this is core

Core owns: invoice template, numbering, PDF generation. Paid owns: fiscal compliance, tax authority reporting.

Core owns the interface + honest invoice renderer (non-fiscal); invoicing is infrastructure, not a per-country obligation or credential.

Dependencies

  • Order infrastructure
  • Artifact storage (to store PDFs)

Acceptance checks

Each of these must be able to fail. Before claiming this is done, break the code deliberately and watch each one go red.

  • Generating invoice for order creates Invoice and stores PDF as artifact
  • Invoice PDF contains order items, quantities, prices, totals, tax
  • Invoice numbering is sequential (first invoice = 1, second = 2, etc.)
  • Emailing invoice sends PDF as attachment

Risks

Invoice number collision: two invoices get same number; mitigation: auto-increment sequence, unique constraint. PDF generation failure: template syntax error; mitigation: test template on save.

Commercial context

Suggested pricefree (core)
Rival anchorShopify: included; Magento: included

The anchor is what the nearest equivalent charges on Shopify or Magento today. It is context for a pricing decision, not the decision.


Generated from the commerce plan. See docs/COMMERCE-PLAN.md for the full catalogue and ../../AI-GUIDE.md for how to work on this repository.