emites-client-api-docs

emites-client-api-docs [Português-BR]

Public documentation for the Emites-Client product API.

Introduction

Emites-Client is a Nexaas solution for issuing electronic invoices (NF-e) and consumer electronic invoices (NFC-e) developed in Java language. These documents can be issue in online or offline mode.

Integration with the application is accomplished by sending messages to a TCP/IP socket interface.

Protocol

All messages exchanged by the Emites-Client must follow the following text format:

Size:Identifier:Payload

where:

For example if we consider the following message:

27:TESTE:{ "teste": "teste" }

then we have:

Comments:

Creating a NFC-e

To create a NFC-e, send a message with the identifier CREATE_NFCE. In the response, it’s possible that the identifier be CREATE_NFCE or CREATE_CFE (in cases where the issue was made by SAT or MFE)..

Use as reference the following documents:

The response will contain the same fields that were sent in the request, and additionally the following exclusive fields:

Rejection

The rejected response will contain the same fields that were sent in the request, and additionally the following exclusive fields:

The following excerpt shows an example of rejection due to validation errors:

{
  "status": "rejeitada",
  ...
  ...
  ...
  "erros": {
    "forma_de_pagamento": ["tamanho deve estar entre 1 e 100"],
    "cliente.email": ["não é um endereço de e-mail válido"]
  }
}

The following excerpt shows an example of rejection raised by SEFAZ:

{
  "status": "rejeitada",
  ...
  ...
  ...
  "erros": {
    "rejeicao": ["471 - Rejeição: Informado NCM=00 indevidamente"]
  }
}

NFC-e cancellation

To cancel an NFC-e, send a message with the identifier CANCEL_NFCE. The same identifier will be returned in the response.

The JSON payload should follow the format:

{ "chave_acesso": "53180922769530000131651110000001281355486170", "motivo": "Desistencia do comprador" }

where:

The cancellation response’s JSON payload will be similar to the one returned during the creation operation, with the following differences [(see example)] (/emites-client-api-docs/nfce/examples/nfce_cancel_response.json):

Rejection

As of 10/1/2018 the maximum period to cancel a NFC-e will be 30 minutes, according to the text of the Ajuste SINIEF 07/2018. After this period elapses, an attempt to cancel the document will be answered by SEFAZ with a rejection code (501).

If this scenario occurs, the response returned by the Emites-Client will contain the field errors informing the reason for the rejection:

{
  "status": "cancelamento_rejeitado",
  ...
  ...
  ...
  "erros": {
    "rejeicao": ["501 - Rejeicao: Prazo de Cancelamento Superior ao Previsto na Legislacao"]
  }
}

Creating a NF-e

To create a NF-e, send a message with the identifier CREATE_NFE. The same identifier will be returned in the response.

Use as reference the following documents:

The response will contain the same fields that were sent in the request, and additionally the following exclusive fields:

Only available for NFE

fields:

objects:

Note: The dados_gerais fields in NFE are in the root of NFCE with the same name

NF-e cancellation

To cancel an NF-e, send a message with the identifier CANCEL_NFE. The same identifier will be returned in the response.

The JSON payload should follow the format:

{ "chave_acesso": "53180922769530000131651110000001281355486170", "motivo": "Desistencia do comprador" }

where:

The cancellation response’s JSON payload will be similar to the one returned during the cancellation NFC-e operation.

Tax calculation

To calculate the taxes for an NFC-e (Electronic Consumer Invoice), send a message with the identifier CALCULATE. The same identifier will be returned in response.

Use as reference the documents used to create an NFCE-e by the Emites Client.