Guides
Bill payment

Bill payment webhooks and errors

The POST for each status change, retries and the three error formats of the Bill payment API.

Webhook

Each payment status change triggers a JSON POST to the URL from Set the webhook. At Efí the URL must accept Efí's certificate (mTLS); in Mimicr the POST goes straight, without a certificate.

json
{
  "identificador": "30000003",
  "status": { "anterior": "EXECUTADO", "atual": "LIQUIDADO" },
  "valor": "159.90",
  "horario": { "solicitacao": "2026-10-22T01:35:38.325Z", "liquidacao": "2026-10-22T03:00:07.112Z" },
  "efiExtras": {
    "dataExecucao": "2026-10-22",
    "codigoBarras": "36496161100000159900000001000002732348665880",
    "linhaDigitavel": "36490000010100000273123486658802616110000015990",
    "protocolo": "936879015",
    "motivoRecusa": null
  }
}
FieldNote
identificadorThe idPagamento
status.anterior, status.atualThe transition; the first notice starts from CRIADO
valorText in reais with two decimals, unlike the API's cents
horario.liquidacaoOnly on LIQUIDADO
efiExtras.protocoloFrom EXECUTADO on
efiExtras.motivoRecusaOn NAO_REALIZADO, for example Saldo Insuficiente. Data: 22/10/2026.

A same-day payment triggers three notices (CRIADO → EM_PROCESSAMENTO, EM_PROCESSAMENTO → EXECUTADO, EXECUTADO → LIQUIDADO); a scheduled one triggers one more (CRIADO → AGENDADO).

Retries

Efí expects a 2xx. Otherwise it retries up to 10 times, at these minutes after the failure: 5, 10, 20, 40, 80, 160, 320, 640, 1280 and 52560. In Mimicr each attempt waits up to 10 seconds for the response.

Deliveries are in the control API with api=pagarcontas, kind=pc_pagamento, ref equal to the idPagamento and event equal to the new status:

bash
npx mimicr wait efi delivery api=pagarcontas ref=30000003 event=LIQUIDADO

Errors

This API mixes three formats, all with HTTP 400:

json
{ "erro": 0, "descricao": "Código de barras inválido" }
{ "nome": "erro_de_validacao", "mensagem": "A propriedade dataInicio é obrigatória" }
{ "mensagem": "must NOT have fewer than 44 characters" }
BodyWhen
{"mensagem": "must NOT have fewer than 44 characters"}Code shorter than 44 digits
{"mensagem": "must NOT have more than 48 characters"}Code longer than 48 digits, or descricao longer than 48 characters
{"nome": "Error", "mensagem": "must be number"}Code with non-digits
{"erro": 0, "descricao": "Código de barras inválido"}Wrong check digit
{"nome": "erro_de_validacao", "mensagem": "Código de barras não localizado na base centralizada"}Boleto with neither amount nor due date
{"nome": "erro_de_validacao", "mensagem": "O valor informado é diferente do valor do boleto (…)"}valor different from valores.final
{"nome": "erro_de_validacao", "mensagem": "A data de pagamento deve ser a data atual ou uma data futura"}dataPagamento in the past
{"erro": 0, "descricao": "Boleto não pode ser pago"}podeSerPago is false (already paid or past the limit)
{"erro": 0, "descricao": "Este código de barras já possui um pagamento em andamento ou realizado"}Duplicate payment (Mimicr rule)
{"erro": 0, "descricao": "Pagamento não encontrado"}Unknown GET /v1/{idPagamento} (Efí answers 400, not 404)
{"nome": "erro_de_validacao", "mensagem": "A propriedade dataInicio é obrigatória"}Summary without a period
{"nome": "url_invalida", ...}, {"nome": "webhook_nao_encontrado", ...}Webhook not HTTPS, or unknown on delete

Authentication: 401 invalid_client on the token, 401 invalid_token with a missing, expired or other-API token, and 403 insufficient_scope. Unknown route: 404 rota_nao_encontrada. With controlled chaos for the pagarcontas area, 500 erro_aplicacao, 503 and 429 can also show up, and payments can become NAO_REALIZADO with Limite mensal excedido. and other reasons.