Mexico - CFDI & SAT
Issue CFDI documents in Mexico using the SAT Mexico provider.
Introduction
The CFDI (Comprobante Fiscal Digital por Internet) is the standardized electronic invoicing format in Mexico, managed by the country’s tax authority, the SAT (Servicio de Administración Tributaria). This system ensures that all fiscal documents are digitally generated, validated, and reported to SAT in compliance with national tax laws.
In this guide we’ll walk you through the steps required to first register a supplier and then issue invoices in their name.
Prerequisites
To issue invoices in Mexico via the SAT, you will need:
- Supplier details, including:
- name,
- taxpayer ID or RFC (Registro Federal de Contribuyentes),
- address, and,
- fiscal regime code issued by SAT.
- Customer details, the same as the supplier, plus CFDI use code (código de uso CFDI).
- Line item details including quantities, prices, applicable tax rates, and the SAT product-service code.
- To have chosen an invoice series.
- Issue place code (lugar de expedición).
- A signing certificate known as a CSD (Certificado de Sello Digital) issued by the SAT for every supplier.
Setup
There are three key processes to prepare:
- create supplier post-registration workflow,
- connect the SAT Mexico app,
- configure a supplier registration workflow, and,
- prepare an invoicing workflow.
These instructions apply to both the sandbox and live environments, with a few exceptions for supplier data and registration details when real details are not available.
All of the following steps must be carried out from the Invopop Console.
Create Supplier post-registration workflow (optional)
Head over to the Workflows section and create a new “Contacts” workflow.
Rename the workflow to “Post-registration flow”, and add a single step to change the state to sent
.
At this point you can add any webhooks or notification steps that might be useful for your systems to receive after a supplier has successfully registered.
Tap the Save button.
Connect the SAT Mexico App
Enter the Configuration section, then tap Apps. Tap on the Connect button of the SAT Mexico app.
Tap the Configure button on the App, and choose the “Post-registration flow” workflow we created in the previous step, or leave empty.
Tap the Save button.
Configure the supplier registration workflow
Back in the Workflows section, create a new “Contacts” workflow called “Register Supplier”.
The new workflow will need to perform three steps:
- Sign the Envelope
- Register SAT Issuer
- Set State - with configuration set to
processing
.
Add any additioanl steps you may need, and save the new workflow.
Prepare Invoice Workflow
Finally, we need to prepare the actual workflow that will be used to process invoices. For this example the workflow should be named something like “Issue SAT Invoices”, and it will consist of the following Steps:
- Add Sequential Code - with dynamic sequences, and name like “SAT Invoices”.
- Send to SAT (Mexico).
- Generate PDF - configured for your environment.
- Set State - to “sent”.
Tap the Save button to ensure the workflow has been persisted.
Running
In this section we’ll provide details on how to first persist and register a supplier, followed by issuing invoices on their behalf.
As usual, the recommended approach for running jobs is to perform two steps; first upload the document to the silo, second create a job.
Register a Supplier
Suppliers can be registered either manually via the Invopop Console or programatically via the API. The process is essentially the same, so for this guide we’ll demonstrate the manual process.
Suppliers in Mexico must authorize the PAC (Procesador Autorizado de Certificación) used by Invopop to sign, stamp and send CFDIs to the SAT on their behalf. Please visit https://firmamanifiesto.lunasoft.net/ and follow the process to authorize SW Sapiens by Luna Soft S.A. de C.V.. This is not an automated service and can only be performed manually by a representative of the supplier.
Find the Contacts section of the sidebar and click Suppliers. Tap the + New Supplier button to be presented with a new editor. Copy and paste the following example that uses example data provided by the SAT. This will only work in sandbox environments, in production you’ll need the details of a real company:
Tap Build, ensure there are no errors, and click Save.
We should now see the document. Find and click the Select Workflow button. Select the Register Supplier workflow created during setup, and click Run Workflow.
The execution should be successful, and the silo entry will now be in the “Processing” state. Tap the Meta tab to see the registration link:
You can access the registration link via the API by fetching the silo
entry and reading the meta
row where
the key
is set to registration-link
.
Tap the registration link and a new browser window will be presented with a form to upload the credentials for the supplier. Note that this form can be shared directly with the supplier if required.
The details from this form are sent securely to the PAC (Authorised Certification Provider) who will be responsible for signing invoices and sending them to the SAT. You can find test RFCs and CSDs on the SW Sapien test pages. Download the zip file and extract the certificates if you’d like to try out the full flow.
The CSD comprises two files (with extensions .cer
and .key
) and a password. Suppliers, companies or individuals, can follow this guide on how to obtain one.
Certificates have already been registered for all sandbox users, so you can safely run the “Post-registration flow” workflow manually and leave the new supplier in the sent
state.
From this point on you can now send invoices on behalf of the supplier.
Send an Invoice
The following examples are of partial GOBL documents you can copy and paste directly into the Invopop Console or store via the API as silo entries.
GOBL Invoices sent to the SAT require the following properties in order to perform the correct normalization and validation steps. Invopop will try to assign these automatically, but we recommend defining them explicitly before upload:
$region
to be set toMX
$addons
to includemx-cfdi-v4
FAQ
Please contact the Invopop support team if you have any questions that are not listed here.