Skip to main content

UBL XML to FatturaPA Mapping Reference

This document describes how UBL XML (Universal Business Language) invoice fields are mapped to the Italian FatturaPA XML invoice format.

DatiTrasmissione

FatturaPA FieldUBL XMLReq.DefaultConditionDescription
fatturaElettronicaHeader.datiTrasmissione.formatoTrasmissioneNoFPR12private recipient transmission format
fatturaElettronicaHeader.datiTrasmissione.codiceDestinatarioAccountingCustomerParty > Party > EndpointID[@schemeID="0205" and string-length(normalize-space(.))=7 and translate(normalize-space(.), "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "")=""]
XPathcac:AccountingCustomerParty/cac:Party/cbc:EndpointID[@schemeID="0205" and string-length(normalize-space(.))=7 and translate(normalize-space(.), "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "")=""]
NoEndpointID scheme 0205 is a 7 character private SDI codevalid seven-character SDI code from EndpointID scheme 0205. Converted to uppercase

CedentePrestatore

FatturaPA FieldUBL XMLReq.DefaultConditionDescription
fatturaElettronicaHeader.cedentePrestatore.datiAnagrafici.idFiscaleIva.idPaeseAccountingSupplierParty > Party > PartyTaxScheme[TaxScheme > ID="VAT"] > CompanyID
XPathcac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cbc:ID="VAT"]/cbc:CompanyID
Yessupplier VAT country prefix. Extracted via regex /^([A-Z]{2}).+$/
fatturaElettronicaHeader.cedentePrestatore.datiAnagrafici.idFiscaleIva.idCodiceAccountingSupplierParty > Party > PartyTaxScheme[TaxScheme > ID="VAT"] > CompanyID
XPathcac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cbc:ID="VAT"]/cbc:CompanyID
Yessupplier VAT identifier without country prefix. Extracted via regex /^[A-Z]{2}(.+)$/
fatturaElettronicaHeader.cedentePrestatore.datiAnagrafici.anagrafica.denominazioneAccountingSupplierParty > Party > PartyLegalEntity > RegistrationName
XPathcac:AccountingSupplierParty/cac:Party/cac:PartyLegalEntity/cbc:RegistrationName
Noseller declares a legal registration namesupplier legal registration name
fatturaElettronicaHeader.cedentePrestatore.datiAnagrafici.regimeFiscaleNobusiness-registrybusiness registry provides RegimeFiscaletenant tax regime from the business registry. Computed: businessRegistry.taxRegime
fatturaElettronicaHeader.cedentePrestatore.sede.indirizzoAccountingSupplierParty > Party > PostalAddress > StreetName
XPathcac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cbc:StreetName
Yessupplier street
fatturaElettronicaHeader.cedentePrestatore.sede.cAPAccountingSupplierParty > Party > PostalAddress > PostalZone
XPathcac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cbc:PostalZone
Yessupplier postal code
fatturaElettronicaHeader.cedentePrestatore.sede.comuneAccountingSupplierParty > Party > PostalAddress > CityName
XPathcac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cbc:CityName
Yessupplier municipality
fatturaElettronicaHeader.cedentePrestatore.sede.provinciaAccountingSupplierParty > Party > PostalAddress > CountrySubentity[string-length(normalize-space(.))=2 and translate(normalize-space(.), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "")=""]
XPathcac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cbc:CountrySubentity[string-length(normalize-space(.))=2 and translate(normalize-space(.), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "")=""]
Nosupplier province when explicitly present
fatturaElettronicaHeader.cedentePrestatore.sede.nazioneAccountingSupplierParty > Party > PostalAddress > Country > IdentificationCode
XPathcac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode
Yessupplier country

CessionarioCommittente

FatturaPA FieldUBL XMLReq.DefaultConditionDescription
fatturaElettronicaHeader.cessionarioCommittente.datiAnagrafici.idFiscaleIva.idPaeseAccountingCustomerParty > Party > PartyTaxScheme[TaxScheme > ID="VAT"] > CompanyID
XPathcac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cbc:ID="VAT"]/cbc:CompanyID
Nobuyer has an explicit VAT identifierbuyer VAT country prefix. Extracted via regex /^([A-Z]{2}).+$/
fatturaElettronicaHeader.cessionarioCommittente.datiAnagrafici.idFiscaleIva.idCodiceAccountingCustomerParty > Party > PartyTaxScheme[TaxScheme > ID="VAT"] > CompanyID
XPathcac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cbc:ID="VAT"]/cbc:CompanyID
Yesbuyer has an explicit VAT identifierbuyer VAT identifier. Extracted via regex /^[A-Z]{2}(.+)$/
fatturaElettronicaHeader.cessionarioCommittente.datiAnagrafici.codiceFiscaleAccountingCustomerParty > Party > PartyIdentification[ID > @schemeID="IT:CF" or ID > @schemeID="CF"] > ID
XPathcac:AccountingCustomerParty/cac:Party/cac:PartyIdentification[cbc:ID/@schemeID="IT:CF" or cbc:ID/@schemeID="CF"]/cbc:ID
Nobuyer has an explicit Italian fiscal codeexplicit buyer fiscal code
fatturaElettronicaHeader.cessionarioCommittente.datiAnagrafici.anagrafica.denominazioneAccountingCustomerParty > Party > PartyLegalEntity > RegistrationName
XPathcac:AccountingCustomerParty/cac:Party/cac:PartyLegalEntity/cbc:RegistrationName
Nobuyer declares a legal registration namebuyer legal registration name
fatturaElettronicaHeader.cessionarioCommittente.sede.indirizzoAccountingCustomerParty > Party > PostalAddress > StreetName
XPathcac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cbc:StreetName
Yesbuyer street
fatturaElettronicaHeader.cessionarioCommittente.sede.cAPAccountingCustomerParty > Party > PostalAddress > PostalZone[string-length(normalize-space(.))=5 and translate(normalize-space(.), "0123456789", "")=""]
XPathcac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cbc:PostalZone[string-length(normalize-space(.))=5 and translate(normalize-space(.), "0123456789", "")=""]
Yesbuyer country is Italyvalid five digit domestic postal code
fatturaElettronicaHeader.cessionarioCommittente.sede.comuneAccountingCustomerParty > Party > PostalAddress > CityName
XPathcac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cbc:CityName
Yesbuyer municipality
fatturaElettronicaHeader.cessionarioCommittente.sede.provinciaAccountingCustomerParty > Party > PostalAddress > CountrySubentity[string-length(normalize-space(.))=2 and translate(normalize-space(.), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "")=""]
XPathcac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cbc:CountrySubentity[string-length(normalize-space(.))=2 and translate(normalize-space(.), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "")=""]
Nobuyer province when explicitly present
fatturaElettronicaHeader.cessionarioCommittente.sede.nazioneAccountingCustomerParty > Party > PostalAddress > Country > IdentificationCode
XPathcac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode
Yesbuyer country

