NFe – Brazilian Electronic Invoice System

Ricardo Acras

Introducing NFe - Brazilian Electronic Invoice System. All you need to know what is it and the process of issuing a NFe.

Conteúdo

Lately we have seen lots of foreign developers facing the challenge of developing NFe solutions for brazilian companies.

As we now have some customers in this situation we will release content in english to make it easy for these developers to accomplish this challenge.

 

What is the NFe (Nota Fiscal Eletrônica or Electronic Invoice)

Until 2008 invoices in Brazil were issued in paper. Any company could get the authorization to print a certain number of unfilled invoices so they could fill it and send to their customers.
Since 2008 Brazilian government has adopted an electornic invoice system, making it mandatory to any brazilian company that sells products.
The electronic version of invoices are issued one by one and pre-filled by the company. Meaning that each and every sale (or importing) transaction is informed to the government that authorizes one by one. Obviously this is made in an automated way, called NFe.
The process of issuing a NFe

First of all one should fill a XML file containing, information about the issuer, the receiver, the products, the taxes (wich are very, very complicated in Brazil), the way it will be transported, how it will be paid and so on.

The second step will be to digitally sign this XML document using a digital certificate compliant with ICP-Brasil standards.

Third step is to communicate with the government servers, using SOAP technology. Government receives the transaction and “tells” you the estimated time it will have an answer (rarely being more than 5 seconds).

After that time we query the server to see if it have an answer. If the invoice is authorized then we are able to generate the DANFe (short for Auxiliar Document of the NFe). By law we have to inform the receiver via email that the NFe is successfully issued.

By law the issuer must keep the XML file for at least 5 years.

 

Focus NFe service

As it turns out, the XML file is very complicated, it has many fields and rules according to the type of the company and the kind of taxes it pays. Furthermore the communication with government computers may be tricky as each state has it’s own servers and there are redundancy servers with little communication specificities.

The Focus NFe service has a simple text file for communication and a very simple return file as well. All the details and communication with each server in the country is handled by our service. The generation of DANFe is handled by Focus NFe. The service also sends the NFe to the receiver and keeps the XML file safe for as long as the service contract is active.

Brazilian fiscal law is complicated and is constantly changing. We keep our service compliant to the law at all times, and every time it is possible, we do not change the communication files layout. (It is important to say that the API do not calculate taxes, so changes in taxes must be handled by the programmer).

O post NFe – Brazilian Electronic Invoice System apareceu primeiro em Acras.

Picture of Ricardo Acras

Ricardo Acras

20+ anos de experiência como desenvolvedor. Fundador e atual CEO do Focus NFe.

Inscreva-se em nossa newsletter​

Receba nossos conteúdos exclusivos em primeira mão.

Explore outros conteúdos:

API para SAT: o que é, para que serve e como consultar?
Tecnologia e API
Cesar Nocrato

API para SAT: o que é, para que serve e como consultar?

A API para SAT foi desenvolvida para facilitar a comunicação entre sistemas de gestão e o Sistema Autenticador e Transmissor de Cupons Fiscais eletrônicos (CF-e SAT) em São Paulo. Essa interface permite a emissão, autenticação e envio de cupons fiscais de forma automatizada, garantindo conformidade com a legislação tributária vigente.

Com a descontinuação do SAT a partir de 2026, entender como se adaptar às novas regras é essencial para empresas que ainda utilizam esse modelo. Hoje vamos falar mais sobre esta API, assim como as informações essenciais para fazer uma boa transição.

Acompanhe!

Leia mais »
Entenda o que é NCM e o que significa cada número do código. Aprenda também a consultar e definir o NCM de seus produtos!
Contabilidade
Jaciara Santana

O que é NCM? Confira como consultar e tabela atualizada!

Saber o que é NCM é essencial para as empresas envolvidas em transações comerciais internacionais, tanto para importação quanto exportação. Isso porque a utilização da NCM é obrigatória em notas fiscais eletrônicas, tornando-se indispensável para documentos comerciais.

Este sistema de codificação, adotado em janeiro de 1995 pelos países membros do Mercosul, segue critérios internacionais de classificação de mercadorias. Acompanhe o artigo de hoje e saiba o que é NCM, sua função, como determiná-lo e qual é a sua importância.

Este sistema de codificação, adotado em janeiro de 1995 pelos países membros do Mercosul, segue critérios internacionais de classificação de mercadorias.

Acompanhe o artigo de hoje e saiba o que é NCM, sua função, como determiná-lo e qual é a sua importância.

Leia mais »
SaaS
João Vallim

O que é SaaS, para que serve e quais são as vantagens?

Você sabe o que é SaaS? O termo vem da expressão em inglês Software as a Service e é um serviço de computação em nuvem que dá acesso a softwares e soluções tecnológicas por meio da internet.

Com o SaaS, empresas podem disponibilizar serviços sem a necessidade de instalar programas e/ou fazer manutenção de hardwares e softwares. Isso porque ao se manter online, os recursos são facilmente acessados, uma vez que ficam hospedados no servidor das empresas provedoras.

Quer saber mais sobre o que é SaaS, quais são seus benefícios e exemplos desse serviço? Acompanhe o artigo de hoje.

Leia mais »