← Back

Facturalandia

2023–present

A CFDI 4.0 electronic-invoicing platform: invoice creation, IVA/IEPS tax calculation, PDF generation, real-time cancellation tracking via HMAC-signed webhooks, billing reports with Excel export, and SAT massive CFDI downloads. Also deployed for the Sonolife client.

  • Express ·
  • React ·
  • MongoDB ·
  • Facturapi ·
  • Firebase

The problem

Electronic invoicing in Mexico is not optional. Every business has to issue CFDI documents that conform to the SAT’s 4.0 spec, with the right tax breakdown, the right XML, and a paper trail for anything that gets cancelled. Getting it wrong is not a cosmetic bug, it is a compliance problem. For a small business the realistic options are a clunky government portal or an expensive suite built for accountants, neither of which fits cleanly into the way the business already works.

The hard parts are the ones you do not see from the outside: calculating IVA and IEPS correctly across different product types, generating a document the SAT will actually accept, producing a clean PDF for the customer, and keeping cancellation status accurate when it can change after the fact.

The approach

Facturalandia is a CFDI 4.0 platform that handles invoicing end to end: creating invoices, computing IVA and IEPS, generating the PDF, and tracking cancellations in real time. Rather than implement the SAT integration from scratch, the platform leans on Facturapi for the certified PAC side. The pieces I built sit on top of that: the Facturapi integration layer itself, with key-encryption middleware, organization management, and certificate upload, plus the purchases module and client invoicing with configurable email delivery.

Cancellation tracking is one of the pieces I worked on most carefully. A cancellation can land asynchronously, so the platform listens for Facturapi webhooks, verifies each one with an HMAC signature before trusting it, and mirrors the authority’s status into its own database. The side effects of a cancellation are applied once and only once, guarded against duplicate webhooks, so the status a business sees is the real status from the SAT, never a guess or a double-counted total.

More recent work pushed the platform beyond issuing documents into operating on them. A reports module joins Stripe invoice and payment data behind filters, date and month scoping, and Excel export, so a business can reconcile what was billed against what was collected without leaving the platform. And a massive-download module integrates the SAT’s bulk CFDI request flow, letting a business pull its complete fiscal history from the authority itself, not just the documents it happened to issue through the platform.

The frontend is React, data lives in MongoDB, and Firebase covers authentication and supporting infrastructure. The platform also runs in both test and live modes, so invoices can be exercised end to end before any real billing happens.

The outcome

The same platform now runs for more than one business: it was built for Facturalandia and also deployed for the Sonolife client, with deployments for Café Combate and Increscendo on the way. Because the compliance core, the tax calculation, the stamping, the PDF generation, and the verified cancellation tracking, is shared rather than rebuilt per customer, each new deployment starts from logic that has already been proven against the SAT in production.