NFC-e
Issue NFC-e consumer receipts (model 65) on behalf of merchants: integration flow, choosing between NFC-e and NF-e, company setup, state differences and receipt printing.
Overview and integration flow
NFC-e (model 65, Nota Fiscal de Consumidor Eletrônica) is Brazil's electronic consumer invoice, used for in-state retail sales to the final consumer: in-store sales, food delivery and same-city delivery, and sales outside the shop. It shares the NF-e layout, but the authorization endpoints, QR code, cancellation deadline and validation rules differ. Company registration, certificate upload and webhook registration are shared with NF-e.
| Step | Endpoint | Notes |
|---|---|---|
| 1 Register company | POST /openapi/v2/empresas | Same as NF-e, plus the optional emissaoNFeConsumidor block that enables NFC-e; resend with id to update |
| 2 Upload certificate | POST /openapi/v1/empresas/{empresaId}/certificadoDigital | Same as NF-e, same A1 certificate |
| 3 Register webhook | POST /openapi/v1/webhooks | Register the webhook again with the nfce.* events in eventos; NFC-e is not in the default subscription, and results go to the same callback URL |
| 4 Issue | POST /openapi/v2/empresas/{empresaId}/nfce | Asynchronous by default; a till can use sync mode to get the result on the spot |
| 5 Query | GET /openapi/v2/empresas/{empresaId}/nfce/{nfceId} | Status, QR code, receipt and XML download links |
| 6 Cancel | POST .../nfce/{nfceId}/cancelar | Within 30 minutes after authorization |
| 7 Cancel by substitution | POST .../nfce/{nfceId}/cancelar-substituicao | Cancels the normal invoice duplicated by an offline contingency invoice, within 168 hours |
Authentication is identical to NF-e; see Authentication.
Prerequisites
- The company is approved with a usable certificate; otherwise
10022002. - The company enabled NFC-e for the current environment through the
emissaoNFeConsumidorblock; otherwise10022001. - The company has a state registration (IE) and NFC-e is enabled in its state. Most states enable it automatically for companies with an IE; SP enables it per establishment, PR requires a request to the state tax office before production, and TO, RN and GO require NF-e issuance to be enabled first.
ambienteEmissaoin the request must match the company current environment; otherwise10022003.
NFC-e or NF-e
| Scenario | Issue |
|---|---|
| In-store sale to an individual | NFC-e |
| Food delivery, same-city or in-state delivery to an individual | NFC-e (consumer identified with address), or NF-e |
| Online order shipped to another state | NF-e only |
| Buyer is an ICMS taxpayer | NF-e only |
| Invoice above R$ 200,000 | NF-e only |
| Return, complementary, adjustment or referenced invoice | NF-e only |
The platform does not switch a non-compliant request to NF-e on its own; it returns 10022004 with the reason.
Company registration: the emissaoNFeConsumidor block
The Register company body gains an optional block; all other fields are unchanged:
"emissaoNFeConsumidor": {"ambienteProducao": {"sequencialNFe": 1,"serieNFe": "1","csc": { "id": "000001", "codigo": "A1B2C3D4E5F6A7B8C9D0E1F2A3B4C5D6" }}}
| Field | Type | Required | Description |
|---|---|---|---|
ambienteProducao | object | Yes | Series and CSC. The series applies to both homologation and production; the CSC to production only |
sequencialNFe | integer | Yes | Next invoice number. The platform numbers sequentially from it; the counter only goes up, and a lower value on update keeps the current number |
serieNFe | string | Yes | NFC-e series. 1 to 3 digits, distinct from the NF-e series, and 890 to 899 are reserved by the tax authority; one series per till or sales channel is recommended |
csc | object | No | Security code (CSC). Only QR code v2 needs it, and it only takes effect in production; the platform uses v3 by default and switches a company to v2 itself, which the open API cannot do; if you get 10022009, contact the platform |
csc.id | string | Yes | CSC id. 1 to 6 digits, obtained together with the code on the state tax portal |
csc.codigo | string | Yes | CSC value. 16 to 36 letters and digits; stored encrypted and never echoed |
- Sending the block enables NFC-e and the registration response carries
nfceHabilitado=true. Homologation needs no separate setup: the same series serves both environments. - Update: resend with the company
idto overwrite the block. When you only rotate the CSC, sendsequencialNFeandserieNFeas they are; the counter is never lowered. - The CSC is issued by the state tax portal. After revoking an old code on the portal, update it here, or SEFAZ rejects issuance (462 / 463).
Endpoints
| Endpoint | Use |
|---|---|
| Issue NFC-e | Async acceptance returns HTTP 200 with no body; sync mode returns the result or 202; idempotent by id |
| Query NFC-e | Status, QR code, receipt and XML links, request echo |
| Cancel NFC-e | Within 30 minutes after authorization, asynchronous |
| Cancel by substitution | Cancels the normal invoice duplicated by an offline one, within 168 hours, asynchronous |
Statuses and webhooks
| Status | Meaning | Webhook event |
|---|---|---|
AguardandoAutorizacao | Accepted, waiting for SEFAZ | None |
Autorizada | Authorized | nfce.authorized |
Negada | Rejected by SEFAZ, or failed during platform processing | nfce.rejected |
Cancelada | Cancelled | nfce.canceled |
ContingenciaPendente | Issued offline while SEFAZ was down, waiting to be transmitted | nfce.contingency_issued |
When SEFAZ rejects a cancellation the invoice stays Autorizada and nfce.cancel_rejected is sent. Once an offline invoice is authorized, nfce.authorized is sent again; if its transmission is rejected, nfce.rejected is sent. The payload is the NF-e one with tipo set to NFC-e plus the QR code content in nfeQrCode; see Webhooks. These events must be subscribed explicitly in eventos when registering the webhook.
Offline contingency
When SEFAZ is down and the state allows it, the platform issues the NFC-e offline (digit 35 of the access key is 9) with status ContingenciaPendente; the receipt can be printed and handed over right away. The platform transmits it once SEFAZ is back; if the same sale also has an authorized normal invoice, the platform cancels the normal one by substitution on its own. For special cases call Cancel by substitution.
State differences
Known differences, which may change with state law. The identification threshold, the SC ban on delivery and the GO and SC ban on CNPJ-identified buyers are checked by the platform at acceptance against the issuer state and return 10022004; everything else is checked by SEFAZ at authorization and ends as Negada, so follow it before submitting:
| State | Identification threshold | Delivery sales | Other |
|---|---|---|---|
| SP | R$ 10,000 | Allowed, within SP | |
| MG | R$ 10,000 | Retail establishments only | One CSC for homologation and production |
| RJ | R$ 2,000 | Allowed, carrier required | Paid late cancellation at the state tax office |
| PR | R$ 10,000; delivery always identified | Allowed, in-state | |
| RS | R$ 10,000; wholesale-and-retail must identify | Allowed | |
| SC | R$ 10,000; buyers cannot be identified by CNPJ | Not allowed | |
| ES | R$ 10,000 | Only restaurants, pharmacies and florists | CSC id fixed at 000001 |
| GO | R$ 10,000, CPF only | Allowed | Buyers identified by CNPJ need an NF-e |
| MT | R$ 1,000 | Same city only | Paid late cancellation at the state tax office |
| TO | R$ 3,000, name and address required | In-state only | |
| PE | R$ 5,000 | Allowed | |
| BA, AL, PB | R$ 500 | Allowed | AL delivery requires a printed receipt |
| Other states | R$ 10,000 | Allowed, in-state |
Receipt printing
- The receipt link in the query and in webhooks is an 80 mm thermal PDF that can go straight to the printer.
- If you lay out the receipt yourself, include every official item, encode
qrCodeas a QR code, and printurlConsultaand the access key. - With the consumer agreement you may skip printing and send the access key or an electronic receipt instead; RJ, ES and AL delivery require printing.
- Homologation receipts carry "EMITIDA EM AMBIENTE DE HOMOLOGAÇÃO – SEM VALOR FISCAL", and in homologation the platform replaces the first item description with the official text; no action is needed on your side.
Test checklist
- Register the company with
emissaoNFeConsumidor; the response hasnfceHabilitado=true. - Upload the certificate and register the webhook again with the
nfce.*events ineventos. - Issue the example from the issue page in sync mode; you get
AutorizadawithqrCodeandlinkDanfe, and download the receipt PDF. - Send the same
idagain; the same invoice comes back with the same number. - Issue the delivery example asynchronously; a webhook with
tipo=NFC-eandnfeStatus=Autorizadaarrives. - Cancel the step 3 invoice within 30 minutes; the query shows
Canceladaand the cancellation webhook arrives. - Negative cases:
presencaConsumidor=OperacaoPelaInternet, delivery withoutclienteand CFOP 6102 all return10022004; cancelling more than 30 minutes after authorization returns10022007.
