Skip to main content

Introduction

Brazil has a variety of electronic tax documents that must be issued in different cases for various tax purposes. These include service invoices (NFS-e), product invoices (NF-e), and consumer invoices (NFC-e). Each document type is subject to variations from state to state and municipality to municipality, with each jurisdiction applying its own rules, formats, and APIs for issuing fiscal documents. Invopop’s Documentos Fiscais Eletrônicos app provides a unified way to issue fiscal documents across all Brazilian states and over 2000 municipalities using GOBL. You can find the full list of supported municipalities here. This guide will walk you through the steps required first to register a supplier and then issue electronic fiscal documents in their name.

Prerequisites

To issue electronic fiscal documents in Brazil, you will need:
  • Supplier details, including:
    • name,
    • CNPJ (Cadastro Nacional da Pessoa Jurídica),
    • address,
    • municipality code (IBGE),
    • municipal registration number (for NFS-e),
    • state registration number (for NF-e and NFC-e),
    • whether the supplier opts into the Simples Nacional tax regime,
    • whether the supplier benefits from a fiscal incentive, and,
    • optionally, any special tax regime (MEI, estimated, coop…) the supplier is subject to.
  • Customer details (except for NFC-e where the customer is optional).
  • Details of the goods or services provided:
    • quantity,
    • price,
    • applicable tax rates (ISS, ICMS, PIS, COFINS, etc.), and,
    • (only for services) service code (Código Item Lista Serviço) as defined by the municipality.
  • To have chosen an invoice series
  • A certificate and password accepted by the municipality (for NFS-e) or the state (for NF-e and NFC-e) to send electronic fiscal documents in the name of the supplier.

Setup

There are four key processes to prepare:
  • connect the Documentos Fiscais Eletrônicos Brazil app,
  • create the supplier registration workflow,
  • configure the supplier post-registration workflow,
  • prepare the invoicing workflows.
These instructions apply to both the sandbox and live environments. Please note that the sandbox environment is simulated, and most responses are mocked. You’ll still need to register suppliers in the sandbox, but the company details, certificates or passwords don’t need to be valid or real.
All of the following steps must be carried out from the Invopop Console.
1

Connect the Documentos Fiscais Eletrônicos Brazil app

Enter the Configuration section, then tap Apps. Tap on the Connect button of the Documentos Fiscais Eletrônicos Brazil app.
DF-e Brazil App
2

Create the supplier registration workflow

Follow one of the methods below and ensure to Save and Publish the workflow:
3

Configure the supplier post-registration workflow

Follow one of the methods below and ensure to Save and Publish the workflow:
This workflow will automatically be executed once a supplier completes the registration process. You can customize it to suit your needs (e.g., adding a webhook, or an email notification after a supplier has been registered.)
Now you need to go back to Configuration > Apps, tap the Configure button on the Documentos Fiscais Eletrônicos Brazil app, choose the “Post-registration workflow” we just created and Save the changes.
4

Prepare NFS-e Workflow

You can skip this step if you’re not interested in issuing NFS-e documents.
Follow one of the methods below and ensure to Save and Publish the workflow:
5

Prepare NFC-e Workflow

You can skip this step if you’re not interested in issuing NFC-e documents.
Follow one of the methods below and ensure to Save and Publish the workflow:

Running

In this section, we’ll provide details on how to first persist and register a supplier, followed by issuing invoices on their behalf. As usual, the recommended approach for running jobs is to perform two steps; first upload the document to the silo, second create a job. All operations described in the following sections can be performed manually via the Invopop Console, or programmatically via the API. The process is essentially the same in both cases, so we’ll demonstrate the manual method for this guide.

Register a Supplier

Find the Parties section of the sidebar and click Suppliers. Tap the + New Supplier button to be presented with a new editor. Copy and paste the example provided below (for testing purposes only, in production you’ll need the details of an actual company). The example includes all the fields required to register a supplier for both NF-e/NFC-e and NFS-e issuance.
Brazil supplier example for sandbox
{
    "$schema": "https://gobl.org/draft-0/org/party",
    "name": "TechNova Soluções Digitais Ltda.",
    "tax_id": {
        "country": "BR",
        "code": "05229829000184"
    },
    "identities": [
        {
            "key": "br-nfse-municipal-reg",
            "code": "45678901234567"
        },
        {
            "key": "br-nfe-state-reg",
            "code": "12345678901234"
        }
    ],
    "addresses": [
        {
            "num": "101",
            "street": "Avenida Paulista",
            "locality": "Bela Vista",
            "region": "São Paulo",
            "state": "SP",
            "code": "01311-000",
            "country": "BR"
        }
    ],
    "emails": [
        {
            "addr": "contact@technova.test"
        }
    ],
    "ext": {
        "br-ibge-municipality": "3550308",
        "br-nfse-simples": "1"
    }
}
Tap Build, ensure there are no errors, and click Save. We should now see the document. Find and click the Select Workflow button. Select the Register Supplier workflow created during setup, and click Run workflow. The execution should be successful, and the silo entry will now be in the Processing state. Tap the Meta tab to see the registration link:
Supplier Registration Link
You can access the registration link via the API by fetching the silo entry and reading the meta row where the key is set to registration-link.
Tap the registration link. A new browser window will open with a form to upload the supplier’s credentials. Note that this form can be shared directly with the supplier, if necessary.
Supplier Registration Form
The details from this form are sent securely to Invopop’s local partner, PlugNotas, who will use them to authenticate the supplier in the corresponding tax authority. The supplier must ensure that the certificate and password are valid and accepted by the municipality or state where they operate. Once the form is submitted, the supplier will be registered, and the post-registration workflow will be executed, changing the supplier’s state to Registered. From this point on, you can send service invoices on behalf of the supplier.

