Overview
Luis IT Repair includes built-in support for Mexican CFDI (Comprobante Fiscal Digital por Internet) electronic invoicing. This guide covers:- CFDI 4.0 configuration
- SAT catalog integration
- PAC (Proveedor Autorizado de Certificacion) setup
- Invoice generation and stamping
- Folio management
- Tax compliance
This feature requires valid RFC, digital certificates (CSD), and a PAC provider contract.
CFDI Basics
What is CFDI?
CFDI (Comprobante Fiscal Digital por Internet) is Mexico’s electronic invoicing standard mandated by SAT (Servicio de Administracion Tributaria). It replaces paper invoices and is legally required for:- B2B transactions
- B2C transactions over $2,000 MXN
- Any transaction where the customer requests an invoice
CFDI 4.0 Structure
A CFDI includes:- Emisor (Issuer): Your business information
- Receptor (Receiver): Customer information
- Conceptos (Line Items): Products/services sold
- Impuestos (Taxes): IVA, ISR, etc.
- Complementos (Complements): Additional data (optional)
- Sello Digital (Digital Stamp): Cryptographic signature
- Timbre Fiscal Digital (SAT Stamp): PAC validation
Configuration
Enable Billing Module
Issuer Information (Emisor)
Your business legal name as registered with SATExample:
"Servicios Tecnologicos Luis IT Repair S.A. de C.V."Your business RFC (Tax ID)Format:
- Persona Moral: 12 characters (e.g.,
ABC123456D01) - Persona Fisica: 13 characters (e.g.,
XAXX010101000)
Your tax regime code from SAT catalogCommon values:
601: General de Ley Personas Morales612: Personas Fisicas con Actividades Empresariales y Profesionales626: Regimen Simplificado de Confianza
Your fiscal domicile postal code (5 digits)Example:
"06000"Series and Folio
Invoice series identifier (up to 8 alphanumeric characters)Examples:
"A", "FAC", "2024"Current folio number (auto-increments with each invoice)Format: 6-digit padded (e.g.,
000001, 000002)Automatically increment folio after successful invoice creation
{serie}-{folio}
Examples:
A-000001FAC-0001232024-001500
CFDI Defaults
Uso de CFDI (Customer Use)
How the customer will use the invoiceCommon values:
G01: Adquisicion de mercanciasG02: Devoluciones, descuentos o bonificacionesG03: Gastos en general (most common for retail)I01: ConstruccionesI02: Mobilario y equipo de oficina por inversionesI03: Equipo de transporteS01: Sin efectos fiscales
Payment Method (Metodo de Pago)
Payment timing
PUE: Pago en Una sola Exhibicion (single payment)PPD: Pago en Parcialidades o Diferido (installment payments)
Use
PUE for immediate payments, PPD for credit sales requiring payment complements.Payment Form (Forma de Pago)
Payment instrument usedCommon values:
01: Efectivo (cash)02: Cheque nominativo03: Transferencia electronica de fondos04: Tarjeta de credito28: Tarjeta de debito99: Por definir (use with PPD method)
Customer Requirements
Require customer RFC before generating invoice
Require customer email to send invoice XML and PDF
Test Mode
Enable test/sandbox modeWhen enabled:
- Invoices are not legally valid
- No real stamping/timbrado occurs
- No charges from PAC
- Testing CFDI generation workflow
PAC Integration
What is a PAC?
A PAC (Proveedor Autorizado de Certificacion) is an SAT-authorized provider that validates and stamps (timbra) your CFDI with the official SAT seal. Popular PAC providers:- Finkok
- SW Sapien
- Facturomatic
- Grupo Edicom
- Paquetexpress
Setup Process
Choose a PAC Provider
Research and select a PAC provider based on:
- Pricing per stamp
- API quality and documentation
- Support and reliability
- Integration options
Register and Get Credentials
Sign up with your chosen PAC and obtain:
- API endpoint URLs
- Authentication credentials (API key, username/password)
- Testing/sandbox credentials
CFDI Generation Flow
Collect Invoice Data
From POS transaction:
- Issuer information (from config)
- Customer RFC and name
- Line items (products/services)
- Taxes (IVA)
- Payment method and form
- Uso de CFDI
Sign XML with CSD
Apply your digital certificate (Certificado de Sello Digital):
- Load .cer and .key files
- Generate cryptographic seal
- Add seal to XML
Receive Stamped CFDI
PAC returns:
- UUID (Folio Fiscal) - Unique SAT identifier
- Timbre Fiscal Digital (SAT stamp)
- Stamped XML with complete CFDI
- Optional: PDF representation
SAT Catalogs
Common Catalog Codes
Cancellation and Credits
Cancel Invoice
To cancel a CFDI:Credit Notes (Egreso)
For returns or corrections, create a credit note (Egreso CFDI):Compliance and Best Practices
Always Request Customer RFC
Always Request Customer RFC
For legal compliance, always request customer RFC when issuing invoices. Only use “XAXX010101000” (general public) when legally allowed.
Backup Stamped XML Files
Backup Stamped XML Files
SAT requires you to keep XML files for 5 years. Implement automatic backup to cloud storage:
Monitor PAC Credits
Monitor PAC Credits
Track your PAC credit balance to avoid service interruptions.
Test in Sandbox First
Test in Sandbox First
Always test CFDI generation in PAC sandbox before going live.
Validate XML Schema
Validate XML Schema
Use SAT’s official XSD schemas to validate XML before sending to PAC.
Handle Cancellations Within 72 Hours
Handle Cancellations Within 72 Hours
SAT rules allow easier cancellation within 72 hours of issuance.
Troubleshooting
PAC Rejects XML
PAC Rejects XML
Common causes:
- Invalid RFC format
- Incorrect catalog codes
- Missing required fields
- XML schema validation errors
- Math errors in totals/taxes
Certificate Issues
Certificate Issues
- Verify .cer and .key files are valid and not expired
- Ensure CSD password is correct
- Check that RFC in certificate matches configuration
UUID Not Generating
UUID Not Generating
- Verify PAC credentials are correct
- Check PAC service status
- Ensure you have sufficient PAC credits
- Review PAC API logs
Customer Cannot Validate Invoice
Customer Cannot Validate Invoice
Customers can validate invoices at:
https://verificacfdi.facturaelectronica.sat.gob.mx/They need:
- UUID
- Issuer RFC
- Receiver RFC
- Total amount
Resources
SAT CFDI Portal
Official SAT documentation and catalogs
SAT Schemas
XML Schema Definition (XSD) files
CFDI Validator
Validate issued invoices
Authorized PAC List
SAT-authorized PAC providers
Next Steps
POS Settings
Configure IVA and ticket printing
Firebase Functions
Deploy billing functions
