pt

package
v0.210.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2025 License: Apache-2.0 Imports: 15 Imported by: 1

README

🇵🇹 GOBL Portugal Tax Regime

Portugal doesn't have an e-invoicing format per se. Tax information is reported electronically to the AT (Autoridade Tributária e Aduaneira) either periodically in batches via a SAF-T (PT) report or individually in real time via a web service.

Find example PT GOBL files in the examples (uncalculated documents) and examples/out (calculated envelopes) subdirectories.

Public Documentation

Portugal-specific Requirements

InvoiceType (Tipo de documento)

SAF-T's InvoiceType (Tipo de documento) specifies the type of a sales invoice. In GOBL, this type can be set using the pt-saft-invoice-type extension in the tax section. GOBL will set the extension for you based on the type and the tax tags you set in your invoice. The table below shows how this mapping is done:

Code Name GOBL Type GOBL Tax Tag
FT Fatura, emitida nos termos do artigo 36.o do Código do IVA standard
FS Fatura simplificada, emitida nos termos do artigo 40.o do Código do IVA standard simplified
FR Fatura-recibo standard invoice-receipt
ND Nota de débito credit-note
NC Nota de crédito debit-note

For example:

{
  "$schema": "https://gobl.org/draft-0/bill/invoice",
  "$tags": [
    "invoice-receipt"
  ],
  // [...]
  "type": "standard",
  // [...]
  "tax": {
    "ext": {
      "pt-saft-invoice-type": "FR"
    }
  },
  // [...]
TaxCountryRegion (País ou região do imposto)

SAF-T's TaxCountryRegion (País ou região do imposto) specifies the region of taxation (Portugal mainland, Açores or Madeira) in a Portuguese invoice. Each region has their own tax rates which can be determined automatically.

To set the specific a region different to Portugal mainland, the pt-region extension of each line's VAT tax should be set to one of the following values:

Code Description
PT Mainland Portugal (default)
PT-AC Açores
PT-MA Madeira

For example:

{
  "$schema": "https://gobl.org/draft-0/bill/invoice",
  // [...]
  "lines": [
    {
      // [...]
      "item": {
        "name": "Some service",
        "price": "25.00"
      },
      "tax": [
        {
            "cat": "VAT",
            "rate": "exempt",
            "ext": {
              "pt-region": "PT-AC",
              // [...]
            }
        }
      ]
    }
  ]
}
ProductType (Indicador de produto ou serviço)

SAF-T's ProductType (Indicador de produto ou serviço) indicates the type of each line item in an invoice. The pt-saft-product-type extension used at line item level allows to set the product type to one of the allowed values:

Code Description
P Products (default)
S Services
O Other
E Excise Duties
I Taxes, fees and parafiscal charges

For example:

{
  "$schema": "https://gobl.org/draft-0/bill/invoice",
  // [...]
  "lines": [
    {
      // [...]
      "item": {
        "name": "Some service",
        "price": "25.00",
        "ext": {
          "pt-saft-product-type": "S"
        }
      },
      // [...]
    }
  ]
}
VAT Tax Rates

The SAF-T's TaxCode (Código do imposto) is required for invoice items that apply VAT. GOBL provides the pt-saft-tax-rate extension to set this code at line tax level. It also determines it automatically this code using the rate field (when present). The following table lists the supported tax codes and how GOBL will map them:

Code Name GOBL Tax Rate
NOR Tipo Geral standard
INT Taxa Intermédia intermediate
RED Taxa Reduzida reduced
ISE Isenta exempt + extension code (see below)

AT's TaxExemptionCode (Código do motivo de isenção de imposto) is a code that specifies the reason the VAT tax is exempt in a Portuguese invoice. When the exempt tag is used, one of the following must be defined in the ext map's pt-exemption-code property:

Code Description
M01 Artigo 16.°, n.° 6 do CIVA
M02 Artigo 6.° do Decreto-Lei n.° 198/90, de 19 de junho
M04 Isento artigo 13.° do CIVA
M05 Isento artigo 14.° do CIVA
M06 Isento artigo 15.° do CIVA
M07 Isento artigo 9.° do CIVA
M09 IVA - não confere direito a dedução / Artigo 62.° alínea b) do CIVA
M10 IVA - regime de isenção / Artigo 57.° do CIVA
M11 Regime particular do tabaco / Decreto-Lei n.° 346/85, de 23 de agosto
M12 Regime da margem de lucro - Agências de viagens / Decreto-Lei n.° 221/85, de 3 de julho
M13 Regime da margem de lucro - Bens em segunda mão / Decreto-Lei n.° 199/96, de 18 de outubro
M14 Regime da margem de lucro - Objetos de arte / Decreto-Lei n.° 199/96, de 18 de outubro
M15 Regime da margem de lucro - Objetos de coleção e antiguidades / Decreto-Lei n.° 199/96, de 18 de outubro
M16 Isento artigo 14.° do RITI
M19 Outras isenções - Isenções temporárias determinadas em diploma próprio
M20 IVA - regime forfetário / Artigo 59.°-D n.°2 do CIVA
M21 IVA - não confere direito à dedução (ou expressão similar) - Artigo 72.° n.° 4 do CIVA
M25 Mercadorias à consignação - Artigo 38.° n.° 1 alínea a) do CIVA
M30 IVA - autoliquidação / Artigo 2.° n.° 1 alínea i) do CIVA
M31 IVA - autoliquidação / Artigo 2.° n.° 1 alínea j) do CIVA
M32 IVA - autoliquidação / Artigo 2.° n.° 1 alínea I) do CIVA
M33 IVA - autoliquidação / Artigo 2.° n.° 1 alínea m) do CIVA
M40 IVA - autoliquidação / Artigo 6.° n.° 6 alínea a) do CIVA, a contrário
M41 IVA - autoliquidação / Artigo 8.° n.° 3 do RITI
M42 IVA - autoliquidação / Decreto-Lei n.° 21/2007, de 29 de janeiro
M43 IVA - autoliquidação / Decreto-Lei n.° 362/99, de 16 de setembro
M99 Não sujeito ou não tributado

