Auto CFDI invoicing
Auto CFDI invoicing (CFDI: Mexico's electronic invoice) lets your customers generate their invoice from their ticket (a sales receipt your customer can later turn into a CFDI), without involving your team. Your point of sale records each paid sale as a ticket and prints its code and a QR code. Your customer scans it, enters their tax details in your auto-invoice portal (auto-invoice: a CFDI your customer requests from a ticket; you remain the issuer), and receives their CFDI.
This page explains how Auto CFDI invoicing works. The endpoint reference is in tickets and Auto CFDI invoicing, and issuing what your customers don't invoice is covered in global invoice for tickets (global invoice: factura global, one CFDI that groups a period's sales to the general public).
How it works
Each ticket follows the same path, and each step is a standard API call:
| Step | Who | What happens |
|---|---|---|
| 1 | Your point of sale | Records the sale with Create a ticket and receives the code and the QR code URL. |
| 2 | Your point of sale | Prints the code and the QR code on the sale's receipt. |
| 3 | Your customer | Opens the QR code, enters their RFC (Mexico's taxpayer ID, Registro Federal de Contribuyentes) and tax details, and downloads their invoice. Fiscalapi stamps it (stamping: the certification by a SAT-authorized provider that makes a CFDI valid) with the ticket data. |
| 4 | You | At the end of the period, you include the tickets nobody invoiced in the global invoice for tickets. |
The auto-invoice uses the line items, taxes, and totals you recorded on the ticket, and your customer can't change them. Fiscalapi validates the structure, the arithmetic, and the SAT catalogs (SAT: Mexico's tax authority, Servicio de Administración Tributaria). The taxes you declare are your responsibility.
Purchasing and credits
Auto CFDI invoicing is an add-on (an extra you add to your subscription) and requires CFDI invoicing. The owner (the person who created the tenant) of your tenant (the space in Fiscalapi that holds your issuers, recipients, credits, and data) adds it in Compras en línea > Módulos adicionales (Billing > Add-ons) in the dashboard and buys ticket credits in Compras en línea > Tienda en línea (Online purchases > Online store).
Billing has two independent parts:
| Charge | When it's used | Whose credits |
|---|---|---|
| Ticket credit | When you record a ticket, even if it's never invoiced. A rejection (4xx), a retry with the same idempotency key, or a duplicate doesn't use one. | The authenticated person (any individual or legal entity registered in your tenant) who records the ticket. |
| Stamp | When each CFDI is stamped: the auto-invoice, the global invoice, and its replacement CFDI (CFDI replacement: you issue a corrected CFDI related to the original with relationship type 04, then cancel the original with reason 01). | The ticket's issuing person for the auto-invoice, and the authenticated person for the global invoice. |
Ticket credits are credit type 3. You transfer and withdraw them between the people in your tenant with Transfer stamps and that value in creditType. Each person's balance appears in balances on the person. A used ticket credit isn't refunded, even if you cancel the ticket.
Permissions and subscription
Viewing your tickets and your settings doesn't require Auto CFDI invoicing: if you remove the add-on, you still see what you recorded. Recording, canceling, or changing anything does require it, and only the owner manages the settings.
| Permission | What it allows | Requires Auto CFDI invoicing |
|---|---|---|
| Tickets.Read | View tickets and the usage report. | No |
| Tickets.Create | Record tickets. | Yes |
| Tickets.Cancel | Cancel tickets. | Yes |
| AutoInvoice.Read | View the settings and the portal name. | No |
| AutoInvoice.Manage | Change the settings and the portal name. Owner only. | Yes |
The global invoice for tickets and its cancellation use the regular invoicing permissions. Without the permission, or without the add-on in your subscription, the endpoint returns 403:
| Status | When it happens | Message |
|---|---|---|
| 403 | You record a ticket and your subscription doesn't include Auto CFDI invoicing. | Para ingerir tickets tu suscripción debe incluir: Auto CFDI. |
| 403 | You cancel a ticket and your subscription doesn't include Auto CFDI invoicing. | Para cancelar tickets tu suscripción debe incluir: Auto CFDI. |
| 403 | You change the settings or the portal name, or check whether a name is available, and your subscription doesn't include Auto CFDI invoicing. | Para administrar la configuración de Auto CFDI tu suscripción debe incluir: Auto CFDI. |
| 403 | You change the settings or the portal name, or check whether a name is available, and you aren't the owner. | No tienes permiso para administrar la configuración de Auto CFDI. |
If your subscription doesn't include CFDI invoicing either, the message lists both add-ons, for example Para ingerir tickets tu suscripción debe incluir: Auto CFDI, Emisión CFDI. (To ingest tickets, your subscription must include: Auto CFDI invoicing, CFDI invoicing.)
Code and QR code
Each ticket has a 12-character code that is different for each record and hard to guess. Create a ticket returns it without hyphens in ticketCode. Print it in three groups of 4 separated by hyphens, which are easier to read and dictate. The portal accepts the code with or without hyphens, in uppercase or lowercase.
The QR code URL (qrUrl) opens the ticket directly in the portal and doesn't depend on your portal name, so printed receipts keep working even if you change the name:
| Environment | QR code URL |
|---|---|
| Test | https://test.factura.fiscalapi.com/t/ followed by the code |
| Production | https://live.factura.fiscalapi.com/t/ followed by the code |
To reprint a receipt, retrieve the code with Get a ticket code.
Auto-invoice window
The settings define how long your customer can auto-invoice a ticket, counted from the payment date in Mexico local time. Fiscalapi calculates the window on each query with the current settings, so a change applies immediately to all your tickets, including those already recorded.
allowBillingOutsideMonth | allowBillingOutsideYear | How long the ticket can be auto-invoiced |
|---|---|---|
false | false | Until the last day of the payment month. This is the default setting. |
true | false | Until December 31 of the payment year. |
true | true | No limit. |
Tickets return the window in selfInvoiceEligible and eligibleUntil. A ticket outside its window stays in pending, and you can include it in the global invoice for tickets.
The tax deadlines for issuing the CFDI for a sale, and for including the sale in a global invoice, are your business's responsibility. Fiscalapi applies the window you set and doesn't adjust it to any SAT deadline. Choose the settings that meet your obligations.
Portal name
The portal name is the address of your auto-invoice portal in each environment: https://test.factura.fiscalapi.com/ or https://live.factura.fiscalapi.com/ followed by the name. It's unique in the environment, and Fiscalapi normalizes it to lowercase and trims leading and trailing spaces. The name follows these rules:
| Rule | Detail |
|---|---|
| Length | 3 to 40 characters. |
| Characters | Lowercase letters without accents, numbers, and hyphens. It starts with a letter, has no consecutive hyphens, and doesn't end with a hyphen. |
| Reserved | It can't be a reserved name, such as portal, factura, api, or tickets, and it can't start with fiscalapi. |
| Changes | You can change it once every 30 days. The first name has no waiting period. |
When you change it, the previous name stays reserved for your tenant and redirects to the new one, so the links you already shared keep working. A name is never released, not even when you remove Auto CFDI invoicing.
Your portal serves your customers when your subscription includes Auto CFDI invoicing, you have a portal name, and you set up the privacy notice. If any of the three is missing, the portal shows that you don't offer online invoicing and doesn't stamp. Set the name and the notice with the Auto CFDI invoicing endpoints.