Introduction

The NFS-e (Nota Fiscal de Serviços Eletrônica) is the electronic service invoice used in Brazil to report tax information to municipalities. Each municipality has its own rules, format, and API for issuing service notes.

Invopop’s “Notas Fiscais Eletrônicas” app provides a unified way to issue NFS-e documents across 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 service notes in their name.

Prerequisites

To issue service notes in Brazil, you will need:

  • Supplier details, including:
    • name,
    • CNPJ (Cadastro Nacional da Pessoa Jurídica),
    • address,
    • municipality code (IGBE),
    • municipal registration number,
    • 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.
  • Details of the service provided, including quantity, price, applicable ISS rate, and 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 to send service notes in the name of every supplier.

Setup

There are four key processes to prepare:

  • create supplier post-registration workflow,
  • connect the Notas Fiscais Eletrônicas Brazil app,
  • configure a supplier registration workflow, and,
  • prepare an invoicing workflow.

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

Create Supplier post-registration workflow (optional)

Head over to the Workflows section and create a new “Contacts” workflow.

Rename the workflow to “Post-registration flow”, and add a single step to change the state to registered.

At this point, you can add any webhooks or notification steps that might be useful for your systems to receive after a supplier has successfully registered.

Tap the Save button.

2

Connect the Notas Fiscais Eletrônicas Brazil App

Enter the Configuration section, then tap Apps. Tap on the Connect button of the Notas Fiscais Eletrônicas Brazil app.

Tap the Configure button on the App, and choose the “Post-registration flow” workflow we created in the previous step, or leave it empty.

Tap the Save button.

3

Configure the supplier registration workflow

Back in the Workflows section, create a new “Contacts” workflow called “Register Supplier”.

The new workflow will need to perform three steps:

  • Sign the Envelope
  • Register NFS-e supplier
  • Set State - with configuration set to processing.

Add any additional steps you may need, and save the new workflow.

4

Prepare Invoice Workflow

Finally, we need to prepare the actual workflow that will be used to process invoices. For this example, the workflow should be named something like “Issue NFS-e”, and it will consist of the following Steps:

  • Set State - to “processing”.
  • Add Sequential Code - with dynamic sequences and a name like “NFS-e”.
  • Send NFS-e (Brazil).
  • Set State - to “sent”.

Tap the Save button to ensure the workflow has been persisted.

Running

In this section, we’ll provide details on how to first persist and register a supplier, followed by issuing service notes 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.

Register a Supplier

Suppliers can be registered either manually via the Invopop Console or programmatically via the API. The process is essentially the same, so we’ll demonstrate the manual method for this guide.

Find the Contacts section of the sidebar and click Suppliers. Tap the + New Supplier button to be presented with a new editor. Copy and paste the following example that uses a fictitious example. This will only work in the sandbox environment; in production, you’ll need the details of an actual company:

{
    "$schema": "https://gobl.org/draft-0/org/party",
    "uuid": "01932ee8-8285-7bcd-a9b2-fb2230db3382",
    "name": "TechNova Soluções Digitais Ltda.",
    "tax_id": {
        "country": "BR",
        "code": "05229829000184"
    },
    "addresses": [
        {
            "num": "101",
            "street": "Avenida Paulista",
            "locality": "Bela Vista",
            "region": "São Paulo",
            "state": "SP",
            "code": "01310-000",
            "country": "BR"
        }
    ],
    "ext": {
        "br-nfse-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:

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, and 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.

The details from this form are sent securely to Invopop’s local partner, PlugNotas, who will use them to authenticate in the corresponding municipality API.

The supplier must ensure that the certificate and password are valid and accepted by the municipality where they are registered.

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 notes on behalf of the supplier.

Send a Services Invoice

The following examples are of partial 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” workflow created during setup.

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 municipality and the actual PDF generated will be attached to the silo entry.

GOBL Invoices sent as NFS-e require the following properties to perform the correct normalization and validation steps. Invopop will try to assign these automatically, but we recommend defining them explicitly before uploading:

FAQ

Please contact the [Invopop support team] (email:support@invopop.com) if you have any questions that are not listed here.