For example, you could define an invoice line exempt of tax as follows:

{
  "$schema": "https://gobl.org/draft-0/bill/invoice",
  // [...]
  "lines": [
    {
      // [...]
      "item": {
        "name": "Some service exempt of tax",
        "price": "25.00"
      },
      "tax": [
        {
            "cat": "VAT",
            "rate": "exempt",
            "ext": {
              // [...]
              "pt-saft-tax-rate": "ISE",
              "pt-exemption-code": "M19"
            }
        }
      ]
    }
  ]
}
Payment receipts

To report payment receipts to the AT, GOBL provides conversion from bill.Receipt documents. You can find an example of a valid Portugese receipt in the example folder.

In a payment, the SAF-T's PaymentType (Tipo de documento) field specifies its type. In GOBL, this type can be set using the pt-saft-receipt-type extension. GOBL will set the extension automatically based on the type and the tax tags you set. The table below shows how this mapping is done:

Code Name GOBL Type GOBL Tax Tag
RG Outro Recibo payment
RC Recibo no âmbito do regime de IVA de Caixa payment vat-cash

For example:

{
  "$schema": "https://gobl.org/draft-0/bill/receipt",
  // [...]
  "type": "payment",
  // [...]
  "ext": {
    "pt-saft-receipt-type": "RG"
  },
  // [...]
PaymentMechanism (Meios de pagamento)

The SAF-T's PaymentMechanism (Meios de pagamento) field specifies the payment means in a sales invoice or payment. GOBL provides the pt-saft-payment-means extension to set this value in your bill.Invoice advances or in you bill.Receipt method. GOBL maps certain payment mean keys automatically to this extension:

Code Name GOBL Payment Mean
CC Cartão crédito card
CD Cartão débito (*)
CH Cheque bancário cheque
CI Letter of credit (*)
CO Cheque ou cartão oferta (*)
CS Compensação de saldos em conta corrente netting
DE Dinheiro eletrónico online
LC Letra comercial promissory-note
MB Referências de pagamento para Multibanco (*)
NU Numerário cash
OU Outro other
PR Permuta de bens (*)
TB Transferência bancária ou débito direto autorizado credit-transfer, debit-transfer or direct-debit
TR Títulos de compensação extrassalarial (*)

(*) For codes not mapped from a GOBL Payment Mean, use other and explicitly set the extension.

For example, in an GOBL invoice:

{
  "$schema": "https://gobl.org/draft-0/bill/invoice",
  // [...]
  "payment": {
    "advances": [
      {
        "date": "2023-01-30",
        "key": "credit-transfer",
        "description": "Adiantamento",
        "amount": "100.00",
        "ext": {
          "pt-saft-payment-means": "TB"
        }
      }
    ]
  },
  // [...]
}

For example, in a GOBL receipt:

{
  "$schema": "https://gobl.org/draft-0/bill/receipt",
  // [...]
  "method": {
    "key": "other",
    "detail": "Compensação extrassalarial",
    "ext": {
      "pt-saft-payment-means": "TR"
    }
  },
  // [...]
}

Documentation

Overview

Package pt provides models for dealing with the Portuguese tax regime.

Index

Constants

View Source
const (
	RegionMainland = "PT"
	RegionAzores   = "PT-AC"
	RegionMadeira  = "PT-MA"
)

Region codes

View Source
const (
	TaxRateExempt        cbc.Key = "exempt"
	TaxRateOutlay        cbc.Key = "outlay"
	TaxRateIntrastate    cbc.Key = "intrastate-export"
	TaxRateImports       cbc.Key = "imports"
	TaxRateExports       cbc.Key = "exports"
	TaxRateSuspension    cbc.Key = "suspension-scheme"
	TaxRateInternalOps   cbc.Key = "internal-operations"
	TaxRateSmallRetail   cbc.Key = "small-retail-scheme"
	TaxRateExemptScheme  cbc.Key = "exempt-scheme"
	TaxRateTobacco       cbc.Key = "tobacco-scheme"
	TaxRateMargin        cbc.Key = "margin-scheme"
	TaxRateTravel        cbc.Key = "travel"
	TaxRateSecondHand    cbc.Key = "second-hand"
	TaxRateArt           cbc.Key = "art"
	TaxRateAntiques      cbc.Key = "antiques"
	TaxRateTransmission  cbc.Key = "goods-transmission"
	TaxRateOther         cbc.Key = "other"
	TaxRateFlatRate      cbc.Key = "flat-rate-scheme"
	TaxRateNonDeductible cbc.Key = "non-deductible"
	TaxRateConsignment   cbc.Key = "consignment-goods"
	TaxRateReverseCharge cbc.Key = "reverse-charge"
	TaxRateWaste         cbc.Key = "waste"
	TaxRateCivilEng      cbc.Key = "civil-eng"
	TaxRateGreenhouse    cbc.Key = "greenhouse"
	TaxRateWoods         cbc.Key = "woods"
	TaxRateB2B           cbc.Key = "b2b"
	TaxRateIntraEU       cbc.Key = "intraeu"
	TaxRateRealEstate    cbc.Key = "real-estate"
	TaxRateGold          cbc.Key = "gold"
	TaxRateNonTaxable    cbc.Key = "non-taxable"
)

Tax rate exemption tags

View Source
const (
	KeyATTaxCountryRegion cbc.Key = "at-tax-country-region"
	KeyATTaxCode          cbc.Key = "at-tax-code"
	KeyATTaxExemptionCode cbc.Key = "at-tax-exemption-code"
	KeyATInvoiceType      cbc.Key = "at-invoice-type"
)

Custom keys used typically in meta information

View Source
const (
	StampProviderATATCUD    cbc.Key = "at-atcud"
	StampProviderATQR       cbc.Key = "at-qr"
	StampProviderATHash     cbc.Key = "at-hash"
	StampProviderATHashFull cbc.Key = "at-hash-full"
	StampProviderATAppID    cbc.Key = "at-app-id"
)

AT official codes to include in stamps.

View Source
const (
	ExtKeyRegion = "pt-region"
)

Special codes to be used inside rates.

View Source
const (
	TagInvoiceReceipt cbc.Key = "invoice-receipt"
)

Invoice type tags

Variables

This section is empty.

Functions

func New

func New() *tax.RegimeDef

New instantiates a new Portugal regime for the given zone.

func Normalize added in v0.200.0

func Normalize(doc any)

Normalize will attempt to clean the object passed to it.

func Validate

func Validate(doc any) error

Validate checks the document type and determines if it can be validated.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL