Payments

Brazil e-invoicing: NFC-e vs NF-e explained

How Brazil's electronic invoices work: NFC-e (model 65) vs NF-e (model 55), SEFAZ authorization, what a company needs to issue them and the usual pitfalls.

By Intopays team

7 min read

An NFC-e receipt comes out of the checkout printer with its lookup QR code, after SEFAZ authorized itNFC-e · model 65SEFAZ

In the US or Canada, a receipt is just a receipt. The register calculates sales tax, prints a slip, and the government sees nothing until the business files its returns. Brazil works differently. Almost every sale of goods needs a nota fiscal: an electronic tax document that the state tax authority must authorize before it is valid, sale by sale, in real time.

If you are a foreign company opening in Brazil, an ERP or POS vendor localizing for it, or a developer integrating with a Brazilian client, this is the part that surprises people most. Here is how it works, the difference between the two documents retail runs on, and what it takes to issue them.

What a nota fiscal is

A nota fiscal eletrônica is an XML file describing a transaction — issuer, buyer, items, tax codes, totals, payments — signed with the issuer's digital certificate and sent to the SEFAZ, the tax authority of the state where the business is registered. Brazil has 27 states and each runs (or delegates) its own authorization service. When the SEFAZ authorizes the document, it returns a protocol number and the note becomes legally valid; if it finds a problem, it rejects it with a code and a reason.

Each note has a 44-digit access key that anyone can use to look it up. That is the core difference from North America: the tax authority has every sale, as it happens.

NFC-e vs NF-e

Goods sales in retail and wholesale run on two models of the same system:

Side by side: the NFC-e, model 65, an 80 mm receipt for a consumer at the counter; and the NF-e, model 55, an A4 DANFE with an identified recipientNFC-emodel 65 · 80 mm receiptNF-emodel 55 · A4 DANFEEnd consumer at the counterReceipt with a lookup QRNeeds the SEFAZ CSCIdentified recipientOperation set by the CFOPSame A1, no CSC
The NFC-e (model 65) is the consumer's receipt at the counter; the NF-e (model 55) is an A4 document with an identified recipient and an operation set by the CFOP code.
NFC-e (model 65)NF-e (model 55)
NameNota Fiscal de Consumidor EletrônicaNota Fiscal Eletrônica
Used forretail sales to the end consumersales to companies, transfers between stores, shipments, interstate sales
Printed asan 80 mm receipt with a lookup QR codea DANFE on A4 paper with a barcode
Buyeroptional (the consumer's CPF or CNPJ tax ID, if they ask); required above R$ 10,000required, with full address and tax IDs
Extra secretthe CSC, a code issued by the statenone
US analogythe register receipt — but authorized by the statethe invoice — but authorized by the state

Services are a separate world: they use the NFS-e, a city-level document. Intopays issues the national NFS-e — one national system (the Sefin Nacional) for the cities that joined it — through the same route, with type NFSE; see issue an NFS-e.

How authorization works

How an NFC-e travels: the sale becomes an XML signed with the A1 certificate, SEFAZ authorizes it and returns a protocol number, the receipt prints with a QR code and the consumer looks it upSale #1042SaleXMLSignA1 certificateSEFAZ authorizesprotocol numberReceiptwith lookup QRConsumerlooks it upAuthorized at the time of sale
The sale becomes an XML signed with the A1 certificate; SEFAZ authorizes it and returns a protocol number; the receipt prints with a QR code; the consumer can look the note up.
  1. Your software builds the note: items with their product code, description, NCM (the Mercosur tariff code), CFOP (the operation code), quantity and price, plus how the customer paid.
  2. The XML is signed with the company's A1 certificate, a file-based digital certificate tied to its CNPJ.
  3. The state's SEFAZ checks it and authorizes or rejects it.
  4. For an NFC-e, the receipt prints with a QR code built with the store's CSC; the customer can scan it to see the note on the state's portal.

The whole round trip usually takes a few seconds, while the customer is still at the counter.

What a company needs

Checklist before the first NFC-e: a CNPJ with a state registration, an A1 certificate, the SEFAZ CSC, a fiscal credential in Intopays and a test in homologationBefore your first NFC-eCNPJ with a state registration (IE)plus the city's IBGE codeA1 digital certificatea .pfx or .p12 file and its passwordSEFAZ CSCID and token, generated on the state's portalA fiscal credential in Intopaysits API Key picks the issuing CNPJA test in homologationenvironment 2: no fiscal value
Before the first NFC-e: a CNPJ with a state registration, an A1 certificate, the SEFAZ CSC, a fiscal credential in Intopays and a test in homologation.
  • A Brazilian company (CNPJ) with an active state registration (inscrição estadual, IE) in the store's state, and the city's IBGE code. Some states also require the company to be enabled for NFC-e first.
  • An A1 digital certificate (.pfx or .p12 plus its password), issued for the CNPJ by an accredited authority.
  • The CSC — an ID and a token generated on the state SEFAZ portal — for NFC-e.
  • Tax data for every product (NCM and CFOP), and in practice a local accountant (contador), who defines how each item is taxed. Software issues notes; it does not decide taxes.

There is no way around the first point: a foreign company without a Brazilian entity cannot issue notas fiscais.

Test first: homologation

Every SEFAZ has two environments: production (environment: 1), where notes are legally valid, and homologation (environment: 2), a test environment with no fiscal value. The first note of a new company — or of a new state — should always go through homologation to confirm the certificate, the state registration, the CSC and the numbering.

With a fiscal credential set up in Intopays, issuing a test NFC-e is one request:

curl -X POST https://api.intopays.com/v1/fiscal-invoices \
  -H "Authorization: Bearer $INTOPAYS_TOKEN" \
  -H "X-Credential-Key: $INTOPAYS_FISCAL_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "NFCE",
    "environment": 2,
    "referenceCode": "sale-1042",
    "items": [
      {
        "code": "BURGER",
        "description": "Burger",
        "ncm": "21069090",
        "cfop": "5102",
        "unit": "UN",
        "quantity": 2,
        "unitPrice": 25.00,
        "totalPrice": 50.00
      }
    ],
    "payments": [
      { "method": "CASH", "amount": 60.00, "change": 10.00 }
    ]
  }'

Amounts are in reais; CASH is the payment method (Intopays converts it to the SEFAZ code). The response carries the status (AUTHORIZED or REJECTED), the access key, the number, the series and the SEFAZ's reason — a rejected note also answers 201, so always check status. NFC-e and NF-e go through the same route; the type field (NFCE NFC-e, NFE NF-e, NFSE NFS-e) picks the document. The 80 mm receipt PDF comes from GET /v1/fiscal-invoices/<id>/pdf. Fields and errors are in issue an NFC-e; the credential is described in fiscal credentials, and B2B notes in issue an NF-e.

Pitfalls worth designing for

Numbering. Notes are numbered in a series, and numbers cannot repeat or be skipped without a formal procedure. In Intopays, each fiscal credential keeps the next number per invoice type and environment; it advances when the SEFAZ processes a note (authorized or rejected), and simultaneous requests for the same credential queue one at a time. If the company issued notes in another system before, set the series and next number before the first note.

The SEFAZ does not answer. This is where duplicate notes come from: the request went out, the connection dropped, and nobody knows whether the note was authorized. Intopays records the attempt before sending and, without a definitive answer, asks the SEFAZ about it by access key instead of guessing. If the SEFAZ is still silent, the API returns 503, the attempt stays pending and no new number is used for that credential until the SEFAZ answers. Retrying with the same referenceCode returns the authorized note if there is one, instead of issuing a second.

Retail tax is not added on top. Brazilian shelf prices include taxes; there is no sales tax line added at the register the way there is in the US or with HST/GST in Canada. The note itemizes the taxes inside the price, according to the codes your accountant sets.

In the Intopays POS

In the Intopays POS, each terminal of an organization operating in Brazilian reais can be linked to a fiscal credential. The NFC-e is then issued when the sale is completed and the receipt prints on the terminal's printer. The register never holds the certificate or the fiscal key — it asks the Intopays API, which issues with the organization's credential — and a sale gets at most one authorized note, even if the request is repeated. Without internet, the sale continues with a plain receipt and no note. Organizations in USD or CAD do not see the fiscal features at all.

Frequently asked questions

What is a nota fiscal in English?

"Electronic invoice" is the usual translation, but it is more than an invoice: it is a tax document that the state authorizes before it is valid. The NFC-e is the consumer receipt version; the NF-e is the business-to-business version.

Does every sale in Brazil need a nota fiscal?

Sales of goods by a registered business generally do, and the store has to issue it at the time of sale. Services use a different, city-level document (the NFS-e, which Intopays issues through the national system). The exact obligations depend on the company's tax regime, so confirm with a Brazilian accountant.

Can a foreign company issue NFC-e or NF-e?

Only through a Brazilian entity. Issuing requires a CNPJ, a state registration and an A1 certificate issued for that CNPJ.

What is the CSC?

The Código de Segurança do Contribuinte, an ID and token the state SEFAZ generates for the company. It is used to build the NFC-e's QR code, so a receipt cannot be forged without it. The NF-e does not use it.

Which states are supported?

Intopays issues NFC-e and NF-e in all 27 Brazilian states, each note sent to the authorization service of the credential's state. Test in homologation before the first note in production.

All articles

Keep reading

A checkout page with a Pix QR code and a copy button, a customer paying from her phone and the green mark of a confirmed orderR$89.90expires in 14:32Copy codePix on your website's checkout

Payments

How to accept Pix payments on your website: a developer guide

Build a Pix checkout end to end: create the charge on your backend, show the QR and copy-and-paste code, confirm by webhook, handle expiry. With curl and Node.

7 min readRead the article
An integration created in Banco Inter's online banking becomes a certificate and key bundle, and your system starts generating Pix QR codes.crt + .keyBanco Inter Pix API

Payments

Banco Inter Pix API: how to integrate it

How to create a Banco Inter API integration, download its certificate and key, authenticate, issue a first Pix charge and reuse the same credential for boletos.

6 min readRead the article
Your system sends the boleto request, the bank registers it, and the boleto comes out with a barcode and a Pix QR codePOST /v1/boletosBarcode + Pix QRRegistered

Payments

Boleto bancário explained, and how to issue boletos via API

What a boleto is, how Brazilians pay it, why it survives next to Pix, and what a business needs to issue registered boletos through its own bank's API.

6 min readRead the article