# CFDI 4.0 Invoice XML Skeleton Generator

> Source: https://netray.co/tools/mexico-cfdi-4-0-invoice-xml-skeleton-generator
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Free Tools

## Short answer

Fill in a few fields and get a CFDI 4.0 ingreso XML skeleton to test your ERP mapping or a PAC sandbox request.

## Category

developer

## Erp

Any ERP

## Industry

Manufacturing

## Region

Mexico

## Audience

- ERP developer
- Integration engineer
- ERP consultant

## Tool

**Kind:** template

**Output:** code

**Language:** xml

**Fields:**

#### Serie

**Key:** serie

**Type:** text

**Default:** A

#### Folio

**Key:** folio

**Type:** text

**Default:** 1042

#### Issue date and time

**Key:** fecha

**Type:** text

**Default:** 2026-10-20T10:30:00

**Help:** Format YYYY-MM-DDThh:mm:ss in local time of the issue place

#### Lugar de expedicion (postal code)

**Key:** cp

**Type:** text

**Default:** 64000

#### Emisor RFC

**Key:** emisor_rfc

**Type:** text

**Default:** EKU9003173C9

**Help:** Use a test RFC from your PAC sandbox

#### Emisor name

**Key:** emisor_nombre

**Type:** text

**Default:** ESCUELA KEMPER URGATE

#### Emisor regimen fiscal

**Key:** emisor_regimen

**Type:** text

**Default:** 601

#### Receptor RFC

**Key:** receptor_rfc

**Type:** text

**Default:** XAXX010101000

#### Receptor name

**Key:** receptor_nombre

**Type:** text

**Default:** PUBLICO EN GENERAL

#### Receptor fiscal postal code

**Key:** receptor_cp

**Type:** text

**Default:** 64000

#### Receptor regimen fiscal

**Key:** receptor_regimen

**Type:** select

**Options:**

- 601
- 603
- 605
- 612
- 616
- 626

**Default:** 616

#### Uso CFDI

**Key:** uso

**Type:** select

**Options:**

- G01
- G03
- I04
- I05
- I08
- S01

**Default:** S01

#### Metodo de pago

**Key:** metodo

**Type:** select

**Options:**

- PUE
- PPD

**Default:** PUE

#### Forma de pago

**Key:** forma

**Type:** text

**Default:** 03

**Help:** Use 99 when the method is PPD

#### Clave producto o servicio (SAT)

**Key:** prod

**Type:** text

**Default:** 31162800

**Help:** From the SAT c_ClaveProdServ catalog; confirm the correct key for your product

#### Clave unidad (SAT)

**Key:** unidad

**Type:** text

**Default:** H87

**Help:** H87 is piece

#### Description

**Key:** desc

**Type:** text

**Default:** Bracket assembly BRK-1001

#### Quantity

**Key:** qty

**Type:** text

**Default:** 100

#### Unit price

**Key:** unit_price

**Type:** text

**Default:** 250.00

#### Subtotal (quantity x unit price)

**Key:** subtotal

**Type:** text

**Default:** 25000.00

#### IVA amount (16 percent)

**Key:** iva

**Type:** text

**Default:** 4000.00

#### Total

**Key:** total

**Type:** text

**Default:** 29000.00

**Blocks:**

#### CFDI 4.0 ingreso skeleton

**Body:** <?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='{{serie}}' Folio='{{folio}}' Fecha='{{fecha}}'
  FormaPago='{{forma}}' MetodoPago='{{metodo}}' Moneda='MXN'
  SubTotal='{{subtotal}}' Total='{{total}}' TipoDeComprobante='I'
  Exportacion='01' LugarExpedicion='{{cp}}'>
  <cfdi:Emisor Rfc='{{emisor_rfc}}' Nombre='{{emisor_nombre}}' RegimenFiscal='{{emisor_regimen}}'/>
  <cfdi:Receptor Rfc='{{receptor_rfc}}' Nombre='{{receptor_nombre}}' DomicilioFiscalReceptor='{{receptor_cp}}' RegimenFiscalReceptor='{{receptor_regimen}}' UsoCFDI='{{uso}}'/>
  <cfdi:Conceptos>
    <cfdi:Concepto ClaveProdServ='{{prod}}' Cantidad='{{qty}}' ClaveUnidad='{{unidad}}' Descripcion='{{desc}}' ValorUnitario='{{unit_price}}' Importe='{{subtotal}}' ObjetoImp='02'>
      <cfdi:Impuestos>
        <cfdi:Traslados>
          <cfdi:Traslado Base='{{subtotal}}' Impuesto='002' TipoFactor='Tasa' TasaOCuota='0.160000' Importe='{{iva}}'/>
        </cfdi:Traslados>
      </cfdi:Impuestos>
    </cfdi:Concepto>
  </cfdi:Conceptos>
  <cfdi:Impuestos TotalImpuestosTrasladados='{{iva}}'>
    <cfdi:Traslados>
      <cfdi:Traslado Base='{{subtotal}}' Impuesto='002' TipoFactor='Tasa' TasaOCuota='0.160000' Importe='{{iva}}'/>
    </cfdi:Traslados>
  </cfdi:Impuestos>