Send Invoices

The following examples are of example GOBL documents you can copy and paste directly into the Invopop Console or store via the API as silo entries. Then, you must run the “Issue NFS-e” or the “Issue NFC-e” workflow created during setup over them.
In the sandbox environment, you’ll notice that executing the workflow will always result in the same PDF and XML being attached to the silo entry. These are mock-up files returned by the sandbox environment for testing purposes.In production, the actual XML file sent to the tax authority and the actual PDF generated will be attached to the silo entry.

B2B Service Invoice (NFS-e)

In this example, we’re issuing a simple service invoice (NFS-e) from a Brazilian supplier to another Brazilian business customer. Please note:
  • We’ve added the br-nfse-v1 addon; this ensures the document will be validated using the NFS-e rules built into the GOBL library.
  • Extensions (ext) and identities have been used in multiple locations for fields whose values cannot be determined any other way.
  • ISS percentage is provided explicitly as it varies depending on the municipality and type of service.
  • There are no totals or calculations; all these will be made automatically when uploading.
  • Make sure to process it with the “Issue NFS-e” workflow created during setup.
B2B Service Invoice (NFS-e)
{
  "$schema": "https://gobl.org/draft-0/bill/invoice",
  "$regime": "BR",
  "$addons": ["br-nfse-v1"],
  "series": "XXBR",
  "supplier": {
    "name": "TechNova Soluções Digitais Ltda.",
    "tax_id": {
        "country": "BR",
        "code": "05229829000184"
    },
    "identities": [
        {
            "key": "br-nfse-municipal-reg",
            "code": "45678901234567"
        }
    ],
    "addresses": [
        {
            "num": "101",
            "street": "Avenida Paulista",
            "locality": "Bela Vista",
            "region": "São Paulo",
            "state": "SP",
            "code": "01311-000",
            "country": "BR"
        }
    ],
    "emails": [
        {
            "addr": "contact@technova.test"
        }
    ],
    "ext": {
        "br-ibge-municipality": "3550308",
        "br-nfse-simples": "1"
    }
  },
  "customer": {
    "name": "Construforte Engenharia Ltda.",
    "tax_id": {
      "country": "BR",
      "code": "46602178000103"
    },
    "addresses": [
      {
        "num": "75",
        "street": "Avenida Sete de Setembro",
        "street_extra": "Bloco C",
        "locality": "Centro",
        "region": "Salvador",
        "state": "BA",
        "code": "40060-000",
        "country": "BR"
      }
    ]
  },
  "lines": [
    {
      "i": 1,
      "quantity": "15",
      "item": {
        "name": "Consultancy Services",
        "price": "100.00",
        "ext": {
          "br-nfse-service": "10.5",
          "br-nfse-cnae": "62.01-5-01"
        }
      },
      "taxes": [
        {
          "cat": "ISS",
          "percent": "15%",
          "ext": {
            "br-nfse-iss-liability": "1"
          }
        }
      ]
    }
  ]
}

B2C Consumer Invoice (NFC-e)

In this example, we’re issuing a simple consumer invoice (NFC-e) from a Brazilian supplier. Please note:
  • We’ve added the br-nfe-v1 addon; this ensures the document will be validated using the NF-e/NFC-e rules built into the GOBL library.
  • The customer is optional and in this example we’ve omitted it.
  • Extensions (ext) and identities have been used in multiple locations for fields whose values cannot be determined any other way.
  • Tax percentages are provided explicitly as they vary depending on the state and type of goods.
  • There are no totals or calculations; all these will be made automatically when uploading.
  • Make sure to process it with the “Issue NFC-e” workflow created during setup.
B2C Consumer Invoice (NFC-e)
{
  "$schema": "https://gobl.org/draft-0/bill/invoice",
  "$regime": "BR",
  "$addons": ["br-nfe-v4"],
  "$tags": ["simplified"],
  "series": "123",
   "tax": {
    "ext": {
      "br-nfe-presence": "1"
    }
  },
  "supplier": {
    "name": "TechNova Soluções Digitais Ltda.",
    "tax_id": {
        "country": "BR",
        "code": "05229829000184"
    },
    "identities": [
        {
            "key": "br-nfe-state-reg",
            "code": "12345678901234"
        }
    ],
    "addresses": [
        {
            "num": "101",
            "street": "Avenida Paulista",
            "locality": "Bela Vista",
            "region": "São Paulo",
            "state": "SP",
            "code": "01311-000",
            "country": "BR"
        }
    ],
    "emails": [
        {
            "addr": "contact@technova.test"
        }
    ],
    "ext": {
        "br-ibge-municipality": "3550308",
        "br-nfse-simples": "1"
    }
  },
  "lines": [
    {
      "i": 1,
      "quantity": "2",
      "item": {
        "name": "Cabo USB-C 2 metros",
        "price": "28.90"
      },
      "taxes": [
        {
          "cat": "ICMS",
          "percent": "18.0%"
        },
        {
          "cat": "PIS",
          "percent": "1.65%"
        },
        {
          "cat": "COFINS",
          "percent": "7.60%"
        }
      ]
    }
  ],
  "payment": {
    "instructions": {
      "key": "card"
    }
  },
  "notes": [
    {
      "key": "reason",
      "text": "Venda de mercadoria"
    }
  ]
}

FAQ

Please contact the [Invopop support team] (email:support@invopop.com) if you have any questions that are not listed here.
At the moment, only NFC-e and NFS-e are supported. We are working on adding support for other types.
For further details on how GOBL prepares data for conversion, see: