KSeF FA(3) to Peppol UBL Mapping Reference
This document describes how the fields of a Polish KSeF FA(3) e-invoice are mapped to a Peppol BIS Billing 3.0 UBL invoice or credit note.
For each target item, a field rule with overwrite: false (the default) skips an existing non-object value that PHP considers non-empty. A rule with overwrite: true can replace an existing value when its conditions pass and it produces a value. Repeated groups for the same target can write to the same item when their group keys match.
Header
P_1 = Issue date
P_2 = Invoice number
RodzajFaktury = Invoice type (VAT, KOR, ZAL, ROZ, KOR_ZAL, KOR_ROZ)
KodWaluty = Currency code
PrzyczynaKorekty = Reason for the correction
OkresFa = Invoicing period
NrKlienta = Customer number
NrZamowienia = Order number
WZ = Delivery note
FakturaZaliczkowa = Advance invoice settled by a final invoice
DaneFaKorygowanej = Data of the corrected invoice
Termin = Payment due date
| UBL Field | FA(3) |
|---|---|
| |
| |
| Fa > P_2 | |
| |
| Fa > P_1 | |
| |
| Fa > Platnosc > TerminPlatnosci > TerminOnly when: FA(3) invoice (VAT), advance invoice (ZAL) or final invoice (ROZ), converted to an Invoice | |
| |
| Only when: FA(3) advance invoice (ZAL): its totals are the advance received, its lines are optional | |
| |
| Only when: FA(3) invoice (VAT), advance invoice (ZAL) or final invoice (ROZ), converted to an Invoice | |
| |
| Only when: FA(3) correction (KOR), correction of an advance invoice (KOR_ZAL) or of a final invoice (KOR_ROZ), converted to a CreditNote | |
| |
| Fa > PrzyczynaKorektyOnly when: FA(3) correction (KOR), correction of an advance invoice (KOR_ZAL) or of a final invoice (KOR_ROZ), converted to a CreditNote | |
| |
| Fa > KodWaluty | |
| |
| Only when: Document in a currency other than PLN with a non-zero sum of P_14_1W to P_14_4W | |
| |
| Podmiot2 > NrKlienta | |
| |
| Fa > P_2Only when: The FA(3) has no order number | |
| |
| Fa > OkresFa > P_6_Od | |
| |
| Fa > OkresFa > P_6_Do | |
| |
| Fa > WarunkiTransakcji > Zamowienia > NrZamowienia | |
| |
| Fa > WZOnly when: FA(3) invoice (VAT), advance invoice (ZAL) or final invoice (ROZ), converted to an Invoice | |
| |
| Fa > DaneFaKorygowanej | |
| |
| Fa > FakturaZaliczkowaOnly when: FA(3) final invoice (ROZ) or correction of a final invoice (KOR_ROZ) | |
| |
billingReference
| UBL Field | FA(3) |
|---|---|
| fa:NrFaKorygowanej | |
| |
| fa:DataWystFaKorygowanej | |
| |
billingReference
| UBL Field | FA(3) |
|---|---|
| fa:NrFaZaliczkowej | |
| |
| fa:NrKSeFFaZaliczkowej | |
| |
KSeF number, from the metadata of the call
NrKSeFFaKorygowanej = KSeF number of the corrected invoice
| UBL Field | FA(3) |
|---|---|
| Only when: The caller passed the KSeF number of the document | |
| |
| Only when: The caller passed the KSeF number of the document | |
| |
| Fa > DaneFaKorygowanej[NrKSeFFaKorygowanej] | |
| |
additionalDocumentReference
| UBL Field | FA(3) |
|---|---|
| fa:NrKSeFFaKorygowanej | |
| |
| |
Parties
Podmiot1 = Seller
Podmiot2 = Buyer
NIP = Polish tax identification number
KodUE = Country code of an EU VAT number
NrVatUE = EU VAT number without its country code
Nazwa = Name
AdresL1, AdresL2 = Address lines
KodKraju = Country code
Stopka = Footer
KRS = Number in the National Court Register
| UBL Field | FA(3) |
|---|---|
| fa:Podmiot1 | |
| |
| Stopka > Rejestry > KRS | |
| |
| fa:Podmiot2 | |
| |
accountingSupplierParty.party
| UBL Field | FA(3) |
|---|---|
| DaneIdentyfikacyjne > NIPOnly when: NOT: The party has an EU VAT number: the country code (KodUE) is written | |
| |
| Only when: The party has a Polish tax number (NIP) | |
| |
| DaneIdentyfikacyjne > KodUE, DaneIdentyfikacyjne > NrVatUEOnly when: The country of the EU VAT number (KodUE) has a Peppol scheme for VAT numbers (all but DK, FI, SE and XI) | |
| |
| Only when: The country of the EU VAT number (KodUE) has a Peppol scheme for VAT numbers (all but DK, FI, SE and XI) | |
| |
| DaneIdentyfikacyjne > KodUEOnly when: The party has an EU VAT number: the country code (KodUE) is written; NOT: The country of the EU VAT number (KodUE) has a Peppol scheme for VAT numbers (all but DK, FI, SE and XI) | |
| |
| DaneIdentyfikacyjne > Nazwa | |
| |
| Adres > AdresL1 | |
| |
| Adres > AdresL2 | |
| |
| Adres > AdresL2 | |
| |
| Adres > AdresL2 | |
| |
| Adres > KodKraju | |
| |
| DaneIdentyfikacyjne > NIP | |
| |
| DaneIdentyfikacyjne > KodUE, DaneIdentyfikacyjne > NrVatUE | |
| |
| Only when: The party has a Polish tax number (NIP) or the country code of an EU VAT number (KodUE) | |
| |
| DaneIdentyfikacyjne > Nazwa | |
| |
| DaneKontaktowe > Telefon | |
| |
| DaneKontaktowe > Email | |
| |
accountingCustomerParty.party
| UBL Field | FA(3) |
|---|---|
| DaneIdentyfikacyjne > NIPOnly when: NOT: The party has an EU VAT number: the country code (KodUE) is written | |
| |
| Only when: The party has a Polish tax number (NIP) | |
| |
| DaneIdentyfikacyjne > KodUE, DaneIdentyfikacyjne > NrVatUEOnly when: The country of the EU VAT number (KodUE) has a Peppol scheme for VAT numbers (all but DK, FI, SE and XI) | |
| |
| Only when: The country of the EU VAT number (KodUE) has a Peppol scheme for VAT numbers (all but DK, FI, SE and XI) | |
| |
| DaneIdentyfikacyjne > KodUEOnly when: The party has an EU VAT number: the country code (KodUE) is written; NOT: The country of the EU VAT number (KodUE) has a Peppol scheme for VAT numbers (all but DK, FI, SE and XI) | |
| |
| DaneIdentyfikacyjne > Nazwa | |
| |
| Adres > AdresL1 | |
| |
| Adres > AdresL2 | |
| |
| Adres > AdresL2 | |
| |
| Adres > AdresL2 | |
| |
| Adres > KodKraju | |
| |
| DaneIdentyfikacyjne > NIP | |
| |
| DaneIdentyfikacyjne > KodUE, DaneIdentyfikacyjne > NrVatUE | |
| |
| Only when: The party has a Polish tax number (NIP) or the country code of an EU VAT number (KodUE) | |
| |
| DaneIdentyfikacyjne > Nazwa | |
| |
| DaneKontaktowe > Telefon | |
| |
| DaneKontaktowe > Email | |
| |
Delivery and payment
P_6 = Date of the supply
P_6A = Date of the supply of a line
WysylkaDo = Destination of the transport
Platnosc = Payment
FormaPlatnosci = Payment form
RachunekBankowy = Bank account of the seller
RachunekBankowyFaktora = Bank account of the factor
NrRB = Account number
| UBL Field | FA(3) |
|---|---|
| Fa > P_6 | |
| |
| Fa[not(FaWiersz[P_11 or P_11A][not(P_6A)])][not(FaWiersz > P_6A != FaWiersz > P_6A)] > FaWiersz > P_6AOnly when: Intra-community supply of goods (P_13_6_2), VAT category K; The FA(3) has no start of the invoicing period (OkresFa/P_6_Od) | |
| |
| Fa > P_1Only when: Intra-community supply of goods (P_13_6_2), VAT category K; The FA(3) has no start of the invoicing period (OkresFa/P_6_Od) and no line with a date of the supply (P_6A) | |
| |
| Fa > FaWiersz > P_6AOnly when: Intra-community supply of goods (P_13_6_2), VAT category K; The FA(3) has no start of the invoicing period (OkresFa/P_6_Od) | |
| |
| Fa > WarunkiTransakcji > Transport > WysylkaDo > KodKrajuOnly when: Intra-community supply of goods (P_13_6_2), VAT category K | |
| |
| Podmiot2 > Adres > KodKrajuOnly when: Intra-community supply of goods (P_13_6_2), VAT category K; The country code of the buyer address (Podmiot2/Adres/KodKraju) is not PL | |
| |
| Podmiot2 > Adres > KodKrajuOnly when: Intra-community supply of goods (P_13_6_2), VAT category K | |
| |
| Fa > Platnosc[FormaPlatnosci and (FormaPlatnosci != 6 or RachunekBankowy > NrRB or RachunekBankowyFaktora > NrRB)] | |
| |
paymentMeans
| UBL Field | FA(3) |
|---|---|
| fa:FormaPlatnosci | |
| |
| TerminPlatnosci > TerminOnly when: FA(3) correction (KOR), correction of an advance invoice (KOR_ZAL) or of a final invoice (KOR_ROZ), converted to a CreditNote | |
| |
| RachunekBankowy > NrRB | |
| |
| RachunekBankowyFaktora > NrRB | |
| |
VAT
P_13_x = Net total by VAT rate
P_14_x = VAT amount of that total
P_14_xW = The same VAT amount in PLN
Adnotacje = Annotations
Zwolnienie = Exemption
P_19A, P_19B, P_19C = Legal basis of the exemption
PMarzy = Margin scheme
| UBL Field | FA(3) |
|---|---|
| Fa > P_13_5 | |
| |
| Fa > P_13_8 | |
| |
| Fa > P_13_1Only when: FA(3) invoice (VAT), advance invoice (ZAL) or final invoice (ROZ), converted to an Invoice; The FA(3) has no net total by VAT rate (P_13_x) | |
| |
| Fa > RodzajFakturyOnly when: FA(3) correction (KOR), correction of an advance invoice (KOR_ZAL) or of a final invoice (KOR_ROZ), converted to a CreditNote; The FA(3) has no net total by VAT rate (P_13_x) | |
| |
| Fa > P_13_10Only when: The FA(3) also has the total for services taxed in another EU country (P_13_9) | |
| |
| Fa > P_13_11Only when: The FA(3) also has an exempt total (P_13_7) | |
| |
| |
| Fa > KodWaluty | |
| |
| Fa > P_13_1 | |
| |
| Fa > P_13_2 | |
| |
| Fa > P_13_3 | |
| |
| Fa > P_13_4 | |
| |
| Fa > P_13_6_1 | |
| |
| Fa > P_13_6_2 | |
| |
| Fa > P_13_6_3 | |
| |
| Fa > P_13_7 | |
| |
| Fa > P_13_9 | |
| |
| Fa > P_13_10 | |
| |
| Fa > P_13_11 | |
| |
| Only when: Document in a currency other than PLN with a non-zero sum of P_14_1W to P_14_4W | |
| |
| Only when: Document in a currency other than PLN with a non-zero sum of P_14_1W to P_14_4W | |
| |
taxTotal[0].taxSubtotal[P_13_1]
| UBL Field | FA(3) |
|---|---|
| .. > P_13_1 | |
| |
| .. > KodWaluty | |
| |
| .. > P_14_1 | |
| |
| .. > KodWaluty | |
| |
| |
| Only when: A line has the rate 22%; No converted line has the rate 23% | |
| |
| |
| |
taxTotal[0].taxSubtotal[P_13_2]
| UBL Field | FA(3) |
|---|---|
| .. > P_13_2 | |
| |
| .. > KodWaluty | |
| |
| .. > P_14_2 | |
| |
| .. > KodWaluty | |
| |
| |
| Only when: A line has the rate 7%; No converted line has the rate 8% | |
| |
| |
| |
taxTotal[0].taxSubtotal[P_13_3]
| UBL Field | FA(3) |
|---|---|
| .. > P_13_3 | |
| |
| .. > KodWaluty | |
| |
| .. > P_14_3 | |
| |
| .. > KodWaluty | |
| |
| |
| |
| |
taxTotal[0].taxSubtotal[P_13_4]
| UBL Field | FA(3) |
|---|---|
| .. > P_13_4 | |
| |
| .. > KodWaluty | |
| |
| .. > P_14_4 | |
| |
| .. > KodWaluty | |
| |
| |
| Only when: A line has the rate 3%; No converted line has the rate 4% | |
| |
| |
| |
taxTotal[0].taxSubtotal[P_13_6_1]
| UBL Field | FA(3) |
|---|---|
| .. > P_13_6_1 | |
| |
| .. > KodWaluty | |
| |
| |
| .. > KodWaluty | |
| |
| |
| |
| |
taxTotal[0].taxSubtotal[P_13_6_2]
| UBL Field | FA(3) |
|---|---|
| .. > P_13_6_2 | |
| |
| .. > KodWaluty | |
| |
| |
| .. > KodWaluty | |
| |
| |
| |
| |
| |
taxTotal[0].taxSubtotal[P_13_6_3]
| UBL Field | FA(3) |
|---|---|
| .. > P_13_6_3 | |
| |
| .. > KodWaluty | |
| |
| |
| .. > KodWaluty | |
| |
| |
| |
| |
| |
taxTotal[0].taxSubtotal[P_13_7]
| UBL Field | FA(3) |
|---|---|
| .. > P_13_7 | |
| |
| .. > KodWaluty | |
| |
| |
| .. > KodWaluty | |
| |
| |
| |
| .. > Adnotacje > Zwolnienie > P_19A | |
| |
| .. > Adnotacje > Zwolnienie > P_19B | |
| |
| .. > Adnotacje > Zwolnienie > P_19C | |
| |
| |
| |
taxTotal[0].taxSubtotal[P_13_9]
| UBL Field | FA(3) |
|---|---|
| .. > P_13_9 | |
| |
| .. > KodWaluty | |
| |
| |
| .. > KodWaluty | |
| |
| |
| |
| |
| |
taxTotal[0].taxSubtotal[P_13_10]
| UBL Field | FA(3) |
|---|---|
| .. > P_13_10 | |
| |
| .. > KodWaluty | |
| |
| |
| .. > KodWaluty | |
| |
| |
| |
| |
| |
taxTotal[0].taxSubtotal[P_13_11]
| UBL Field | FA(3) |
|---|---|
| .. > P_13_11 | |
| |
| .. > KodWaluty | |
| |
| |
| .. > KodWaluty | |
| |
| |
| |
| Only when: Margin scheme for travel agents (P_PMarzy_2) | |
| |
| Only when: Margin scheme for second-hand goods (P_PMarzy_3_1) | |
| |
| Only when: Margin scheme for works of art (P_PMarzy_3_2) | |
| |
| Only when: Margin scheme for collectors' items and antiques (P_PMarzy_3_3) | |
| |
| Only when: NOT: Margin scheme for travel agents (P_PMarzy_2) | |
| |
| |
Totals
P_15 = Invoice total
Rozliczenie = Settlement
DoZaplaty = Amount to pay
Zaplacono = Paid
ZnacznikZaplatyCzesciowej = Partial payment flag
ZaplataCzesciowa = Partial payment
| UBL Field | FA(3) |
|---|---|
| |
| |
| |
| Only when: Invoice already paid in one payment (Zaplacono 1) or in parts (ZnacznikZaplatyCzesciowej 2) | |
| |
| Fa > Rozliczenie > DoZaplaty | |
| |
| Fa > P_15 | |
| |
| Fa > P_15 | |
| |
| Fa > P_15 | |
| |
| Fa > KodWaluty | |
| |
| Fa > KodWaluty | |
| |
| Fa > KodWaluty | |
| |
| Fa > KodWaluty | |
| |
| Fa > KodWaluty | |
| |
| Fa > KodWaluty | |
| |
Lines
FaWiersz = Invoice line
P_7 = Name of the goods or service
P_8A = Unit of measure
P_8B = Quantity
P_9A = Net unit price
P_9B = Gross unit price
P_11 = Net amount
P_11A = Gross amount
P_12 = VAT rate
StanPrzed = State before the correction
| UBL Field | FA(3) |
|---|---|
| Fa > FaWiersz > P_11Only when: FA(3) invoice (VAT), advance invoice (ZAL) or final invoice (ROZ), converted to an Invoice; NOT: FA(3) advance invoice (ZAL): its totals are the advance received, its lines are optional; No line has an amount, net (P_11) or gross (P_11A) | |
| |
| Fa > FaWiersz[P_11 or P_11A]Only when: FA(3) invoice (VAT), advance invoice (ZAL) or final invoice (ROZ), converted to an Invoice | |
| |
| Fa > FaWiersz[P_11 or P_11A]Only when: FA(3) correction (KOR), correction of an advance invoice (KOR_ZAL) or of a final invoice (KOR_ROZ), converted to a CreditNote | |
| |
| Fa > *[starts-with(local-name(), 'P_13_')][not(.. > FaWiersz[P_11 or P_11A])]Only when: FA(3) correction (KOR), correction of an advance invoice (KOR_ZAL) or of a final invoice (KOR_ROZ), converted to a CreditNote | |
| |
| Fa > *[starts-with(local-name(), 'P_13_')][not(.. > FaWiersz[P_11 or P_11A])]Only when: FA(3) advance invoice (ZAL): its totals are the advance received, its lines are optional | |
| |
invoiceLine
| UBL Field | FA(3) |
|---|---|
| _position | |
| |
| fa:P_8BOnly when: FA(3) invoice (VAT), advance invoice (ZAL) or final invoice (ROZ), converted to an Invoice | |
| |
| fa:P_8BOnly when: FA(3) correction (KOR), correction of an advance invoice (KOR_ZAL) or of a final invoice (KOR_ROZ), converted to a CreditNote | |
| |
| fa:P_8AOnly when: FA(3) invoice (VAT), advance invoice (ZAL) or final invoice (ROZ), converted to an Invoice | |
| |
| fa:P_8AOnly when: FA(3) correction (KOR), correction of an advance invoice (KOR_ZAL) or of a final invoice (KOR_ROZ), converted to a CreditNote | |
| |
| fa:P_11 | |
| |
| fa:P_11AOnly when: Line with the gross amount only (P_11A) and a VAT rate: the net is computed | |
| |
| fa:P_11A | |
| |
| .. > KodWaluty | |
| |
| fa:P_7 | |
| |
| fa:P_12 | |
| |
| Only when: Line without a VAT rate (margin scheme) | |
| |
| fa:P_12 | |
| |
| Only when: Line without a VAT rate (margin scheme) | |
| |
| |
| fa:P_9AOnly when: Line with the net amount (P_11) | |
| |
| fa:P_9BOnly when: Line with the gross amount only (P_11A) and a VAT rate: the net is computed | |
| |
| fa:P_9BOnly when: Line with the gross amount only (P_11A) | |
| |
| fa:P_11 | |
| |
| fa:P_11A | |
| |
| .. > KodWaluty | |
| |
| |
| |
| |
| .. > KodWaluty | |
| |
creditNoteLine
| UBL Field | FA(3) |
|---|---|
| _position | |
| |
| fa:P_8BOnly when: FA(3) invoice (VAT), advance invoice (ZAL) or final invoice (ROZ), converted to an Invoice | |
| |
| fa:P_8BOnly when: FA(3) correction (KOR), correction of an advance invoice (KOR_ZAL) or of a final invoice (KOR_ROZ), converted to a CreditNote | |
| |
| fa:P_8AOnly when: FA(3) invoice (VAT), advance invoice (ZAL) or final invoice (ROZ), converted to an Invoice | |
| |
| fa:P_8AOnly when: FA(3) correction (KOR), correction of an advance invoice (KOR_ZAL) or of a final invoice (KOR_ROZ), converted to a CreditNote | |
| |
| fa:P_11 | |
| |
| fa:P_11AOnly when: Line with the gross amount only (P_11A) and a VAT rate: the net is computed | |
| |
| fa:P_11A | |
| |
| .. > KodWaluty | |
| |
| fa:P_7 | |
| |
| fa:P_12 | |
| |
| Only when: Line without a VAT rate (margin scheme) | |
| |
| fa:P_12 | |
| |
| Only when: Line without a VAT rate (margin scheme) | |
| |
| |
| fa:P_9AOnly when: Line with the net amount (P_11) | |
| |
| fa:P_9BOnly when: Line with the gross amount only (P_11A) and a VAT rate: the net is computed | |
| |
| fa:P_9BOnly when: Line with the gross amount only (P_11A) | |
| |
| fa:P_11 | |
| |
| fa:P_11A | |
| |
| .. > KodWaluty | |
| |
| |
| |
| |
| .. > KodWaluty | |
| |
creditNoteLine
| UBL Field | FA(3) |
|---|---|
| _position | |
| |
| .Only when: FA(3) invoice (VAT), advance invoice (ZAL) or final invoice (ROZ), converted to an Invoice | |
| |
| .Only when: FA(3) correction (KOR), correction of an advance invoice (KOR_ZAL) or of a final invoice (KOR_ROZ), converted to a CreditNote | |
| |
| Only when: FA(3) invoice (VAT), advance invoice (ZAL) or final invoice (ROZ), converted to an Invoice | |
| |
| Only when: FA(3) correction (KOR), correction of an advance invoice (KOR_ZAL) or of a final invoice (KOR_ROZ), converted to a CreditNote | |
| |
| . | |
| |
| .. > KodWaluty | |
| |
| Only when: FA(3) advance invoice (ZAL): its totals are the advance received, its lines are optional | |
| |
| .. > PrzyczynaKorekty | |
| |
| |
| |
| |
| . | |
| |
| .. > KodWaluty | |
| |
invoiceLine
| UBL Field | FA(3) |
|---|---|
| _position | |
| |
| .Only when: FA(3) invoice (VAT), advance invoice (ZAL) or final invoice (ROZ), converted to an Invoice | |
| |
| .Only when: FA(3) correction (KOR), correction of an advance invoice (KOR_ZAL) or of a final invoice (KOR_ROZ), converted to a CreditNote | |
| |
| Only when: FA(3) invoice (VAT), advance invoice (ZAL) or final invoice (ROZ), converted to an Invoice | |
| |
| Only when: FA(3) correction (KOR), correction of an advance invoice (KOR_ZAL) or of a final invoice (KOR_ROZ), converted to a CreditNote | |
| |
| . | |
| |
| .. > KodWaluty | |
| |
| Only when: FA(3) advance invoice (ZAL): its totals are the advance received, its lines are optional | |
| |
| .. > PrzyczynaKorekty | |
| |
| |
| |
| |
| . | |
| |
| .. > KodWaluty | |
| |