Generate CFDI con Carta Porte 3.1 XML
Skill: Convert a goods-transport movement into a CFDI with the Carta Porte 3.1 complemento, stamped by a PAC
Region: Mexico (México)
Category: Logistics — Traslado de mercancías (Carta Porte)
Does: Takes a goods-transport movement and produces a CFDI 4.0 cfdi:Comprobante carrying the complemento Carta Porte 3.1 (cartaporte31:CartaPorte) — Ubicaciones (origen/destino), Mercancias, and the transport means (Autotransporte / FiguraTransporte) — then stamped (timbrado) by a PAC which returns the TimbreFiscalDigital with the UUID.
Standard: SAT CFDI 4.0 (Anexo 20) + complemento Carta Porte 3.1
The Carta Porte complemento accredits the legal transport and possession of goods on Mexican territory; carriers and shippers must carry it during the movement. It rides on either a
TipoDeComprobante="T"(Traslado, own goods, no charge) orTipoDeComprobante="I"(Ingreso, transport service billed to a client). All claves (ClaveProdServSTCC,ClaveUnidad,ClaveTransporte,ConfigVehicular,SubTipoRem, road/port catalogs) come from the current SAT Carta Porte catálogos (catCartaPorte). Validate against the Anexo 20 + Carta Porte 3.1 XSDs before stamping.
When this applies
- Moving goods by road (autotransporte federal), rail, sea, or air on Mexican territory — whether transporting your own goods or providing a paid transport service.
- For a paid transport service use
TipoDeComprobante="I"withTranspInternac="No"(domestic); for moving your own goods useTipoDeComprobante="T"(Traslado) with no taxable amount. cartaporte31:CartaPorte@TotalDistRec(total kilometres) is required for autotransporte;@TranspInternacflags cross-border movements (withEntradaSalidaMerc,PaisOrigenDestino,ViaEntradaSalida).
Input data required
| Input | Node / attribute |
|---|---|
| Issuer / receiver (as any CFDI) | cfdi:Emisor, cfdi:Receptor, Comprobante@TipoDeComprobante (T/I) |
| Line concept | cfdi:Concepto@ClaveProdServ (78101800 servicio de transporte de carga), ObjetoImp |
| Movement header | CartaPorte@Version=3.1, @TranspInternac, @TotalDistRec |
| Origin | Ubicaciones/Ubicacion@TipoUbicacion="Origen", @RFCRemitenteDestinatario, @FechaHoraSalidaLlegada, Domicilio (CP, Estado, Pais) |
| Destination | Ubicaciones/Ubicacion@TipoUbicacion="Destino", @DistanciaRecorrida, Domicilio |
| Goods | Mercancias@PesoBrutoTotal, @UnidadPeso, @NumTotalMercancias; per item Mercancia@BienesTransp (clave producto SAT/STCC), @Descripcion, @Cantidad, @ClaveUnidad, @PesoEnKg, @MaterialPeligroso |
| Road transport | Autotransporte@PermSCT, @NumPermisoSCT, IdentificacionVehicular@ConfigVehicular/@PlacaVM/@AnioModeloVM, Seguros@AseguraRespCivil/@PolizaRespCivil |
| Transport figure | FiguraTransporte/TiposFigura@TipoFigura (01 operador), @RFCFigura, @NumLicencia |
Mexican specifics: every Ubicacion needs an IDUbicacion and a full Domicilio; the operator (TipoFigura="01") requires a NumLicencia. For dangerous goods set @MaterialPeligroso="Sí" with @CveMaterialPeligroso and @Embalaje.
Document structure
cfdi:Comprobante (Version=4.0, TipoDeComprobante=T|I)
├── cfdi:Emisor / cfdi:Receptor
├── cfdi:Conceptos/cfdi:Concepto (ClaveProdServ=78101800 / 78101801, ObjetoImp)
└── cfdi:Complemento
└── cartaporte31:CartaPorte (Version=3.1, IdCCP, TranspInternac, TotalDistRec)
├── cartaporte31:Ubicaciones
│ ├── Ubicacion (TipoUbicacion=Origen, RFCRemitenteDestinatario, FechaHoraSalidaLlegada, Domicilio)
│ └── Ubicacion (TipoUbicacion=Destino, DistanciaRecorrida, Domicilio)
├── cartaporte31:Mercancias (PesoBrutoTotal, UnidadPeso, NumTotalMercancias)
│ ├── Mercancia (BienesTransp, Descripcion, Cantidad, ClaveUnidad, PesoEnKg)
│ └── Autotransporte (PermSCT, NumPermisoSCT; IdentificacionVehicular; Seguros)
└── cartaporte31:FiguraTransporte/TiposFigura (TipoFigura=01, RFCFigura, NumLicencia)
The PAC then appends tfd:TimbreFiscalDigital (UUID). Carta Porte 3.1 also carries IdCCP — a 36-char identifier beginning with CCC.
Calculation rules
CartaPorte/@TotalDistRec= Σ of each destinationUbicacion/@DistanciaRecorrida(kilometres).Mercancias/@PesoBrutoTotal= Σ of eachMercancia/@PesoEnKg;@NumTotalMercancias= count ofMercancianodes.- For
TipoDeComprobante="T"theComprobante@SubTotal/@Totalare0and lines carry no taxes; forIthe transport fee is invoiced with IVA 16% as a normal CFDI. - Origin
FechaHoraSalidaLlegadamust precede destination arrival; distances and weights are positive.
Worked example (TipoDeComprobante T, autotransporte, abridged)
<?xml version="1.0" encoding="UTF-8"?>
<cfdi:Comprobante
xmlns:cfdi="http://www.sat.gob.mx/cfd/4"
xmlns:cartaporte31="http://www.sat.gob.mx/CartaPorte31"
Version="4.0" Serie="CP" Folio="200" Fecha="2026-06-04T07:00:00"
Sello="(sello CSD)" NoCertificado="30001000000400002463" Certificado="(base64)"
SubTotal="0" Moneda="XXX" Total="0" TipoDeComprobante="T"
Exportacion="01" LugarExpedicion="64000">
<cfdi:Emisor Rfc="AAA010101AAA" Nombre="TRANSPORTES ACME SA DE CV" RegimenFiscal="601"/>
<cfdi:Receptor Rfc="AAA010101AAA" Nombre="TRANSPORTES ACME SA DE CV"
DomicilioFiscalReceptor="64000" RegimenFiscalReceptor="601" UsoCFDI="S01"/>
<cfdi:Conceptos>
<cfdi:Concepto ClaveProdServ="78101800" ClaveUnidad="E48" Cantidad="1"
Descripcion="Servicio de traslado de mercancias" ValorUnitario="0" Importe="0" ObjetoImp="01"/>
</cfdi:Conceptos>
<cfdi:Complemento>
<cartaporte31:CartaPorte Version="3.1"
IdCCP="CCC4f8b2c10-1d2e-4a3b-9c8d-0e1f2a3b4c5d" TranspInternac="No" TotalDistRec="850">
<cartaporte31:Ubicaciones>
<cartaporte31:Ubicacion TipoUbicacion="Origen" IDUbicacion="OR000001"
RFCRemitenteDestinatario="AAA010101AAA" FechaHoraSalidaLlegada="2026-06-04T07:00:00">
<cartaporte31:Domicilio CodigoPostal="64000" Estado="NLE" Pais="MEX"/>
</cartaporte31:Ubicacion>
<cartaporte31:Ubicacion TipoUbicacion="Destino" IDUbicacion="DE000001"
RFCRemitenteDestinatario="AAA010101AAA" FechaHoraSalidaLlegada="2026-06-04T19:00:00"
DistanciaRecorrida="850">
<cartaporte31:Domicilio CodigoPostal="06000" Estado="CMX" Pais="MEX"/>
</cartaporte31:Ubicacion>
</cartaporte31:Ubicaciones>
<cartaporte31:Mercancias PesoBrutoTotal="1200.000" UnidadPeso="KGM" NumTotalMercancias="1">
<cartaporte31:Mercancia BienesTransp="50202306" Descripcion="Bebidas no alcoholicas"
Cantidad="100" ClaveUnidad="XBX" PesoEnKg="1200.000" MaterialPeligroso="No"/>
<cartaporte31:Autotransporte PermSCT="TPAF01" NumPermisoSCT="LF-1234567">
<cartaporte31:IdentificacionVehicular ConfigVehicular="C2" PesoBrutoVehicular="14.5"
PlacaVM="AB12345" AnioModeloVM="2022"/>
<cartaporte31:Seguros AseguraRespCivil="Seguros Ejemplo SA" PolizaRespCivil="POL-998877"/>
</cartaporte31:Autotransporte>
</cartaporte31:Mercancias>
<cartaporte31:FiguraTransporte>
<cartaporte31:TiposFigura TipoFigura="01" RFCFigura="MEXJ800101HJ1"
NombreFigura="JUAN PEREZ LOPEZ" NumLicencia="A1234567"/>
</cartaporte31:FiguraTransporte>
</cartaporte31:CartaPorte>
</cfdi:Complemento>
</cfdi:Comprobante>
For a billed transport service, switch to TipoDeComprobante="I", invoice the freight with IVA 16%, and set ClaveProdServ="78101801" (servicio de transporte de carga por carretera).
Validation checklist
- Correct
TipoDeComprobante(Town goods at zero value,Ibilled transport with IVA 16%) -
cartaporte31:CartaPorte Version="3.1"with a validIdCCPand@TranspInternac - Origen and Destino
Ubicacioneach haveIDUbicacion, RFC,FechaHoraSalidaLlegadaand fullDomicilio -
@TotalDistRec= Σ destinationDistanciaRecorrida;Mercancias/@PesoBrutoTotal= ΣPesoEnKg;@NumTotalMercanciascorrect -
BienesTransp,ClaveUnidad,ConfigVehicular,PermSCTfrom current catCartaPorte;MaterialPeligrosohandled -
AutotransportehasNumPermisoSCT, vehicle plates andSeguros; operator figure (TipoFigura="01") hasNumLicencia - Passes Anexo 20 + Carta Porte 3.1 XSD; PAC timbrado succeeds with
UUID
Last updated: 2026-06-04 — confirm the active CFDI/SAT schema version, catálogos, and PAC/portal requirements against the current SAT specifications before use.