DatiGeneraliDocumento

FatturaPA FieldUBL XMLReq.DefaultConditionDescription
fatturaElettronicaBody[0].datiGenerali.datiGeneraliDocumento.tipoDocumentocbc:InvoiceTypeCodeYessupported UBL invoice type.
Map:
380TD01
STRICT
fatturaElettronicaBody[0].datiGenerali.datiGeneraliDocumento.divisacbc:DocumentCurrencyCodeYesinvoice currency
fatturaElettronicaBody[0].datiGenerali.datiGeneraliDocumento.datacbc:IssueDateYesissue date. Formatted as date (Y-m-d)
fatturaElettronicaBody[0].datiGenerali.datiGeneraliDocumento.numerocbc:IDYesinvoice identifier

DatiOrdineAcquisto

FatturaPA FieldUBL XMLReq.DefaultConditionDescription
fatturaElettronicaBody[0].datiGenerali.datiOrdineAcquisto[0].idDocumentoOrderReference > ID
XPathcac:OrderReference/cbc:ID
Nopurchase order identifier

DatiTrasporto

FatturaPA FieldUBL XMLReq.DefaultConditionDescription
fatturaElettronicaBody[0].datiGenerali.datiTrasporto.indirizzoResa.indirizzoDelivery > DeliveryLocation > Address > StreetName
XPathcac:Delivery/cac:DeliveryLocation/cac:Address/cbc:StreetName
Yesinvoice contains a delivery address nodedelivery street
fatturaElettronicaBody[0].datiGenerali.datiTrasporto.indirizzoResa.cAPDelivery > DeliveryLocation > Address > PostalZone
XPathcac:Delivery/cac:DeliveryLocation/cac:Address/cbc:PostalZone
Yesinvoice contains a delivery address node
delivery address is in Italy
domestic delivery postal code
fatturaElettronicaBody[0].datiGenerali.datiTrasporto.indirizzoResa.comuneDelivery > DeliveryLocation > Address > CityName
XPathcac:Delivery/cac:DeliveryLocation/cac:Address/cbc:CityName
Yesinvoice contains a delivery address nodedelivery municipality
fatturaElettronicaBody[0].datiGenerali.datiTrasporto.indirizzoResa.provinciaDelivery > DeliveryLocation > Address > CountrySubentity[string-length(normalize-space(.))=2 and translate(normalize-space(.), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "")=""]
XPathcac:Delivery/cac:DeliveryLocation/cac:Address/cbc:CountrySubentity[string-length(normalize-space(.))=2 and translate(normalize-space(.), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "")=""]
Noinvoice contains a delivery address nodedelivery province
fatturaElettronicaBody[0].datiGenerali.datiTrasporto.indirizzoResa.nazioneDelivery > DeliveryLocation > Address > Country > IdentificationCode
XPathcac:Delivery/cac:DeliveryLocation/cac:Address/cac:Country/cbc:IdentificationCode
Yesinvoice contains a delivery address nodedelivery country

