When you double-click an invoice XML, you usually get a screen full of tags, quotes and codes. The file is not broken: XML is made for systems to read. Here is how to open it, where each field is and how to check that the invoice is valid.
How to open the XML
You have three options:
- Your browser. Drag the file into Chrome, Edge or Firefox. It shows a tree of tags. It works for finding a field, but you need to know where it is.
- Notepad or any text editor. It shows the same content as one long line of text. This is the hardest way to read it.
- A CFDI viewer. It lays the data out like an invoice. The free OBPDF XML viewer reads it in your browser, with no account and without uploading the file to any server.
If you don’t have the XML, download it from SAT’s invoice portal, your invoicing system or your supplier’s email.
Where each field is
A CFDI 4.0 has one main tag, cfdi:Comprobante, with the other sections inside it.
Document details
These are attributes of cfdi:Comprobante:
SerieandFolio: the issuer’s internal invoice number, if they use one.Fecha: date and time of issue.TipoDeComprobante:Iincome,Eexpense (credit note),Ttransfer,Npayroll andPpayment.MetodoPago:PUEif paid in a single payment,PPDif paid in installments or later. A PPD invoice needs payment complements.FormaPago: how it was paid, for example01cash,03bank transfer or99to be defined.Moneda,TipoCambio,SubTotal,DescuentoandTotal.LugarExpedicion: the postal code it was issued from.
Issuer and receiver
cfdi:Emisorhas theRfc,NombreandRegimenFiscalof whoever issues the invoice, for example601general regime,612business and professional activities or626RESICO.cfdi:Receptorhas theRfc,Nombre, postal code (DomicilioFiscalReceptor), tax regime (RegimenFiscalReceptor) andUsoCFDI, for exampleG03general expenses orS01no tax effects.
Line items
Each cfdi:Concepto is one line of the invoice: ClaveProdServ (the SAT catalog code), Cantidad, ClaveUnidad, Descripcion, ValorUnitario, Importe and, when there is one, Descuento. Each line item carries its own taxes.
Taxes
cfdi:Impuestos, at the end of the document, adds up the taxes of all line items: TotalImpuestosTrasladados (such as VAT charged) and TotalImpuestosRetenidos (such as income tax or VAT withheld).
Tax stamp
Inside cfdi:Complemento is tfd:TimbreFiscalDigital, which is what makes the invoice valid:
UUID: the tax folio. It is the identifier SAT uses for the invoice.FechaTimbrado: when it was certified.RfcProvCertif: the RFC of the provider that stamped it.NoCertificadoSAT,SelloCFDandSelloSAT: the digital seal data.
If the XML has no tfd:TimbreFiscalDigital, it is not stamped and is not a valid CFDI yet.
cfdi:Complemento also holds any complements the invoice carries, such as payments, payroll or Carta Porte.
How to know if the invoice is valid
A well-formed XML does not mean SAT has it on record or that it is still current. To check, open SAT’s CFDI verification and enter the tax folio, the issuer’s RFC, the receiver’s RFC and the total. The result tells you whether the invoice exists and whether it is current or cancelled.
In the OBPDF viewer, the Verify with SAT button opens that lookup with the data already filled in.
If you need the PDF
The XML is the invoice with tax validity. The PDF is its printed representation, the version to read, print and send. If you need the PDF, you can generate it with OBPDF, with the QR code, seals and your logo. We explain how in how to convert an invoice XML to PDF.
Quick questions
Can I edit the XML to fix a field? No. Any change breaks the digital seal and the invoice stops being valid. If there is a mistake, the issuer has to cancel it and issue a new one.
Why does the XML say version 3.3? It is an invoice from before CFDI 4.0, the current version since 2023. It is still valid if it was issued while 3.3 was current.
Do the XML and the PDF have to match? Yes. The PDF must reproduce the XML data. If they don’t match, the XML is what counts.