Mx Validate Cfdi
mx__validate_cfdiEnsure CFDI 4.0 XML is structurally valid against official SAT XSD schemas. Validates optional TFD and Pagos 2.0 complements, returning pass/fail results for each applicable schema.
Instructions
Validate a CFDI 4.0 document against the official SAT XSD schemas.
Always validates the root Comprobante against cfdv40.xsd. If a
TimbreFiscalDigital complement is present (i.e. the document has been
stamped by a PAC), it is additionally validated against
TimbreFiscalDigitalv11.xsd.xml. If a Pagos complement is present
(TipoDeComprobante="P"), it is additionally validated against
Pagos20.xsd.xml.
This is XSD-only — business-rule checks from SAT's Matriz de errores
(specs/MatrizDeErrores_CFDI_v40_20260325.xls) are not run, mirroring
mcp-nfe-br's br__validate_nfe_xml precedent (XSD-first, business
rules deferred). A document that passes this validator is structurally
conformant but not guaranteed to pass PAC certification.
Returns a dict with:
valid: True only if every schema that applies passedcomprobante: thecfdv40.xsdvalidation resulttfd: the TFD validation result, present only if aTimbreFiscalDigitalelement was foundpagos: the Pagos 2.0 validation result, present only if aPagoselement was found
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| xml | Yes | The CFDI 4.0 Comprobante XML to validate, as a string |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||