Guides
Pagamentos em Lote

Release and queries

Release, cancel and reschedule batches, follow the states of the request and of each payment, and force outcomes in the sandbox.

A batch you send is not debited on its own: someone has to release it. This guide covers release by API, cancellation, rescheduling and the queries to follow what happened.

Request states

estadoRequisicaoMeaning
1All entries consistent
2At least one entry inconsistent
3All entries inconsistent (moves to 7)
4Waiting for the client: release pending
5Being processed by the bank
6Processed (final)
7Rejected (final)
9Released via API
10Preparing a released batch

In slip, GRU (in the request lookup) and DARF batches the field is called codigoEstado; in GPS, codigoEstadoRequisicao.

Payment states

estadoPagamento is an uppercase string: CONSISTENTE and INCONSISTENTE right after the request; PENDENTE after validation; AGENDADO (future date) or AGUARDANDO DEBITO after release; and the final PAGO, REJEITADO, BLOQUEADO, DEVOLVIDO and CANCELADO.

In Mimicr the timings are short: validation happens about 2 s after the request (1 or 2 → 4; 3 → 7) and the debit about 3 s after release. At BB settlement takes 11 to 40 minutes on a business day.

Release

bash
curl --request POST \
  --url 'https://bb.mimicr.dev/pagamentos-lote/v1/liberar-pagamentos?gw-dev-app-key=<app-key>' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{ "numeroRequisicao": 346625, "indicadorFloat": "N" }'
  • indicadorFloat N follows the contract's float terms; S pays on the given date.
  • Releasing before validation is allowed: the request moves to 10 and is released when the batch is ready.
  • The same batch can be released more than once. A finished request (3, 6 or 7) answers 400; an unknown one, 404 with code 2.

With the homologação rule autoRelease on, Mimicr releases each batch as it arrives, as if you had called this route. Turn it on with PUT https://api.mimicr.dev/v1/bb/homolog and {"autoRelease": true}.

Reference: Release payments.

Cancel

An entry can be cancelled until it is debited. Send the ids as strings:

bash
curl --request POST \
  --url 'https://bb.mimicr.dev/pagamentos-lote/v1/cancelar-pagamentos?gw-dev-app-key=<app-key>' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "numeroContratoPagamento": 731030,
    "agenciaDebito": 1607,
    "contaCorrenteDebito": 99738672,
    "digitoVerificadorContaCorrente": "X",
    "listaPagamentos": [ { "codigoPagamento": "90346632218725001" } ]
  }'
json
{ "pagamentos": [ { "codigoPagamento": 90346632218725001, "indicadorCancelamento": "S", "estadoPagamento": "CANCELADO", "estadoCancelamento": "Cancelamento efetuado com sucesso." } ] }

The answer is always 200; a payment that couldn't be cancelled comes back with indicadorCancelamento N and its current state. Reference: Cancel payments.

Reschedule

Change the payment date moves every entry of the request from one date to another:

bash
curl --request PUT \
  --url 'https://bb.mimicr.dev/pagamentos-lote/v1/346633/data-pagamentos?gw-dev-app-key=<app-key>' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "numeroAgenciaDebito": 1607,
    "numeroContaCorrenteDebito": 99738672,
    "digitoVerificadorContaCorrenteDebito": "X",
    "codigoProduto": 128,
    "dataOriginalPagamento": 28102026,
    "dataNovoPagamento": 29102026
  }'
json
{ "quantidadeLancamentoOriginal": 1, "quantidadeLancamentoAlterado": 1 }

Queries

To knowUse
State of the batch and of each paymentGet a request (or the legacy path)
The original answer to the requestEach type's .../solicitacao route, such as Get a transfer request
One payment in detail, with authentication and returnTransfer, Pix, boleto and the other types
Transfer batches of a periodList transfer batches
Transfers to a CPF or CNPJList a beneficiary's transfers
Every entry of a period, by stateList entries by period
Returned Pix and transfers (up to 30 days)List returned payments
Free request numbersNext request numbers

After processing, the request from the transfer example looks like this:

json
{
  "indice": 0,
  "estadoRequisicao": 6,
  "tipoPagamento": 128,
  "dataRequisicao": 23102026,
  "quantidadePagamentos": 3,
  "valorPagamentos": 410.75,
  "pagamentos": [
    { "identificadorPagamento": 90346625218725001, "valorPagamento": 400.75, "estadoPagamento": "PAGO", "erros": [] },
    { "identificadorPagamento": 90346625218725002, "valorPagamento": 10, "estadoPagamento": "PAGO", "erros": [] },
    { "identificadorPagamento": 90346625218725003, "valorPagamento": 0, "estadoPagamento": "REJEITADO", "erros": [9, 1, 23, 3, 18] }
  ]
}

Lists page by indice (or numeroDaPosicaoDePesquisa for entries by period): send 0 on the first call and repeat with the returned value until it comes back 0. See Formats and pagination.

Force the outcome in the sandbox

Besides the cents ,91 (reject), ,92 (return) and ,93 (block), you can decide a payment's outcome through the control API, playing the bank:

bash
curl --request POST \
  --url https://api.mimicr.dev/v1/bb/actions/lote.settle \
  --header 'Authorization: Bearer mk_…' \
  --header 'Content-Type: application/json' \
  --data '{ "id": "90346625218725001", "result": "REJEITADO", "motivo": "209" }'

result takes PAGO (debits and sends the webhook), REJEITADO, BLOQUEADO or DEVOLVIDO (only for a payment that is already PAGO). With the CLI:

bash
npx mimicr action bb lote.settle id=90346625218725001 result=PAGO
npx mimicr wait bb object kind=lancamento id=90346625218725001 status=PAGO

More actions in Sandbox control.