Webhook Authentication
API Gateway
This API is used for payment gateway operations:
- Production: https://api.sopague.com.br/gateway
- Sandbox: https://api-hmg.sopague.com.br/gateway
- Architecture: Representational State Transfer (REST)
Description
Endpoints responsible for managing Basic authentication credentials used by the Webhook service.
The system already sends the Access-Key header to identify the sender. Additionally, you can register or remove an extra Basic authentication that will be automatically included in the webhook request headers.
When a payment is processed, our platform can automatically send a notification to your application with the transaction data. Basic authentication adds an extra layer of security for these notifications.
🔐 Endpoints
➕ Register Webhook Authentication
POST /v1/security/webhook-auth
Registers a Basic authentication that will be automatically included in webhook request headers.
{
"basic": "Basic <Base64>"
}
Data dictionary - Parameters
| PROPERTY | DESCRIPTION | TYPE | LOCATION | REQUIRED | VALIDATION |
|---|---|---|---|---|---|
| basic | Basic authentication credential in the format Basic <Base64> | String | Body | yes | Must start with Basic and contain valid Base64 |
Validation rules
-
The
basicfield is required -
It must start with
Basic -
The content after
Basicmust be valid Base64 -
Only one active credential is allowed per client
- 🟢 201
- 🔴 400
- 🔴 401
- 🔴 500
Authentication registered successfully{
"message": "Autenticação de webhook cadastrada com sucesso"
}Data dictionary - Response
PROPERTY DESCRIPTION TYPE message Success message string Validation error[
{
"tag": "basic",
"description": "Campo basic é obrigatório"
}
]Possible validation errors
ERROR DESCRIPTION Campo basic é obrigatório The basicfield was not providedFormato inválido The basicfield must start withBasicBase64 inválido The content after Basicmust be valid Base64Já existe autenticação Credentials are already registered for this client Unauthorized[
{
"tag": "unauthorized",
"description": "MID inválido ou inexistente"
}
]Internal error[
{
"tag": "internal_error",
"description": "Não foi possível executar comando. Erro desconhecido."
}
]
➖ Delete Webhook Authentication
DELETE /v1/security/webhook-auth
Removes the Basic authentication registered for the client.
// No request body required
- 🟢 201
- 🔴 401
- 🔴 500
{
"message": "Autenticação de webhook removida com sucesso"
}
Data dictionary - Response
| PROPERTY | DESCRIPTION | TYPE |
|---|---|---|
| message | Success message | string |
[
{
"tag": "unauthorized",
"description": "MID inválido ou inexistente"
}
]
[
{
"tag": "internal_error",
"description": "Não foi possível executar comando. Erro desconhecido."
}
]
HTTP headers
Requests to the webhook authentication endpoints require Bearer authentication in the header:
Content-Type: application/json
Authorization: Bearer <token>
See also
If a transaction fails, check our full response-code table to identify and properly handle errors:
To understand how webhook notifications work and how to implement the receiver in your application: