Not tax advice. Computation tools only. Have a professional check your work before filing.
openaccountants/skills/mexico-einvoice.md

Use this skill with your AI agent

View on GitHub

Paste this skill into your AI agent's context, or save the file to your project. Works with any AI agent that reads markdown.

mexico-einvoice.md389 lines15.2 KB
v10Mexico
Not yet verified by an accountantContact accountant
1---
2name: mexico-einvoice
3description: >
4 Use this skill whenever asked about Mexico e-invoicing, CFDI (Comprobante Fiscal Digital por Internet), SAT (Servicio de Administración Tributaria), PAC (Proveedor Autorizado de Certificación), timbrado (digital stamping), Anexo 20, CFDI version 4.0, XML schema for Mexican invoices, UUID/folio fiscal, RFC validation, complemento de pago, carta porte, nomina, cancelación de CFDI, or any question about generating, validating, certifying, or troubleshooting Mexican electronic invoices. Also trigger when advising on SAT compliance, PAC selection, XML structure, fiscal regime codes, product catalog codes (c_ClaveProdServ), or CFDI workflow. ALWAYS read this skill before touching any Mexico e-invoice work.
5version: 1.0
6jurisdiction: MX
7category: invoicing
8depends_on:
9 - einvoice-workflow-base
10---
11 
12# Mexico CFDI E-Invoice Skill v1.0
13 
14---
15 
16## Section 1 -- Quick Reference
17 
18| Field | Value |
19|---|---|
20| Country | United Mexican States (Mexico) |
21| Currency | MXN (Mexican Peso); multi-currency supported with exchange rate |
22| E-Invoicing System | CFDI (Comprobante Fiscal Digital por Internet) |
23| Governing Body | SAT (Servicio de Administración Tributaria) |
24| Key Legislation | Código Fiscal de la Federación (CFF) Art. 29, 29-A; Resolución Miscelánea Fiscal (RMF) |
25| Technical Standard | Anexo 20 Version 4.0 |
26| Schema Format | XML (W3C compliant) |
27| Current Version | CFDI 4.0 (mandatory since 1 January 2023) |
28| Certification Model | Three-party clearance: Taxpayer → PAC → SAT |
29| Implementation Status | Most mature e-invoicing system in the Americas; mandatory for all taxpayers since 2014 |
30| Taxpayer ID | RFC (Registro Federal de Contribuyentes) |
31 
32### Key Dates
33 
34| Event | Date |
35|---|---|
36| CFDI inception | 2004 (CFD); 2011 (CFDI mandatory for large) |
37| Universal mandate | 1 April 2014 (all taxpayers) |
38| CFDI 3.3 | 1 July 2017 |
39| CFDI 4.0 published | 1 January 2022 |
40| CFDI 4.0 sole valid version | 1 January 2023 |
41| Platform real-time access mandate | 1 May 2026 (Art. 30-B CFF, platforms must give SAT real-time data access) |
42 
43---
44 
45## Section 2 -- Mandate Scope
46 
47### Who Must Comply
48 
49- **ALL taxpayers** in Mexico (personas físicas and personas morales) who carry out economic activities
50- No threshold — every transaction requiring a tax receipt must produce a CFDI
51- Applies to: sales of goods, services, leases, payroll, donations, exports, imports
52 
53### Document Types (TipoDeComprobante)
54 
55| Code | Type | Description |
56|---|---|---|
57| I | Ingreso | Income invoice (standard sales/services) |
58| E | Egreso | Credit note / refund |
59| T | Traslado | Transfer of goods (no payment) |
60| N | Nómina | Payroll voucher |
61| P | Pago | Payment receipt (Complemento de Pago) |
62 
63### Complementos (Supplements)
64 
65| Complemento | Use Case |
66|---|---|
67| Pagos 2.0 | Payment receipts for deferred/partial payments |
68| Carta Porte 3.1 | Bill of lading for goods transport |
69| Nómina 1.2 | Payroll details |
70| Comercio Exterior 2.0 | Export invoices |
71| INE | Political party donations |
72| Hidrocarburos | Oil & gas sector |
73 
74### B2C Treatment
75 
76- B2C sales use RFC genérico: XAXX010101000 (domestic) or XEXX010101000 (foreign)
77- Still requires full CFDI generation and PAC certification
78- Simplified "factura global" available for aggregating small B2C transactions (daily/weekly/monthly)
79 
80---
81 
82## Section 3 -- Technical Format
83 
84### XML Schema
85 
86| Aspect | Detail |
87|---|---|
88| Format | XML |
89| Version Attribute | Version="4.0" |
90| Root Element | `<cfdi:Comprobante>` |
91| Primary Namespace | http://www.sat.gob.mx/cfd/4 |
92| XSD Schema | cfdv40.xsd |
93| Timbre Fiscal Schema | TimbreFiscalDigitalv11.xsd |
94| XSLT (cadena original) | cadenaoriginal_4_0.xslt |
95| Catalogs XSD | catCFDI.xsd |
96| Encoding | UTF-8 |
97 
98### CFDI Lifecycle
99 
100```
101Taxpayer ERP/System → Generate XML → Sign with CSD (e.firma) →
102Submit to PAC → PAC validates → PAC stamps (timbrado) →
103PAC returns UUID + TimbreFiscalDigital → Invoice valid →
104PAC transmits copy to SAT
105```
106 
107### Digital Certificates
108 
109| Certificate | Purpose |
110|---|---|
111| e.firma (FIEL) | General identity certificate (not for signing CFDI directly) |
112| CSD (Certificado de Sello Digital) | Specifically for signing CFDI; obtained from SAT portal |
113| PAC Certificate | PAC's own certificate for the timbrado (fiscal stamp) |
114 
115### Cadena Original
116 
117The "cadena original" is a pipe-delimited string of all significant invoice fields, generated via XSLT transformation. The taxpayer's digital seal (sello) is a SHA-256 + RSA signature of this cadena original.
118 
119---
120 
121## Section 4 -- Mandatory Fields
122 
123### Comprobante (Root) Attributes
124 
125| Attribute | Description | Format/Values |
126|---|---|---|
127| Version | Schema version | "4.0" |
128| Serie | Series identifier | 1-25 alphanumeric |
129| Folio | Sequential number | 1-40 alphanumeric |
130| Fecha | Issue date/time | AAAA-MM-DDThh:mm:ss |
131| FormaPago | Payment form code | c_FormaPago catalog (01=Cash, 03=Transfer, 99=Por definir) |
132| SubTotal | Subtotal before tax | Decimal |
133| Moneda | Currency code | c_Moneda catalog (MXN, USD, EUR, etc.) |
134| TipoCambio | Exchange rate (if not MXN) | Decimal |
135| Total | Total amount | Decimal |
136| TipoDeComprobante | Document type | I, E, T, N, P |
137| Exportacion | Export indicator | 01=No export, 02=Definitive, 03=Temporary |
138| MetodoPago | Payment method | PUE (single payment) or PPD (deferred/partial) |
139| LugarExpedicion | Issuing postal code | 5-digit Mexican postal code |
140| Sello | Digital seal (signature) | Base64-encoded RSA signature |
141| NoCertificado | CSD certificate number | 20-digit string |
142| Certificado | CSD public certificate | Base64-encoded X.509 |
143 
144### Emisor (Issuer)
145 
146| Element/Attribute | Description |
147|---|---|
148| Rfc | Issuer RFC (12 or 13 chars) |
149| Nombre | Legal name (must match SAT records exactly) |
150| RegimenFiscal | Fiscal regime code (c_RegimenFiscal catalog) |
151 
152### Receptor (Receiver)
153 
154| Element/Attribute | Description |
155|---|---|
156| Rfc | Receiver RFC (or XAXX010101000 for generic B2C) |
157| Nombre | Receiver legal name (must match SAT records) |
158| DomicilioFiscalReceptor | Receiver's fiscal postal code (must match SAT records) |
159| RegimenFiscalReceptor | Receiver's fiscal regime code |
160| UsoCFDI | Purpose of CFDI (c_UsoCFDI: G01=Acquisition, G03=Expenses, etc.) |
161 
162### Conceptos (Line Items)
163 
164| Attribute | Description |
165|---|---|
166| ClaveProdServ | SAT product/service catalog code (8 digits) |
167| NoIdentificacion | Internal product identifier |
168| Cantidad | Quantity |
169| ClaveUnidad | Unit of measure code (c_ClaveUnidad) |
170| Unidad | Unit description |
171| Descripcion | Item description |
172| ValorUnitario | Unit price |
173| Importe | Line amount (Cantidad × ValorUnitario) |
174| ObjetoImp | Tax object (01=No tax object, 02=Yes taxed, 03=Yes not taxed, 04=Yes partially) |
175 
176### Impuestos (Taxes)
177 
178| Path | Description |
179|---|---|
180| Concepto/Impuestos/Traslados/Traslado | Tax transfer per line |
181| @Base | Taxable base |
182| @Impuesto | Tax code (002=IVA, 003=IEPS) |
183| @TipoFactor | Tasa (rate), Cuota (fixed), Exento (exempt) |
184| @TasaOCuota | Rate value (0.160000 for 16% IVA) |
185| @Importe | Tax amount |
186| Impuestos/TotalImpuestosTrasladados | Document-level total transferred taxes |
187| Impuestos/TotalImpuestosRetenidos | Document-level total retained taxes |
188 
189### Timbre Fiscal Digital (Added by PAC)
190 
191| Attribute | Description |
192|---|---|
193| Version | "1.1" |
194| UUID | Folio fiscal (36-char UUID) — the unique invoice identifier |
195| FechaTimbrado | PAC stamping timestamp |
196| RfcProvCertif | PAC's RFC |
197| SelloCFD | Taxpayer's seal (repeated) |
198| NoCertificadoSAT | SAT certificate number used by PAC |
199| SelloSAT | PAC/SAT digital seal |
200 
201---
202 
203## Section 5 -- Transmission Method
204 
205### PAC Certification (Mandatory)
206 
207| Aspect | Detail |
208|---|---|
209| Role | PACs validate, stamp, and transmit CFDIs to SAT |
210| Number of Active PACs | ~70+ authorized by SAT |
211| Connection | SOAP or REST web services (varies by PAC) |
212| Validation Steps | Structure, catalogs, RFC validation, tax math, CSD validity |
213| Stamping Time | Usually < 3 seconds |
214| Fallback | SAT free portal (portal.sat.gob.mx) for manual low-volume issuance |
215 
216### Communication Flow
217 
2181. Taxpayer system generates CFDI XML (signed with CSD)
2192. Submit to PAC via web service
2203. PAC validates structure + data against SAT catalogs
2214. PAC validates receiver RFC/name/postal code against SAT database
2225. PAC generates UUID (folio fiscal)
2236. PAC applies TimbreFiscalDigital complement (SAT stamp)
2247. PAC returns stamped CFDI to taxpayer
2258. PAC sends copy to SAT within 72 hours
2269. Taxpayer delivers stamped CFDI to receiver
227 
228### SAT Free Issuance Portal
229 
230- Available at portalcfdi.facturaelectronica.sat.gob.mx
231- Limited to low-volume issuance
232- Requires e.firma (FIEL) login
233- Not suitable for automated/high-volume scenarios
234 
235### Cancellation
236 
237| Rule | Detail |
238|---|---|
239| Method | Submit cancellation request via PAC |
240| Receiver acceptance | Required for invoices > MXN 1,000 (receiver has 72 hours to accept/reject) |
241| Motivo (reason) | 01=CFDI with errors (related doc exists), 02=CFDI with errors (no replacement), 03=Transaction did not occur, 04=Related to global invoice |
242| Time limit | Same fiscal year or month following issuance |
243| FolioSustitucion | UUID of replacement CFDI (if motivo=01) |
244 
245---
246 
247## Section 6 -- Validation Rules
248 
249### PAC Validation Sequence
250 
2511. **Structural** — XML well-formed, conforms to cfdv40.xsd
2522. **Catalog codes** — All coded fields must exist in SAT catalogs (c_FormaPago, c_Moneda, c_ClaveProdServ, c_ClaveUnidad, c_UsoCFDI, c_RegimenFiscal, etc.)
2533. **RFC validation** — Receiver RFC must exist in SAT's valid RFC list (LRFC)
2544. **Name matching** — Receiver Nombre must match SAT records exactly (including accents/capitalization)
2555. **Postal code** — DomicilioFiscalReceptor must match SAT's registered address for that RFC
2566. **Fiscal regime** — RegimenFiscalReceptor must match SAT's records
2577. **Mathematical** — SubTotal = sum of Concepto.Importe; Total = SubTotal + taxes - retentions
2588. **CSD validity** — Certificate not expired, not revoked, belongs to issuer RFC
2599. **Seal verification** — Sello matches cadena original using CSD public key
260 
261### Common Rejection Reasons
262 
263| Error | Description | Fix |
264|---|---|---|
265| 301 | XML structure invalid | Validate against cfdv40.xsd |
266| 302 | CSD expired or revoked | Renew CSD at SAT portal |
267| 303 | Invalid seal | Recompute cadena original and resign |
268| 305 | Receiver RFC not in LRFC | Verify RFC exists in SAT database |
269| 306 | Receiver name mismatch | Use exact name from SAT's constancia |
270| 307 | Receiver postal code mismatch | Use fiscal domicile postal code |
271| 402 | Invalid ClaveProdServ | Look up correct 8-digit code in SAT catalog |
272 
273---
274 
275## Section 7 -- Tax Computation Rules
276 
277### IVA (Value Added Tax)
278 
279| Rate | Application |
280|---|---|
281| 16% | General rate (most goods and services) |
282| 0% | Basic foodstuffs, medicines, exports |
283| Exempt | Education, residential rent, medical services |
284 
285### IEPS (Special Production and Services Tax)
286 
287- Applied on specific goods: alcohol, tobacco, fuel, sugary drinks, pesticides
288- Rates vary by product category
289 
290### Tax Retention
291 
292| Tax | Rate | When |
293|---|---|---|
294| ISR retention | 10% (general) | Professional services paid to individuals |
295| IVA retention | 10.6667% | Services by individuals; transport; temporary staffing |
296 
297### Calculation Rules
298 
299- Tax base per line = Cantidad × ValorUnitario (before tax)
300- Tax per line = Base × TasaOCuota
301- Round to 2 decimal places at line level (6 decimal places for TasaOCuota)
302- Document SubTotal = sum of all line Importe values
303- Document Total = SubTotal + TotalImpuestosTrasladados - TotalImpuestosRetenidos
304- For PPD (deferred payment): taxes recorded in Complemento de Pago at time of actual payment
305 
306### Multi-Currency
307 
308- If Moneda ≠ MXN, must include TipoCambio (exchange rate)
309- All amounts in the CFDI are in the stated Moneda
310- SAT computes MXN equivalent using the stated TipoCambio
311 
312---
313 
314## Section 8 -- Archiving Requirements
315 
316| Requirement | Detail |
317|---|---|
318| Retention Period | 5 years from date the tax return was filed (CFF Art. 30); effectively 6-7 years |
319| Format | Original signed XML (with TimbreFiscalDigital) |
320| Accessibility | Must be available for SAT audit; queryable from SAT portal |
321| Storage | Electronic; taxpayer's own systems + copy maintained by SAT |
322| PDF Representation | Optional; XML is the legal document; PDF/printed version is courtesy copy |
323| Complementos | Must retain all associated complementos (pagos, carta porte, etc.) |
324| Cancellation Records | Retain cancelled CFDIs with cancellation acknowledgment |
325| Platform Data (from May 2026) | Platforms must provide SAT permanent online access; data archived 5+ years |
326 
327---
328 
329## Section 9 -- Penalties for Non-Compliance
330 
331| Violation | Penalty |
332|---|---|
333| Not issuing CFDI | MXN 17,020 -- MXN 97,330 per event (CFF Art. 83-IV / 84-IV) |
334| Issuing CFDI without fiscal requirements | MXN 17,020 -- MXN 97,330 |
335| Not delivering CFDI to client upon request | MXN 17,020 -- MXN 97,330 |
336| CSD cancellation by SAT | SAT may cancel CSD for repeated violations (prevents all future CFDI issuance) |
337| Simulated operations (EFOS) | 2-9 years imprisonment + fines (CFF Art. 113 Bis) |
338| Acquiring/using CFDI from EFOS | Tax deductions/credits disallowed + penalty |
339| Late cancellation | Administrative fines; SAT may reject cancellation |
340 
341### Receiver Consequences
342 
343- Receiver who deducts/credits a CFDI that does not meet requirements risks deduction disallowance
344- ISR deductions and IVA credits require a valid CFDI with correct receiver data
345 
346---
347 
348## Section 10 -- Interaction with Tax Skills
349 
350### Monthly VAT Return (Declaración Mensual IVA)
351 
352- IVA trasladado (output VAT) derived from type "I" CFDIs issued
353- IVA acreditable (input VAT) derived from type "I" CFDIs received
354- IVA retenido from retention CFDIs
355- SAT pre-fills monthly return proposals based on CFDI data
356 
357### Annual ISR Return
358 
359- Income declared must match sum of type "I" CFDIs issued in the fiscal year
360- Deductions must be backed by valid received CFDIs
361- SAT cross-references reported income vs. CFDI issuance records
362 
363### Payroll (Nómina)
364 
365- Payroll CFDIs (type "N" with Nómina complemento) feed into:
366 - Employee's annual tax return (pre-filled income)
367 - Employer's ISR withholding obligations
368 - Social security (IMSS) cross-validation
369 
370### Complemento de Pago
371 
372- For PPD method invoices, actual VAT is recognized only when payment CFDI is issued
373- Cashflow-based IVA timing: VAT liability/credit arises on payment date, not invoice date
374- Monthly IVA return uses payment CFDIs for deferred-payment transactions
375 
376### SAT Audit Crossmatching
377 
378- SAT automatically cross-references buyer-seller CFDI pairs
379- Discrepancies flagged in taxpayer's "Buzón Tributario" (tax mailbox)
380- Invitation letters ("carta invitación") issued for unexplained income vs. CFDI mismatches
381 
382---
383 
384## Disclaimer
385 
386This skill and its outputs are provided for informational and computational purposes only and do not constitute tax, legal, or financial advice. Open Accountants and its contributors accept no liability for any errors, omissions, or outcomes arising from the use of this skill. All outputs must be reviewed and signed off by a qualified professional (such as a Contador Público, CPA, or equivalent licensed practitioner in your jurisdiction) before filing or acting upon.
387 
388The most up-to-date, verified version of this skill is maintained at [openaccountants.com](https://openaccountants.com).
389 

Run this skill, then get an accountant to check it

After running the full skill pack in your AI agent, sign up and upload your worksheet. We'll connect you with a trusted accountant in our network who can review your numbers before you file.

Verification status

Research-verified

Drafted from authoritative sources (tax authority sites, Big-4 summaries). Awaiting credentialed sign-off.

Needs section-by-section practitioner review to reach accountant-verified.

Section review progress

0/38

About

Use this skill whenever asked about Mexico e-invoicing, CFDI (Comprobante Fiscal Digital por Internet), SAT (Servicio de Administración Tributaria), PAC (Proveedor Autorizado de Certificación), timbrado (digital stamping), Anexo 20, CFDI version 4.0, XML schema for Mexican invoices, UUID/folio fiscal, RFC validation, complemento de pago, carta porte, nomina, cancelación de CFDI, or any question about generating, validating, certifying, or troubleshooting Mexican electronic invoices. Also trigger when advising on SAT compliance, PAC selection, XML structure, fiscal regime codes, product catalog codes (c_ClaveProdServ), or CFDI workflow. ALWAYS read this skill before touching any Mexico e-invoice work.

MXty-2025

Use this skill

This skill is open source and free to use in any AI agent. Copy it, download it, or clone the repo. If you find an error, report an issue — a licensed accountant will review.

7 of 11 in the MX workflow: