CFDI 4.0 XML Skeleton Generator
Developers integrating an ERP with a PAC need a clean example of a CFDI 4.0 document. This generator builds a valid-looking skeleton with the nodes in the right order, so you can adapt it for your first test stamp.
Fill in
<?xml version="1.0" encoding="UTF-8"?>
<cfdi:Comprobante xmlns:cfdi="http://www.sat.gob.mx/cfd/4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sat.gob.mx/cfd/4 http://www.sat.gob.mx/sitio_internet/cfd/4/cfdv40.xsd" Version="4.0" Serie="A" Folio="1042" Fecha="2026-10-20T10:30:00" FormaPago="03" MetodoPago="PUE" NoCertificado="00001000000500000000" Certificado="" Sello="" SubTotal="10000.00" Moneda="MXN" Total="11600.00" TipoDeComprobante="I" Exportacion="01" LugarExpedicion="66600">
<cfdi:Emisor Rfc="EKU9003173C9" Nombre="ESCUELA KEMPER URGATE" RegimenFiscal="601"/>
<cfdi:Receptor Rfc="URE180429TM6" Nombre="UNIVERSIDAD ROBOTICA ESPANOLA" DomicilioFiscalReceptor="86991" RegimenFiscalReceptor="601" UsoCFDI="G03"/>
<cfdi:Conceptos>
<cfdi:Concepto ClaveProdServ="25174700" Cantidad="100" ClaveUnidad="H87" Descripcion="Aluminum machined housing" ValorUnitario="100.00" Importe="10000.00" ObjetoImp="02">
<cfdi:Impuestos>
<cfdi:Traslados>
<cfdi:Traslado Base="10000.00" Impuesto="002" TipoFactor="Tasa" TasaOCuota="0.160000" Importe="1600.00"/>
</cfdi:Traslados>
</cfdi:Impuestos>
</cfdi:Concepto>
</cfdi:Conceptos>
<cfdi:Impuestos TotalImpuestosTrasladados="1600.00">
<cfdi:Traslados>
<cfdi:Traslado Base="10000.00" Impuesto="002" TipoFactor="Tasa" TasaOCuota="0.160000" Importe="1600.00"/>
</cfdi:Traslados>
</cfdi:Impuestos>
</cfdi:Comprobante>This is an unsigned skeleton for development and test stamping. Sello and Certificado are produced when you sign with your CSD, usually by your ERP or the PAC. Sample RFCs and names are SAT public test values or fictitious. Check the current schema, catalogs and your PAC rules before production. Adding complements (payment, Carta Porte, foreign trade) requires extra namespaces and nodes.
PAC integration review
Optional: we can review your ERP to PAC mapping and error handling.
Optional. The tool and every export work without this. No spam.
How to use the generator
Fill the form with the issuer, receiver and one concept, copy or download the XML, and send it to your PAC test environment through its API. For production, the ERP should build the XML from invoice data, sign it with the issuer's CSD to produce Sello and Certificado, and submit it for stamping. Use the skeleton as a reference when debugging field mappings.
Structure of the document
The root Comprobante node holds version, series, folio, date, payment method and form, currency, totals, document type, export indicator and issuing postal code. Child nodes follow a fixed order: related CFDI, issuer, receiver, concepts with their own tax breakdown, summarized taxes, and then complements. Amounts are strings with the decimal precision defined by the currency.
- Emisor: RFC, name, fiscal regime
- Receptor: RFC, name, fiscal postal code, regime, CFDI use
- Concepto: product key, unit key, quantities, amounts, tax object
- Impuestos: base, tax, factor type, rate and amount
Rounding and totals
SubTotal is the sum of line amounts, taxes come from the transferred tax breakdown, and Total equals subtotal plus transferred taxes minus withholdings and discounts. Rounding rules matter: the PAC validates that tax amounts match base times rate within the tolerance SAT allows, so compute tax per line with consistent rounding and sum from lines to the header.
Common mistakes
Frequent causes of rejection are a receiver name not matching the registry, a regime incompatible with the CFDI use, FormaPago 99 used with a PUE method, wrong decimals on amounts, and missing ObjetoImp. Another trap is building XML by string concatenation without escaping characters such as ampersands in names; use an XML library in production.
Frequently Asked Questions
Is this XML ready for production?
No. It is an unsigned skeleton. Production documents must be signed with the issuer's certificate, validated against the schema and catalogs, and stamped by a PAC.
Where do Sello and Certificado come from?
They are generated by signing the original string of the document with the private key of the issuer's CSD and including the public certificate. The ERP or the PAC normally does this step.
How do I add a payment or Carta Porte complement?
Complements are added as a Complemento node with their own namespace and schema location. They have separate required fields and document types, so build them from the SAT guide of each complement.
Which test RFCs can I use?
SAT publishes sample taxpayer RFCs and many PACs provide test credentials. The defaults here are such sample values or fictitious. Use your PAC's test data when stamping.
If your ERP integration with a PAC is fragile, we can help review the mapping and add pre-stamp validation against these rules.
Related Tools
Mexico CFDI 4.0 Invoice Checklist
Check every CFDI 4.0 field group before your ERP stamps an invoice: issuer, receiver, concepts, taxes, payment method, complements and cancellation.
Supply Chain & InventoryCarta Porte CFDI Shipment Data Sheet
Collect every data point needed for the Carta Porte complement before a truck leaves: origin, destination, goods, vehicle, permit, insurance and driver.
Country & TaxBrazil NF-e Field Reference
A lookup table of the main NF-e XML groups and fields with codes and notes for ERP localization and integration work.
ERP Migration & SelectionLatin America ERP Localization Readiness Assessment
Ten scored questions that show how ready your ERP and processes are for Latin American e-invoicing, tax and reporting before you open a new plant or subsidiary.
More Developer Tools tools
See all- SAP Sales Order ABAP SELECT Generator (VBAK, VBAP, VBFA)
- SAP Sales Order Create BAPI ABAP Generator (BAPI_SALESORDER_CREATEFROMDAT2)
- SAP ABAP Open Items SELECT Generator
- SAP ACDOCA SQL Query Generator
- SAP QM Inspection Lot ABAP SELECT Generator
- SAP Quality Notification Pareto SQL Query Generator
- SAP QM Usage Decision BAPI Skeleton
- ABAP Custom Exception Class Generator
- ABAP Unit Test Class Generator