Public documentation for the Emites-Client product API.
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.
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:
US-ASCII
or ISO-8859-1
(or variations). Multibyte encodings such as UTF-8
should not be used;null
value. Avoid sending missing values as empty strings (“”), because Emites-Client performs minimum size validation if the field is not null
;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:
status
with value equal to sucesso
;produto.tributacao
, for each product);numero
);serie
);danfe_url
);xml_url
);danfe
);xml
);resposta_emissao
, which contains the access key and protocol number);The rejected response will contain the same fields that were sent in the request, and additionally the following exclusive fields:
status
with value equal to rejeitada
;erros
with the list of rejection reasons;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"]
}
}
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:
chave_acesso
is the NFC-e’s access key (obtained in the creation response);reason
is the description of the reason for the cancellation (optional; if informed should be between 15 and 255 characters in size)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):
status
field will have the value cancelada
;cancel_xml_url
field with the updated document’s URL will be included;resposta_cancelamento
(which contains the new access key and new protocol number) will be included;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"]
}
}
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:
status
with value equal to sucesso
;produto.tributacao
, for each product);numero
);serie
);danfe_url
);xml_url
);danfe
);xml
);resposta_emissao
, which contains the access key and protocol number);fields:
engine_de_calculo
contingencia
objects:
nfe
dados_gerais
retencao_tributos
cobranca
Note: The dados_gerais
fields in NFE are in the root of NFCE with the same name
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:
chave_acesso
is the NFC-e’s access key (obtained in the creation response);reason
is the description of the reason for the cancellation (optional; if informed should be between 15 and 255 characters in size)The cancellation response’s JSON payload will be similar to the one returned during the cancellation NFC-e operation.
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.