br-nfe-v4
Module: github.com/invopop/gobl.br.nfe
Correction Definitions
Auto-generation of corrective invoices or credit and debit notes is supported.Invoice Types
The types of invoices that can be created with a preceding definition:credit-notedebit-note
Stamp Keys
Stamp keys from the previous invoice that need to be referenced:sefaz-key
Scenarios
bill/invoice
standard, credit-note, debit-note
standard, credit-note, debit-note
Filters:
- Types:
standard,credit-note,debit-note
- Extensions:
br-nfe-model:55
standard, credit-note, debit-note, #simplified
standard, credit-note, debit-note, #simplified
Filters:
- Types:
standard,credit-note,debit-note - Tags:
simplified
- Extensions:
br-nfe-model:65
standard
standard
Filters:
- Types:
standard
- Extensions:
br-nfe-operation-type:1,br-nfe-purpose:1
Extensions
Fiscal Document Model Code
Code used to identify the fiscal document model. It will be determined automatically by GOBL during normalization according to the scenario definitions.br-nfe-model
br-nfe-model
| Code | Name |
|---|---|
55 | NF-e |
65 | NFC-e |
Buyer Presence Indicator
Indicator of the buyer’s presence at the commercial establishment at the time of the operation. This field is used to classify the type of commercial transaction according to Brazilian tax regulations.br-nfe-presence
br-nfe-presence
| Code | Name |
|---|---|
0 | Not applicable |
1 | In-person operation |
2 | Non-in-person operation, via Internet |
3 | Non-in-person operation, Tele-service |
4 | NFC-e in operation with home delivery |
5 | In-person operation, outside establishment |
9 | Non-in-person operation, others |
Payment Method
Code used to identify the payment method used for the transaction.br-nfe-payment-means
br-nfe-payment-means
| Code | Name |
|---|---|
01 | Cash |
02 | Check |
03 | Credit Card |
04 | Debit Card |
05 | Store Credit |
10 | Food Voucher |
11 | Meal Voucher |
12 | Gift Voucher |
13 | Fuel Voucher |
15 | Bank Slip (Boleto) |
16 | Bank Deposit |
17 | Instant Payment (PIX) |
18 | Bank Transfer, Digital Wallet |
19 | Loyalty Program, Cashback, Virtual Credit |
90 | No Payment |
99 | Others |
CFOP (Fiscal Operations and Services Code)
Four-digit code that classifies the nature of goods movements and service provisions for ICMS purposes in Brazil. The first digit indicates the operation origin/destination (1–3 for entries; 5–7 for exits), and the remaining digits identify the specific type of operation.br-nfe-cfop
br-nfe-cfop
Pattern:
^[1-7]\d{3}$Fiscal Incentive Indicator
Indicates whether a party benefits from a fiscal incentive.br-nfe-fiscal-incentive
br-nfe-fiscal-incentive
| Code | Name |
|---|---|
1 | Has incentive |
2 | Does not have incentive |
Tax Regime Code
Indicates the tax regime that a party is subject to. Defaults to3
(normal regime) during normalization when not provided.
br-nfe-regime
br-nfe-regime
| Code | Name |
|---|---|
1 | Simples Nacional |
2 | Simples Nacional, Excess |
3 | Normal |
4 | MEI - Individual Micro-entrepreneur |
Special Tax Regime Code
Indicates a special tax regime that a party is subject to.br-nfe-special-regime
br-nfe-special-regime
| Code | Name |
|---|---|
1 | Municipal micro-enterprise |
2 | Estimated |
3 | Professional Society |
4 | Cooperative |
5 | Single micro-entrepreneur (MEI) |
6 | Micro-enterprise or Small Business (ME EPP) |
ICMS Tax Status Code (CST)
ICMS tax status code (CST) for the line item, used by issuers under the normal regime (br-nfe-regime 3). Simples Nacional issuers must use the CSOSN code
(br-nfe-icms-csosn) instead. Defaults to 00 (taxed in full) during
normalization when not provided.
br-nfe-icms-cst
br-nfe-icms-cst
| Code | Name |
|---|---|
00 | Taxed in full |
02 | Monophasic taxation (fuels) |
10 | Taxed with ICMS charged by tax substitution |
15 | Fuel operation with ICMS retention |
20 | Taxed with tax base reduction |
30 | Exempt/non-taxed with ICMS charged by tax substitution |
40 | Exempt |
41 | Non-taxed |
50 | Suspended |
51 | Deferred |
53 | Fuel operation with deferral |
60 | ICMS charged previously by tax substitution |
61 | Fuel operation with ICMS withheld |
70 | Taxed with base reduction and ICMS charged by tax substitution |
90 | Others |
ICMS Simples Nacional Status Code (CSOSN)
ICMS status code (CSOSN) for the line item, used by issuers under the Simples Nacional regime (br-nfe-regime 1, 2 or 4). Normal-regime issuers must
use the CST code (br-nfe-icms-cst) instead.
br-nfe-icms-csosn
br-nfe-icms-csosn
| Code | Name |
|---|---|
101 | Taxed under Simples Nacional with credit permission |
102 | Taxed under Simples Nacional without credit permission |
103 | ICMS exemption under Simples Nacional for gross revenue range |
201 | Taxed under Simples Nacional with credit permission and ICMS by tax substitution |
202 | Taxed under Simples Nacional without credit permission and ICMS by tax substitution |
203 | ICMS exemption under Simples Nacional for revenue range and ICMS by tax substitution |
300 | Immune |
400 | Non-taxed under Simples Nacional |
500 | ICMS charged previously by tax substitution or anticipation |
900 | Others |
ICMS Goods Origin
Origin of the goods for ICMS purposes. Defaults to0 (national) during
normalization when not provided.
br-nfe-icms-origin
br-nfe-icms-origin
| Code | Name |
|---|---|
0 | National (except codes 3, 4, 5 and 8) |
1 | Foreign, direct import (except code 6) |
2 | Foreign, acquired in the domestic market (except code 7) |
3 | National, import content above 40% and up to 70% |
4 | National, produced under the basic productive processes |
5 | National, import content up to 40% |
6 | Foreign, direct import, no domestic equivalent (CAMEX list / natural gas) |
7 | Foreign, acquired domestically, no domestic equivalent (CAMEX list / natural gas) |
8 | National, import content above 70% |
PIS Tax Status Code (CST)
PIS tax status code for the line item. Simples Nacional issuers typically use49 or 99, as PIS is settled within the unified DAS collection. Defaults to
01 (standard-rate taxable operation) during normalization when not provided.
br-nfe-pis-cst
br-nfe-pis-cst
| Code | Name |
|---|---|
01 | Taxable operation, standard rate |
02 | Taxable operation, differentiated rate |
03 | Taxable operation, rate per unit of measure |
04 | Taxable monophasic operation, zero-rate resale |
05 | Taxable operation by tax substitution |
06 | Taxable operation, zero rate |
07 | Operation exempt from the contribution |
08 | Operation without incidence of the contribution |
09 | Operation with suspension of the contribution |
49 | Other outbound operations |
50 | Credit operation, exclusively taxed domestic revenue |
51 | Credit operation, exclusively non-taxed domestic revenue |
52 | Credit operation, exclusively export revenue |
53 | Credit operation, taxed and non-taxed domestic revenue |
54 | Credit operation, taxed domestic and export revenue |
55 | Credit operation, non-taxed domestic and export revenue |
56 | Credit operation, taxed/non-taxed domestic and export revenue |
60 | Presumed credit, exclusively taxed domestic revenue |
61 | Presumed credit, exclusively non-taxed domestic revenue |
62 | Presumed credit, exclusively export revenue |
63 | Presumed credit, taxed and non-taxed domestic revenue |
64 | Presumed credit, taxed domestic and export revenue |
65 | Presumed credit, non-taxed domestic and export revenue |
66 | Presumed credit, taxed/non-taxed domestic and export revenue |
67 | Presumed credit, other operations |
70 | Acquisition operation without credit right |
71 | Acquisition operation with exemption |
72 | Acquisition operation with suspension |
73 | Acquisition operation at zero rate |
74 | Acquisition operation without incidence of the contribution |
75 | Acquisition operation by tax substitution |
98 | Other inbound operations |
99 | Other operations |
COFINS Tax Status Code (CST)
COFINS tax status code for the line item. Simples Nacional issuers typically use49 or 99, as COFINS is settled within the unified DAS collection.
Defaults to 01 (standard-rate taxable operation) during normalization when
not provided.
br-nfe-cofins-cst
br-nfe-cofins-cst
| Code | Name |
|---|---|
01 | Taxable operation, standard rate |
02 | Taxable operation, differentiated rate |
03 | Taxable operation, rate per unit of measure |
04 | Taxable monophasic operation, zero-rate resale |
05 | Taxable operation by tax substitution |
06 | Taxable operation, zero rate |
07 | Operation exempt from the contribution |
08 | Operation without incidence of the contribution |
09 | Operation with suspension of the contribution |
49 | Other outbound operations |
50 | Credit operation, exclusively taxed domestic revenue |
51 | Credit operation, exclusively non-taxed domestic revenue |
52 | Credit operation, exclusively export revenue |
53 | Credit operation, taxed and non-taxed domestic revenue |
54 | Credit operation, taxed domestic and export revenue |
55 | Credit operation, non-taxed domestic and export revenue |
56 | Credit operation, taxed/non-taxed domestic and export revenue |
60 | Presumed credit, exclusively taxed domestic revenue |
61 | Presumed credit, exclusively non-taxed domestic revenue |
62 | Presumed credit, exclusively export revenue |
63 | Presumed credit, taxed and non-taxed domestic revenue |
64 | Presumed credit, taxed domestic and export revenue |
65 | Presumed credit, non-taxed domestic and export revenue |
66 | Presumed credit, taxed/non-taxed domestic and export revenue |
67 | Presumed credit, other operations |
70 | Acquisition operation without credit right |
71 | Acquisition operation with exemption |
72 | Acquisition operation with suspension |
73 | Acquisition operation at zero rate |
74 | Acquisition operation without incidence of the contribution |
75 | Acquisition operation by tax substitution |
98 | Other inbound operations |
99 | Other operations |
Purpose Code
Code that identifies the purpose of the fiscal document (SEFAZ fieldfinNFe,
B25). Standard invoices are set to 1 (normal) via a tax scenario.
br-nfe-purpose
br-nfe-purpose
| Code | Name |
|---|---|
1 | Normal |
2 | Complementary |
3 | Adjustment |
4 | Goods Return |
5 | Credit Note |
6 | Debit Note |
Operation Type Code
Code that identifies the type of operation, indicating whether it is inbound or outbound (SEFAZ fieldtpNF, B11). Standard invoices are set to 1
(outbound) via a tax scenario.
br-nfe-operation-type
br-nfe-operation-type
| Code | Name |
|---|---|
0 | Inbound |
1 | Outbound |
Credit Note Type Code
Code that identifies the type of credit note (SEFAZ fieldtpNFCredito,
B25.2) according to the RTM (applies to IBS/CBS only).
br-nfe-credit-note-type
br-nfe-credit-note-type
| Code | Name |
|---|---|
01 | Penalty and interest |
02 | Appropriation of presumed IBS credit in the ZFM |
03 | Return |
04 | Reduction of values |
05 | Credit transfer on succession |
Debit Note Type Code
Code that identifies the type of debit note (SEFAZ fieldtpNFDebito, B25.1)
according to the RTM (applies to IBS/CBS only).
br-nfe-debit-note-type
br-nfe-debit-note-type
| Code | Name |
|---|---|
01 | Transfer of credits from Cooperatives |
02 | Credit annulment |
03 | Debits not processed in the regular assessment |
04 | Penalty and interest |
05 | Credit transfer on succession |
06 | Advance payment |
07 | Inventory loss |
08 | Exit from Simples Nacional |
Validation Rules
bill.Invoice
bill.Invoice
| Field | Test | Validation Code / Message |
|---|---|---|
| Invoice |
| GOBL-BR-NFE-BILL-INVOICE-34Invoice currency must be BRL or provide exchange rate for conversion |
| Invoice |
| GOBL-BR-NFE-BILL-INVOICE-30Invoice requires a note with key ‘reason’ to describe the nature of the operation (natOp) |
supplier.tax_id |
| GOBL-BR-NFE-BILL-INVOICE-01Invoice supplier tax ID is required |
supplier.tax_id.code |
| GOBL-BR-NFE-BILL-INVOICE-02Invoice supplier tax ID code is required |
supplier.addresses[*] |
| GOBL-BR-NFE-BILL-INVOICE-03Invoice supplier address must not be empty |
supplier.addresses[*].street |
| GOBL-BR-NFE-BILL-INVOICE-04Invoice supplier address requires a street |
supplier.addresses[*].num |
| GOBL-BR-NFE-BILL-INVOICE-05Invoice supplier address requires a number |
supplier.addresses[*].locality |
| GOBL-BR-NFE-BILL-INVOICE-06Invoice supplier address requires a locality |
supplier.addresses[*].state |
| GOBL-BR-NFE-BILL-INVOICE-07Invoice supplier address requires a state |
supplier.addresses[*].code |
| GOBL-BR-NFE-BILL-INVOICE-08Invoice supplier address requires a postal code |
supplier.addresses[*].country |
| GOBL-BR-NFE-BILL-INVOICE-37Invoice supplier address requires a country |
supplier.ext |
| GOBL-BR-NFE-BILL-INVOICE-09Invoice supplier requires ‘br-ibge-municipality’ extension when addresses are present |
supplier.ext |
| GOBL-BR-NFE-BILL-INVOICE-39Invoice supplier requires ‘br-nfe-regime’ extension |
supplier.name |
| GOBL-BR-NFE-BILL-INVOICE-10Invoice supplier name is required |
supplier.addresses |
| GOBL-BR-NFE-BILL-INVOICE-11Invoice supplier must have at least one address |
customer |
| GOBL-BR-NFE-BILL-INVOICE-12Invoice customer is required for NF-e invoices |
customer.addresses |
| GOBL-BR-NFE-BILL-INVOICE-13Invoice customer must have at least one address for NF-e invoices |
customer |
| GOBL-BR-NFE-BILL-INVOICE-36Invoice customer must have a tax ID or a foreign country identity |
customer.tax_id.code |
| GOBL-BR-NFE-BILL-INVOICE-15Invoice customer tax ID code is required |
customer.addresses[*] |
| GOBL-BR-NFE-BILL-INVOICE-16Invoice customer address must not be empty |
customer.addresses[*].street |
| GOBL-BR-NFE-BILL-INVOICE-17Invoice customer address requires a street |
customer.addresses[*].num |
| GOBL-BR-NFE-BILL-INVOICE-18Invoice customer address requires a number |
customer.addresses[*].locality |
| GOBL-BR-NFE-BILL-INVOICE-19Invoice customer address requires a locality |
customer.addresses[*].code |
| GOBL-BR-NFE-BILL-INVOICE-21Invoice customer address requires a postal code |
customer.addresses[*].country |
| GOBL-BR-NFE-BILL-INVOICE-38Invoice customer address requires a country |
customer.addresses[*].state |
| GOBL-BR-NFE-BILL-INVOICE-20Invoice customer address requires a state |
customer.ext |
| GOBL-BR-NFE-BILL-INVOICE-22Invoice customer requires ‘br-ibge-municipality’ extension when addresses are present |
series |
| GOBL-BR-NFE-BILL-INVOICE-23Invoice series is required |
series |
| GOBL-BR-NFE-BILL-INVOICE-24Invoice series format is invalid; must be 0 or 1-999 |
tax |
| GOBL-BR-NFE-BILL-INVOICE-25Invoice tax is required |
tax.ext |
| GOBL-BR-NFE-BILL-INVOICE-26Invoice tax requires ‘br-nfe-model’, ‘br-nfe-presence’, ‘br-nfe-purpose’ and ‘br-nfe-operation-type’ extensions |
tax.ext |
| GOBL-BR-NFE-BILL-INVOICE-27NF-e invoices do not support ‘4’ for ‘br-nfe-presence’ |
tax.ext |
| GOBL-BR-NFE-BILL-INVOICE-28NFC-e invoices require in-person or delivery for ‘br-nfe-presence’ |
tax.ext |
| GOBL-BR-NFE-BILL-INVOICE-40Credit note invoices require ‘br-nfe-credit-note-type’ extension |
tax.ext |
| GOBL-BR-NFE-BILL-INVOICE-41Debit note invoices require ‘br-nfe-debit-note-type’ extension |
notes[*].text |
| GOBL-BR-NFE-BILL-INVOICE-29Invoice reason note text must be between 1 and 60 characters |
payment |
| GOBL-BR-NFE-BILL-INVOICE-31Invoice payment is required when invoice is unpaid |
payment.instructions |
| GOBL-BR-NFE-BILL-INVOICE-32Invoice payment instructions are required when invoice is unpaid |
totals.dueCalculated |
| GOBL-BR-NFE-BILL-INVOICE-33Invoice due amount must not be negative |
lines[*].ext |
| GOBL-BR-NFE-BILL-INVOICE-35NF-e invoice lines require ‘br-nfe-cfop’ extension |
bill.Line
bill.Line
| Field | Test | Validation Code / Message |
|---|---|---|
| Line |
| GOBL-BR-NFE-BILL-LINE-01Line taxes must include the ICMS category |
| Line |
| GOBL-BR-NFE-BILL-LINE-02Line taxes must include the PIS category |
| Line |
| GOBL-BR-NFE-BILL-LINE-03Line taxes must include the COFINS category |
tax.Combo
tax.Combo
| Field | Test | Validation Code / Message |
|---|---|---|
ext |
| GOBL-BR-NFE-TAX-COMBO-01ICMS tax combo requires ‘br-nfe-icms-cst’ or ‘br-nfe-icms-csosn’ extension |
ext |
| GOBL-BR-NFE-TAX-COMBO-02ICMS tax combo requires ‘br-nfe-icms-origin’ extension |
ext |
| GOBL-BR-NFE-TAX-COMBO-03PIS tax combo requires ‘br-nfe-pis-cst’ extension |
ext |
| GOBL-BR-NFE-TAX-COMBO-04COFINS tax combo requires ‘br-nfe-cofins-cst’ extension |
pay.Instructions
pay.Instructions
| Field | Test | Validation Code / Message |
|---|---|---|
ext |
| GOBL-BR-NFE-PAY-INSTRUCTIONS-01Payment instructions require ‘br-nfe-payment-means’ extension |
pay.Record
pay.Record
| Field | Test | Validation Code / Message |
|---|---|---|
ext |
| GOBL-BR-NFE-PAY-RECORD-01Payment advance requires ‘br-nfe-payment-means’ extension |