Pular para o conteúdo

Registrar Boleto Depois

Esta funcionalidade permite criar um boleto e escolher quando ele deve ser registrado no banco. O boleto é gerado normalmente, mas não é enviado para registro até que você decida.

Fluxo de registro posterior: criar boleto, consultar status, habilitar registro e verificar sucesso

Ao criar um boleto com boleto.cobrancaBancaria.registrar = false:

  1. O boleto é criado e o PDF é gerado normalmente
  2. O boleto não é incluído em nenhuma remessa CNAB
  3. O boleto não é enviado automaticamente para o banco
  4. Você pode habilitar o registro posteriormente via nossa API
  • E-commerce: Criar boleto no checkout e registrar apenas quando o cliente confirmar
  • Propostas comerciais: Gerar boleto para orçamento sem custo de registro
  • Distribuidoras: Imprimir boleto junto com a carga e registrar apenas após confirmação de entrega, evitando custos com devoluções
  • Controle de fluxo/custos: Decidir o momento exato do registro conforme sua regra de negócio
Terminal window
curl -v "https://sandbox.boletocloud.com/api/v1/boletos" \
-H "Content-Type: application/x-www-form-urlencoded; charset=utf-8" \
-X "POST" \
-u "api-key_SUA-API-KEY:token" \
-d boleto.conta.token="api-key_SEU-TOKEN-DA-CONTA" \
-d boleto.cobrancaBancaria.registrar="false" \
-d boleto.emissao="2024-01-15" \
-d boleto.vencimento="2024-01-30" \
-d boleto.documento="PROP-001" \
-d boleto.titulo="DM" \
-d boleto.valor="150.00" \
-d boleto.pagador.nome="Alberto Santos Dumont" \
-d boleto.pagador.cprf="111.111.111-11" \
-d boleto.pagador.endereco.cep="36240-000" \
-d boleto.pagador.endereco.uf="MG" \
-d boleto.pagador.endereco.localidade="Santos Dumont" \
-d boleto.pagador.endereco.bairro="Centro" \
-d boleto.pagador.endereco.logradouro="Rua Principal" \
-d boleto.pagador.endereco.numero="100" \
-o boleto.pdf
# Guarde o X-BoletoCloud-Token da resposta para habilitar o registro depois

Verifique se o boleto está marcado para registro, se já foi registrado ou se houve erro.

Terminal window
curl "https://sandbox.boletocloud.com/api/v1/boletos/{token_do_boleto}/registro" \
-u "api-key_SUA-API-KEY:token" \
-H "Content-Type: application/json"
{
"status": {
"token": "token_do_boleto",
"registrar": false,
"registrado": null,
"erro": null
}
}
CampoDescrição
registrartrue = marcado para registrar, false = não será registrado
registradotrue = já registrado no banco, null = ainda não registrado
erroMensagem de erro caso o registro tenha falhado

Quando decidir que o boleto deve ser registrado, altere o campo via API. O boleto será incluído na próxima remessa ou enviado automaticamente ao banco.

Terminal window
curl -X PUT "https://sandbox.boletocloud.com/api/v1/boletos/{token_do_boleto}/registro" \
-u "api-key_SUA-API-KEY:token" \
-H "Content-Type: application/json" \
-d '{"boleto":{"cobrancaBancaria":{"registrar":true}}}'
HTTP/1.1 200 OK
┌─────────────────────────────────────────────────────────────────────┐
│ 1. CRIAR BOLETO (cobrancaBancaria.registrar = false) │
│ └──► Boleto criado, PDF gerado, NÃO enviado ao banco │
│ │
│ 2. CONSULTAR STATUS (GET /boletos/{token}/registro) │
│ └──► Verificar: registrar=false, registrado=null │
│ │
│ 3. HABILITAR REGISTRO (PUT /boletos/{token}/registro) │
│ └──► Alterar: registrar=true │
│ └──► Boleto será enviado ao banco (automático ou via remessa) │
│ │
│ 4. CONSULTAR STATUS NOVAMENTE │
│ └──► Verificar: registrar=true, registrado=true (após envio) │
│ │
└─────────────────────────────────────────────────────────────────────┘