Skip to main content

Register and Manage Webhooks

Antes de iniciar, é necessário saber quais produtos está contratando e se os fluxos possuem notificações via Webhook. Para isso, explicaremos abaixo os produtos disponíveis atualmente neste módulo de APIs e os eventos relacionados:

Context

Este campo será o identificador do produto nas requisições.

ContextProduct
PIXPix e Pix Indireto Avulso
INVOICE-NFSEIssuance of Service Invoice
BAASPAYCredenciamento Contas BaaS na Sub Celcoin
SPBSPB e SLC

Events

Notificações que serão enviadas por produto:

Pix / Pix Indireto

EntityDescription
pix-payment-outEvent that confirms the completion of Pix payments or transfers
pix-payment-inEvent that informs Pix receipts
pix-reversal-outEvent confirming the return of Pix receipts
pix-reversal-inEvent that informs a return of Pix payments or transfers

Indirect Pix

EntityDescription
pix-dict-claimEvent that informs the process of portability and reclaiming a Pix key
pix-infractionEvent that informs receipt of Pix violations
pix-med-refundEvent that confirms the return via MED

Automatic Pix

EventDescription
pix-automatic-recurrency-awaiting-debtorEvento disparado quando o pagador recebe a solicitação de recorrência.
pix-automatic-recurrency-completedEvento disparado quando pagador aceita ou recusa a recorrência.
pix-automatic-payment-instruction-cashinEvento enviado tanto para casos de recebimento no dia do vencimento, quanto para casos onde o recebimento ocorreu em uma das 3 retentativas de recebimento após o vencimento.
pix-automatic-payment-instruction-expiredEvento com o resultado da retentativa de recebimento.
pix-automatic-payment-instruction-completedEvento com o resultado de recebimento.
pix-automatic-payment-instruction-cancelledEvento de Cancelamento de Agendamento

Issuance of Service Invoice

EntityDescription
invoice-nfse-registrationEvento que atualiza status da solicitação de Emissão da NFs-e e retorna dados da nota fiscal.
invoice-nfse-cancellationEvento que atualiza status da solicitação de cancelamento da NFs-e

Credenciar Contas BaaS na Sub Celcoin

EntityDescription
account-accreditationEvento que atualiza o status do credenciamento das contas do BaaS na Sub Celcoin

Credenciar Contas BaaS na Sub Celcoin

EntityDescription
spb-event-errorEsse evento ocorre quando uma liquidação padrão não é efetivada
warning

Important

Please be advised that, to ensure the stability and predictability of integrations, we will never remove fields from a webhook contract without prior communication to customers. However, new fields may be added as needed to enhance the functionality and value of the data provided. We recommend that our customers avoid restricting the entry of webhooks with new fields, ensuring that the system is prepared to receive these updates and maintain ongoing compatibility.


Register webhook

In this connection, you will define the routes that will receive notifications related to the flows.

Passos para integrar

  1. Perform API authentication - [ API Reference ]
  2. Cadastrar Webhook - [API Reference]

We offer two authentication options for notifications, Basic Auth or OAuth 2.0. The definition will be made through the request, as per the examples below:

Utilizando Basic Authentication:

In this format the defined basic auth will be sent in notifications.

cURL Call

JSON

curl --location --request POST 'https://sandbox.openfinance.celcoin.dev/common/v1/webhook/subscription' \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --header 'Authorization: Bearer {{access_token}}' \ --data ' { "context": "PIX", "entity": "pix-payment-out", "auth": { "type": "basic", "login": "teste", "pwd": "teste" }, "webhookUrl": "https://webhookcelcoin/sandbox/event" }'

Description of call fields

Field NameParametersTypeDescription
contextbodystringIdentificador do produto
entitybodystringIdentificador do Evento.
webhookUrlbodystringwebhookUrl.
typebodystringTipo de autenticação. basic ou JWT.
authbodyobjectWebhook authentication data.
loginbodystring[BASIC] Login para a autenticação do webhook.
pwdbodystring[BASIC] Senha para a autenticação do webhook

Utilizando OAuth 2.0:

Neste formato de autenticação, será necessário a criação de um endpoint para a geração do JWT. Antes de enviarmos uma notificação solicitaremos o jwt, através das configurações definidas, que serão utilizadas para autenticar na rota destino.

cURL Call

JSON

curl --location --request POST 'https://sandbox.openfinance.celcoin.dev/common/v1/webhook/subscription' \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --header 'Authorization: Bearer {{access_token}}' \ --data ' { "entity": "pix-payment-out", "webhookUrl": "https://webhookcelcoin/sandbox/event", "auth": { "type": "jwt", "urlAuth": "https://authcelcoin/sandbox/token", "requestType": "body", "responsePathToken": "access_token", "requestAuth": [ { "key": "client_id", "value": "41b44ab9a56440.teste.celcoinapi.v5", "type": "string" }, { "key": "grant_type", "value": "client_credentials", "type": "string" }, { "key": "client_secret", "value": "e9d15cde33024c1494de7480e69b7a18c09d7cd25a8446839b3be82a56a044a3", "type": "string" } ] } }'

Description of call fields

Field NameParametersTypeDescription
contextbodystringIdentificador do produto
entitybodystringIdentificador do Evento.
webhookUrlbodystringRota para o envio da notificação.
typebodystringTipo de autenticação. basic ou JWT.
authbodyobjectWebhook authentication data.
urlAuthbodystringEndpoint para a autenticação e geração do jwt.
requestTypebodystringEstrutura da requisição de autenticação para o seu endpoint (body, form-data, x-www-form-urlencoded)
responsePathTokenbodystringNome do campo que retornará o jwt.
requestAuthbodyarrayDefinição de parâmetros para a autenticação.
keybodystringField name
valuebodystringValor do campo
typebodystringTipo do campo

Return example

tip

Success 200

JSON

{ "version": "1.0.0", "status": "SUCCESS" }

danger

Error 400

JSON

{ "version": "1.0.0", "status": "ERROR", "error": { "errorCode": "CIE999", "message": "Ocorreu um erro interno durante a chamada da api." } }


Consultar cadastros

Neste endpoint será possível localizar os detalhes das rotas cadastradas.

Passos para integrar

  1. Perform API authentication - [ API Reference ]
  2. View registered Webhooks - [ API Reference ]

cURL Call

JSON

curl --location --request GET 'https://sandbox.openfinance.celcoin.dev/common/v1/webhook/subscription?context=PIX&entity=pix-payment-out&active=true' \ --header 'accept: application/json' \ --header 'Authorization: Bearer {{access_token}}'

Description of call fields

Field NameParametersTypeDescription
contextquerystringIdentificador do produto
entityquerystringIdentificador do Evento.
activequeryBooleanSituação do cadastro.

Return example

tip

Success 200

JSON

{ "version": "1.0.0", "status": "SUCCESS", "body": { "entity": "string", "webhookUrl": "string", "active": true, "createDate": "2023-03-06T12:02:48.419Z", "lastUpdateDate": "2023-03-06T12:02:48.419Z", "auth": { "login": "string", "pwd": "string", "type": "string" } } }

danger

Error 400

JSON

{ "version": "1.0.0", "status": "ERROR", "error": { "errorCode": "CIE999", "message": "Ocorreu um erro interno durante a chamada da api." } }


Atualizar/ Editar cadastros

Nesta chamada será possível alterar uma rota, credencial cadastrada ou inativar um evento, utilizando o identificador do cadastro.

Passos para integrar

  1. Perform API authentication - [ API Reference ]
  2. Update registered Webhook - [ API Reference ]

cURL Call

JSON

curl --location --request PUT 'https://sandbox.openfinance.celcoin.dev/common/v1/webhook/subscription/PIX/pix-payment-out' \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --header 'Authorization: Bearer {{access_token}}' \ --data ' { "subscriptionId": "64a340b7987ab1220a72ab66", "auth": { "login": "teste", "pwd": "teste", "type": "basic" }, "webhookUrl": "https://webhookcelcoin/sandbox/event", "active": true }'

Description of call fields

Field NameParametersTypeDescription
contextpathstringIdentificador do produto
entitypathstringIdentificador do Evento.
webhookUrlbodystringwebhookUrl.
typebodystringTipo de autenticação. basic ou JWT.
authbodyobjectWebhook authentication data.
loginbodystring[BASIC] Login para a autenticação do webhook.
pwdbodystring[BASIC] Senha para a autenticação do webhook

Return example

tip

Success 200

JSON

{ "version": "1.0.0", "status": "SUCCESS" }

danger

Error 400

JSON

{ "version": "1.0.0", "status": "ERROR", "error": { "errorCode": "CIE999", "message": "Ocorreu um erro interno durante a chamada da api." } }


Excluir cadastros

Está requisão permite excluir uma rota cadastrada para um determinado evento.

info

Important

Caso exista mais de uma rota cadastrada para o mesmo evento, será necessário enviar o identificador do cadastro (subscriptionId) como query parameter na requisição.

Passos para integrar

  1. Perform API authentication - [ API Reference ]
  2. Delete registered Webhook - [ API Reference ]

cURL Call

JSON

curl --location --request DELETE 'https://sandbox.openfinance.celcoin.dev/common/v1/webhook/subscription/PIX/pix-payment-out?subscriptionId=0000001' \ --header 'accept: application/json' \ --header 'Authorization: Bearer {{access_token}}'

Description of call fields

Field NameParametersTypeDescription
contextpathstringIdentificador do produto
entitypathstringIdentificador do evento.
SubscriptionIdquerystringIdentificador do cadastro.

Return example

tip

Success 200

JSON

{ "version": "1.0.0", "status": "SUCCESS" }

danger

Error 400

JSON

{ "version": "1.0.0", "status": "ERROR", "error": { "errorCode": "CIE999", "message": "Ocorreu um erro interno durante a chamada da api." } }


errorCode table

CodeMessage
CBE205Client already has a webhook registered with this event
CBE206entity is required.
CBE207webhookUrl é obrigatório e deve ser uma url valida.
CBE208The reported event does not exist.
CBE209This type of authentication is not currently available.
CBE211This type of authentication does not exist.
CBE212auth.login é obrigatório.
CBE213auth.pwd é obrigatório.
CBE214It is not allowed to register this webhook for Virtual BaaS.
CBE216auth.type é obrigatorio.