{
  "id": 8826560,
  "title": "Building FoxyInvoice — Chapter 5: The domain — invoices, tax, and money math",
  "url": "https://urgent.news/2026/09/21/building-foxyinvoice-chapter-5-the-domain-invoices-tax-and-money-math",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-21T02:43:09.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/seolith/building-foxyinvoice-chapter-5-the-domain-invoices-tax-and-money-math-56h7"
  },
  "original_language": "en",
  "account": "The domain of FoxyInvoice encompasses the core logic of the invoice lifecycle, tax calculations, and export formats. Regardless of the interface, such as web, public link, or export file, the domain remains consistent. The invoice state machine progresses through Draft → Sent → Paid/Partial/Overdue → Void, with a quote converting to a real invoice upon acceptance. This minimal design prevents unnecessary branches in UIs and reduces questions for customers. Overdue invoices are derived from Sent invoices that exceed the due date, triggering reminders. Credit notes, representing refunds or adjustments, exist as a separate category. Two invariants protect the invoice state machine: server-sourced totals and explicit confirmation of totals by clients. Edit windows lock after certain transitions to maintain historical integrity. The tax engine considers nexus, jurisdictions, and product types to determine tax collection, rounding totals to cents and never returning floating values. A quote converts to a Draft invoice with a unique number, voiding the quote to prevent double conversion. Payment methods consist of Stripe payment links for online transactions and manual or automated payment notices for offline transactions. Recurring invoices utilize templates and a schedule, generating Draft invoices with the same tax calculations. Export formats cater to accountants, including CSV, QuickBooks IIF, and Tally XML. Money is represented as a decimal and currency pair, with cross-currency arithmetic prohibited and totals computed from per-line decimals rounded once at the end. The excerpt concludes by inviting readers to create a free FoxyInvoice workspace and emphasizing the importance of human confirmation for monetary transactions.",
  "summary": "This series is written in the open, from a real production system. This chapter tours the domain logic: the invoice lifecycle, the tax waterfall, and the exports accountants actually want. [All chapters and diagrams live in the public repo.] The \"domain\" is the part of the software that would be true even if you ran the business on paper: what an invoice is , when tax applies, how a quote becomes…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 2,
    "also_reported_by": [
      {
        "outlet": "Dev.to",
        "title": "Building FoxyInvoice — Chapter 0: We built an invoicing SaaS, and you can too",
        "url": "https://urgent.news/2026/09/19/building-foxyinvoice-chapter-0-we-built-an-invoicing-saas-and-you-can",
        "published": "2026-09-19T12:21:33.000Z"
      }
    ]
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}