floogos
    Back to blog
    E-invoicing

    E-Invoicing in Mexico (CFDI 4.0) via API: How to Automate It

    Stamp your CFDI 4.0 automatically from your processes: what you need, how PAC stamping works, and how to set it up with a node in Floogos.

    Floogos Product Team9 min read
    E-Invoicing in Mexico (CFDI 4.0) via API: How to Automate It

    Issuing invoices in Mexico means generating a CFDI 4.0 and stamping it with the SAT through a PAC (Authorized Certification Provider). Doing it by hand, invoice by invoice, is slow and error-prone; doing it via API, embedded in your processes, turns invoicing into an invisible step that just happens. This guide explains what you need, how the stamping flow works, and how to automate it with Floogos, where issuing a CFDI is a node inside your workflow, not a separate project.

    Note: this article is a general technical guide, not tax advice. Always validate the current requirements with the SAT or your accountant.

    e-invoice · SAT
    XML receipt Authorized
    Authority
    SAT
    UUID
    A1B2-C3D4-E5F6
    Tax
    IVA 16%
    Delivery
    XML + PDF
    Representative illustration (not an actual screenshot).

    Key concepts in 30 seconds

    CFDI 4.0 — Comprobante Fiscal Digital por Internet, the mandatory XML e-invoice format in Mexico.
    SAT — The Mexican tax authority that validates the receipts.
    PAC — Authorized Certification Provider: stamps the CFDI on the SAT's behalf (mandatory step).
    Stamping — The sealing of the CFDI by the PAC, giving it fiscal validity and assigning its folio (UUID).
    CSD — Digital Seal Certificate: your certificate and private key to sign the receipts.
    01

    Gather what you need

    Before issuing via API, have your company's data and certificates ready:

    • Issuer RFC and tax data (Tax Regime, address postal code)
    • Your Digital Seal Certificate (CSD): .cer certificate and .key with its password
    • An account with a PAC (Facturama, Finkok, SW sapien, etc.) and its API credentials
    • Your item catalog with SAT product/service and unit keys

    💡 Tip: start in the PAC's sandbox. You stamp test CFDIs with no fiscal validity until everything is tuned.

    02

    Build the CFDI 4.0

    With the transaction data, the receipt is built with everything version 4.0 requires:

    • Issuer, receiver (with Tax Regime and CFDI Use) and postal code
    • Items with product/service key, unit key, quantity and amount
    • Taxes (16% VAT or others as applicable) and totals
    • Payment method and form

    💡 Tip: version 4.0 is strict about the receiver: name and regime must match their Tax Situation Certificate exactly, or stamping is rejected.

    03

    Stamp with the PAC

    Here's where the fiscal magic happens: the PAC seals the CFDI on the SAT's behalf.

    • You send the CFDI (signed with your CSD) to the PAC's API
    • The PAC validates, stamps and returns the XML with the Digital Fiscal Stamp (UUID/folio)
    • Many PACs also return the printable representation (PDF)
    • If something fails, the PAC returns the rejection reason to fix it

    💡 Tip: always keep the stamped XML; it's the valid fiscal document. The PDF is just its visual representation.

    04

    Deliver and archive

    With the stamped CFDI, you close the cycle by delivering and storing it:

    • Send the XML and PDF to the customer (by email or their usual channel)
    • Archive the stamped XML for your accounting and audits
    • Record the UUID in your ERP, store or database
    • Update the order/invoice status in your system

    💡 Tip: automate the delivery to the customer too. A CFDI that's stamped but doesn't arrive on time creates friction all the same.

    05

    Cancel when needed

    CFDI 4.0 cancellation has its own procedure and it's best to plan for it:

    • Request the cancellation stating the reason (and the replacing CFDI, if applicable)
    • In certain cases the receiver must accept the cancellation
    • The PAC handles the request with the SAT
    • Record the receipt's new status in your systems

    💡 Tip: define from the start who cancels and how. Improvised cancellations are a classic source of accounting mismatches.

    How you automate it with Floogos

    In Floogos, all of the above fits into a workflow. The Mexico invoicing node handles the CFDI and stamping; you just connect the trigger and the data:

    1. 1A trigger starts the process (a sale in your store, a form, an order in your ERP)
    2. 2The workflow takes the transaction data and builds the CFDI 4.0
    3. 3The Mexico node stamps with your PAC and receives the XML with UUID
    4. 4Another node sends the XML/PDF to the customer and archives the receipt
    5. 5The UUID is recorded and the status updated, with traces and insights per run

    💡 The PAC credential is configured once and reused. And since it's a workflow, you can issue in batches, retry rejections and notify errors automatically.

    Frequently asked questions

    Can I stamp CFDIs directly without a PAC?

    No. In Mexico, stamping with the SAT must be done through an authorized PAC. Floogos connects to your PAC to do it automatically from your workflows.

    What do I need to start invoicing via API?

    Your tax data (RFC, regime, postal code), your Digital Seal Certificate (CSD), a PAC account and its API credentials. With that, the Mexico node can already stamp.

    Can I test before issuing real invoices?

    Yes. PACs offer a sandbox where you stamp CFDIs with no fiscal validity to validate your integration before going to production.

    Is it good for issuing many invoices at once?

    Yes. As a workflow, you can issue in batches, automatically retry rejected receipts and get alerts on errors, something unfeasible by hand.

    E-invoicing in Mexico doesn't have to be a manual, stressful month-end task. With CFDI 4.0 issued via API and embedded in your processes, every sale invoices itself, reaches the customer and gets archived, with full traceability. Floogos turns stamping into just another node in your workflow; you focus on the business, not the paperwork.

    Official sources

    General technical guide, not tax advice. Requirements verified against official sources; always check the current regulations with the SAT or your accountant.

    Keep exploring

    Share: