Skip to main content
Key: it-sdi-v1 Module: github.com/invopop/gobl.it.sdi Italy exchanges electronic invoices in the FatturaPA XML format through the tax authority’s Sistema di Interscambio (SDI). This addon ensures a GOBL document has the fields and extensions needed to produce a valid FatturaPA file with gobl.fatturapa.

Customer identification

Every customer needs a tax_id, and what you put in it depends on who they are. For an Italian business, use their partita IVA (VAT number). An Italian private individual has no VAT number, so give the country alone and put their codice fiscale in an identity with the key it-fiscal-code. For a customer outside Italy, give the country, and their VAT number if they have one. In your GOBL document you can declare two kinds of inbox to tell SDI where the invoice should be delivered: it-sdi-code for a codice destinatario, and it-sdi-pec for a PEC address, which goes in the inbox’s email field. You can declare both. A FatturaPA document supports only one destination field, so the conversion prioritises the codice destinatario when it is available, and omits the PEC. FatturaPA always asks for a recipient code, and for a tax number when the party is a business. Some customers have neither, so the format defines a fixed value for each case and the conversion writes it for you. A codice destinatario names a channel accredited with SDI, so only recipients in Italy have one. An Italian customer who receives by PEC, or who has not given you a code, gets 0000000. A customer outside Italy has none, and SDI cannot deliver there anyway, so they get XXXXXXX. The conversion takes it from the country, and any inbox on that customer makes no difference. The tax number follows the same idea. A party outside Italy with no VAT number gets 0000000. A business outside the EU has a tax number, but SDI can only check EU VAT numbers, so the conversion replaces it with OO99999999999, on suppliers as much as customers. An Italian private individual needs no placeholder: their codice fiscale identifies them, and the conversion writes no tax number for them.

Simplified invoices

Add the simplified tag to issue a fattura semplificata (format FSM10, document types TD07, TD08 and TD09). The customer then needs only a partita IVA or codice fiscale; a name is sent only together with an address. The total may not exceed 400.00 EUR unless the supplier is in regime RF19 or RF20 or it is a credit or debit note correcting a preceding invoice, and every charge and discount needs a VAT combo, since the format lists them as entries alongside the lines. A credit or debit note must identify the invoice it corrects, with its date and the reason. Simplified invoices cannot go to a public administration, carry retained taxes or fund contributions, or cover intra-EU supplies (art. 21-bis DPR 633/72). Sales to a habitual exporter (N3.5) and stamp duty exemptions (NB1, NB2, NB3) need the ordinary format, the only one that carries the declaration of intent and those codes.

Scenarios

bill/invoice

Filters:
  • (none)
Output:
  • Extensions: it-sdi-format:FPR12
Filters:
  • Tags: b2g
Output:
  • Extensions: it-sdi-format:FPA12
Filters:
  • Tags: simplified
Output:
  • Extensions: it-sdi-format:FSM10
Filters:
  • Types: standard
Output:
  • Extensions: it-sdi-document-type:TD01
Filters:
  • Types: standard
  • Tags: partial
Output:
  • Extensions: it-sdi-document-type:TD02
Filters:
  • Types: credit-note
Output:
  • Extensions: it-sdi-document-type:TD04
Filters:
  • Types: debit-note
Output:
  • Extensions: it-sdi-document-type:TD05
Filters:
  • Types: standard
  • Tags: freelance
Output:
  • Extensions: it-sdi-document-type:TD06
Filters:
  • Types: standard
  • Tags: partial, freelance
Output:
  • Extensions: it-sdi-document-type:TD03
Filters:
  • Types: standard
  • Tags: simplified
Output:
  • Extensions: it-sdi-document-type:TD07
Filters:
  • Types: credit-note
  • Tags: simplified
Output:
  • Extensions: it-sdi-document-type:TD08
Filters:
  • Types: debit-note
  • Tags: simplified
Output:
  • Extensions: it-sdi-document-type:TD09
Filters:
  • Types: standard
  • Tags: self-billed
Output:
  • Extensions: it-sdi-document-type:TD27
Filters:
  • Types: standard
  • Tags: self-billed, reverse-charge
Output:
  • Extensions: it-sdi-document-type:TD16, it-sdi-issuer-type:CC
Filters:
  • Types: standard
  • Tags: self-billed, import
Output:
  • Extensions: it-sdi-document-type:TD17, it-sdi-issuer-type:CC
Filters:
  • Types: standard
  • Tags: self-billed, import, goods-eu
Output:
  • Extensions: it-sdi-document-type:TD18, it-sdi-issuer-type:CC
Filters:
  • Types: standard
  • Tags: self-billed, import, goods
Output:
  • Extensions: it-sdi-document-type:TD19, it-sdi-issuer-type:CC
Filters:
  • Types: standard
  • Tags: self-billed, regularization
Output:
  • Extensions: it-sdi-document-type:TD20, it-sdi-issuer-type:CC
Filters:
  • Types: standard
  • Tags: self-billed, ceiling-exceeded
Output:
  • Extensions: it-sdi-document-type:TD21
Filters:
  • Types: standard
  • Tags: self-billed, goods-extracted
Output:
  • Extensions: it-sdi-document-type:TD22, it-sdi-issuer-type:CC
Filters:
  • Types: standard
  • Tags: self-billed, goods-with-tax
Output:
  • Extensions: it-sdi-document-type:TD23, it-sdi-issuer-type:CC
Filters:
  • Types: standard
  • Tags: deferred
Output:
  • Extensions: it-sdi-document-type:TD24
Filters:
  • Types: standard
  • Tags: deferred, third-period
Output:
  • Extensions: it-sdi-document-type:TD25
Filters:
  • Types: standard
  • Tags: depreciable-assets
Output:
  • Extensions: it-sdi-document-type:TD26
Filters:
  • Types: standard
  • Tags: self-billed, san-marino-paper
Output:
  • Extensions: it-sdi-document-type:TD28, it-sdi-issuer-type:CC

Extensions

SDI Transmission Format

Code used to describe the transmission format of the invoice. It is set during calculation from the invoice’s tags: “FPA12” when the invoice carries the “b2g” tag, “FSM10” when it carries the “simplified” tag, and “FPR12” otherwise.

SDI Document Type

Code used to describe the type of document being sent to the SDI. This is used to determine the correct schema to use when validating the document.

Fiscal Regime Code

Exemption Code

Retained Tax Payment Reason Code

Retained Tax Statutory Rate

Statutory rate of a withholding computed on a reduced taxable base, as printed in AliquotaRitenuta. Italian withholdings often apply to a fraction of the line total, such as the 23% withheld on 50% of an agent’s commission (art. 25-bis DPR 600/1973). GOBL has no taxable base per tax, so the combo’s percent must be the effective rate over the whole line (11.50% in that example) and this extension keeps the statutory one. Set it when the two differ; ImportoRitenuta is still calculated from the percent, and whether the pair is coherent is up to the issuer.
Pattern: ^([0-9]{1,2}\.[0-9]{2}|100\.00)$

Payment Means

VAT Liability

Fund Type

Issuer Type

Says who issued the invoice when it was not the supplier. FatturaPA requires this in the SoggettoEmittente field whenever someone other than the supplier issues the document (article 21 of DPR 633/1972). When you name a third party as the ordering issuer, because that party issues the invoice on the supplier’s behalf, the addon sets TZ. When your tags select a document the customer issues, the addon sets CC and replaces any value you gave: TD16 to TD20, TD22, TD23 and TD28. On these the customer sends the document to SDI and the supplier block names the seller. TD21 and TD27 stay unset, because there the issuer is both supplier and customer. For any other invoice the customer issued, set CC yourself. A CC invoice cannot also name an ordering issuer, because FatturaPA keeps TerzoIntermediarioOSoggettoEmittente for a third party acting for the supplier.

Liquidation State

Indicates whether the company is in liquidation, used in the IscrizioneREA block of a FatturaPA document as the StatoLiquidazione field.

Shareholder State

Indicates the company’s shareholder configuration, used in the IscrizioneREA block of a FatturaPA document as the SocioUnico field.

SDI Notification

Outcome SDI reports for a submitted invoice, recorded on a bill.Status line. RC/NS/MC/AT/DT are the codes SDI emits directly; EC01/EC02 are the recipient responses resolved from a Notifica Esito.

Validation Rules