DettaglioLinee

FatturaPA FieldUBL XMLReq.DefaultConditionDescription
fatturaElettronicaBody[0].datiBeniServizi.dettaglioLineecac:InvoiceLineYesUBL invoice lines. Grouped by cbc:ID

fatturaElettronicaBody[0].datiBeniServizi.dettaglioLinee

FatturaPA FieldUBL XMLReq.DefaultConditionDescription
numeroLineacbc:IDYessource line identifier
descrizione(Item > Description | Item > Name)[1]
XPath(cac:Item/cbc:Description | cac:Item/cbc:Name)[1]
Yessource description, falling back to item name
unitaMisuraInvoicedQuantity > @unitCode
XPathcbc:InvoicedQuantity/@unitCode
NoUN/ECE unit code
quantitacbc:InvoicedQuantityYesinvoiced quantity. Transform: numberFormat
prezzoUnitarioPrice > PriceAmount
XPathcac:Price/cbc:PriceAmount
Yesthe UBL price base is strictly positiveprice amount divided by BaseQuantity. Computed: floatval(source) / floatval(xpath(row, 'cac:Price/cbc:BaseQuantity')). Transform: numberFormat
prezzoTotalecbc:LineExtensionAmountYessource line net amount. Transform: numberFormat
aliquotaIVAItem > ClassifiedTaxCategory > Percent
XPathcac:Item/cac:ClassifiedTaxCategory/cbc:Percent
Yessource line VAT percentage. Transform: numberFormat
naturaItem > AdditionalItemProperty[Name="Natura"] > Value[contains("|N1|N2.1|N2.2|N3.1|N3.2|N3.3|N3.4|N3.5|N3.6|N4|N5|N6.1|N6.2|N6.3|N6.4|N6.5|N6.6|N6.7|N6.8|N6.9|N7|", concat("|", normalize-space(.), "|"))]
XPathcac:Item/cac:AdditionalItemProperty[cbc:Name="Natura"]/cbc:Value[contains("|N1|N2.1|N2.2|N3.1|N3.2|N3.3|N3.4|N3.5|N3.6|N4|N5|N6.1|N6.2|N6.3|N6.4|N6.5|N6.6|N6.7|N6.8|N6.9|N7|", concat("|", normalize-space(.), "|"))]
Noline VAT rate is zero
line contains an explicit FatturaPA Natura
explicit FatturaPA Natura
FatturaPA FieldUBL XMLReq.DefaultConditionDescription
fatturaElettronicaBody[0].datiBeniServizi.datiRiepilogoNomapped-linesinvoice contains at least one source linesummaries calculated from mapped lines. Computed: getValue(output, 'fatturaElettronicaBody[0].datiBeniServizi.dettaglioLinee'). Transform: calculateInvoiceItDatiRiepilogo
fatturaElettronicaBody[0].datiGenerali.datiGeneraliDocumento.importoTotaleDocumentoNomapped-summariesinvoice contains at least one source linetotal calculated from VAT summaries. Computed: getValue(output, 'fatturaElettronicaBody[0].datiBeniServizi.datiRiepilogo'). Transform: calculateInvoiceItTotalAmount