</cfdi:Comprobante>

**Notes:** This skeleton omits Sello, Certificado and NoCertificado, which are added when the document is signed with your CSD, and the TimbreFiscalDigital added by the PAC. Verify attribute rules, rounding and complements against the current SAT anexo 20 and your PAC documentation. Use sandbox RFCs for testing.

## Content

**Intro:** Developers wiring an ERP to a PAC often need a valid-looking CFDI 4.0 payload before the full add-on exists. This generator produces an ingreso skeleton with the main nodes in the right order, so you can test mappings and sandbox calls.

**Sections:**

#### How to use the generator

**Body:** Fill in the fields, copy the XML and submit it to your PAC's test endpoint after signing it with a test CSD. Change one field at a time to learn which validations trigger, for example switching the metodo de pago to PPD while keeping forma de pago 03, which should be rejected. The numeric fields are text so you control the decimals exactly; compute the subtotal and tax outside the tool and keep the amounts consistent.

**Bullets:**

- Subtotal equals the sum of line Importe values
- IVA base equals the line amount after discounts
- Total equals subtotal plus transferred taxes minus withholdings
- Dates must not be in the future relative to the PAC clock

#### Structure of a CFDI 4.0 document

**Body:** The root is cfdi:Comprobante, with Emisor, Receptor, Conceptos and a document-level Impuestos node. Each Concepto carries its own tax breakdown when ObjetoImp is 02. Complements, such as Carta Porte, payment or foreign trade, attach under cfdi:Complemento. The signature and stamp attributes are added later in the flow. Keep the namespace and schema location exactly as published, because validators check them.

#### Common mistakes

**Body:** Frequent causes of PAC rejections are a receiver name that differs from the SAT register, a postal code that does not belong to the stated state or municipality combination, rounding differences between line taxes and the document total, and a ClaveProdServ that does not exist in the catalog. Test with several realistic orders, including discounts, multiple tax lines and zero-rate items, not only the happy path.

**Cta:** If you want to see CFDI generation tested against real order data from your ERP, we can help build a read-only test harness that produces payloads without stamping.

**Faq:**

#### Is this XML ready to stamp?

**Answer:** No. It is a skeleton for testing. It still needs the signature attributes created with your CSD and, for real operations, correct catalog keys, tax calculations and any required complements. The PAC adds the fiscal stamp after validating the signed document.

#### Why are attributes in single quotes?

**Answer:** XML allows single or double quotes around attribute values. Single quotes keep the example easy to paste into strings in many programming languages. Your serializer will normally output double quotes, and the PAC accepts either form.

#### What RFC should I use for testing?

**Answer:** Use the test RFCs and certificates provided by your PAC's sandbox or published by the SAT for testing. Never use a real taxpayer's data in an experiment, and do not stamp test documents in production.

#### How do I add a Carta Porte or payment complement?

**Answer:** Complements are added under the cfdi:Complemento node with their own namespaces and schemas, and some change the TipoDeComprobante rules. Take the complement structure from the SAT documentation for that complement and validate with your PAC.

## Search terms

cfdi 4.0 xml example, cfdi 4.0 xml ejemplo, cfdi xml structure, cfdi 4.0 comprobante attributes, cfdi xml generator, cfdi concepto traslado iva xml, pac sandbox cfdi test, cfdi 4.0 emisor receptor

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