DatiPagamento

FatturaPA FieldUBL XMLReq.DefaultConditionDescription
fatturaElettronicaBody[0].datiPagamento[0].condizioniPagamentoPaymentTerms > Note
XPathcac:PaymentTerms/cbc:Note
Nopayment terms explicitly use TP01, TP02 or TP03explicit FatturaPA payment condition.
Map:
TP01TP01
TP02TP02
TP03TP03
STRICT
fatturaElettronicaBody[0].datiPagamento[0].dettaglioPagamento[0].modalitaPagamentoPaymentMeans > PaymentMeansCode
XPathcac:PaymentMeans/cbc:PaymentMeansCode
Yespayment terms explicitly use TP01, TP02 or TP03deterministic UNCL4461 mapping.
Map:
10MP01
30MP05
42MP05
49MP16
58MP05
59MP19
STRICT
fatturaElettronicaBody[0].datiPagamento[0].dettaglioPagamento[0].dataScadenzaPagamentocbc:DueDateNopayment terms explicitly use TP01, TP02 or TP03due date. Formatted as date (Y-m-d)
fatturaElettronicaBody[0].datiPagamento[0].dettaglioPagamento[0].importoPagamentoLegalMonetaryTotal > PayableAmount
XPathcac:LegalMonetaryTotal/cbc:PayableAmount
Yespayment terms explicitly use TP01, TP02 or TP03payable amount. Transform: numberFormat
fatturaElettronicaBody[0].datiPagamento[0].dettaglioPagamento[0].ibanPaymentMeans > PayeeFinancialAccount > ID
XPathcac:PaymentMeans/cac:PayeeFinancialAccount/cbc:ID
Nopayment terms explicitly use TP01, TP02 or TP03payee account identifier
fatturaElettronicaBody[0].datiPagamento[0].dettaglioPagamento[0].codicePagamentoPaymentMeans > PaymentID
XPathcac:PaymentMeans/cbc:PaymentID
Nopayment terms explicitly use TP01, TP02 or TP03payment reference

Allegati

FatturaPA FieldUBL XMLReq.DefaultConditionDescription
fatturaElettronicaBody[0].allegatiAdditionalDocumentReference[Attachment > EmbeddedDocumentBinaryObject]
XPathcac:AdditionalDocumentReference[cac:Attachment/cbc:EmbeddedDocumentBinaryObject]
Noembedded UBL document references. Grouped by cbc:ID

fatturaElettronicaBody[0].allegati

FatturaPA FieldUBL XMLReq.DefaultConditionDescription
nomeAttachmentAttachment > EmbeddedDocumentBinaryObject > @filename
XPathcac:Attachment/cbc:EmbeddedDocumentBinaryObject/@filename
Noembedded filename
formatoAttachmentAttachment > EmbeddedDocumentBinaryObject > @filename
XPathcac:Attachment/cbc:EmbeddedDocumentBinaryObject/@filename
Nouppercase filename extension. Extracted via regex /\.([^.]+)$/. Converted to uppercase
attachmentAttachment > EmbeddedDocumentBinaryObject
XPathcac:Attachment/cbc:EmbeddedDocumentBinaryObject
Yesbase64 document payload. Transform: base64Decode