Enregistrer un Webhook
Endpoints pour creer, lister et supprimer des webhooks de notification.
Creer un Webhook
POST /api/external/webhooksHeaders
| Header | Type | Obligatoire | Description |
|---|---|---|---|
Authorization | String | Oui | ApiKey {client_id}:{client_secret} |
Content-Type | String | Oui | application/json |
hmac | String | Oui | Signature HMAC-SHA512 du body (en savoir plus) |
Corps de la Requete
| Champ | Type | Obligatoire | Par defaut | Description |
|---|---|---|---|---|
url | String | Oui | -- | URL pour recevoir les notifications (HTTPS par defaut) |
events | Array | Non | tous | Liste des evenements a souscrire. Si omis, souscrit a tous. |
allow_insecure | boolean | Non | false | Autorise les URLs HTTP (non-HTTPS). La securite des donnees est de la responsabilite du client. |
Evenements disponibles : pix.charge.created, pix.charge.paid, pix.charge.expired, pix.payout.created, pix.payout.confirmed, pix.payout.failed, pix.payout.returned, pix.refund.requested, pix.refund.completed, pix.return.received, webhook.test
Exemple
BODY='{"url":"https://votredomaine.com/webhook","events":["pix.charge.paid","pix.payout.confirmed"]}'
HMAC=$(echo -n "$BODY" | openssl dgst -sha512 -hmac "$CLIENT_SECRET" | awk '{print $2}')
curl -X POST https://api.owem.com.br/api/external/webhooks \
-H "Authorization: ApiKey $CLIENT_ID:$CLIENT_SECRET" \
-H "Content-Type: application/json" \
-H "hmac: $HMAC" \
-d "$BODY"Reponse de Succes (201)
{
"worked": true,
"webhook": {
"id": "wh_a1b2c3d4e5f6",
"url": "https://votredomaine.com/webhook",
"events": ["pix.charge.paid", "pix.payout.confirmed"],
"status": "active",
"created_at": "2026-03-07T15:30:00Z"
}
}Reponse d'Erreur (422)
{
"worked": false,
"detail": "L'URL doit utiliser HTTPS"
}HTTPS Uniquement par Defaut
L'URL du webhook doit utiliser HTTPS. Les URLs HTTP seront rejetees, sauf si allow_insecure: true est envoye lors de la creation du webhook.
URLs HTTP
Par defaut, les webhooks necessitent HTTPS pour garantir la securite des donnees en transit. Pour utiliser HTTP, activez l'option allow_insecure: true lors de la creation du webhook.
Attention
Les URLs HTTP transmettent les donnees sans chiffrement. La securite et la confidentialite des informations transmises relevent de la seule responsabilite du client. Owem Pay effectuera la livraison du webhook normalement, mais n'assume aucune responsabilite en cas d'interception ou de fuite de donnees sur des connexions non chiffrees.
Lister les Webhooks
GET /api/external/webhooksHeaders
| Header | Type | Obligatoire | Description |
|---|---|---|---|
Authorization | String | Oui | ApiKey {client_id}:{client_secret} |
Exemple
curl -X GET https://api.owem.com.br/api/external/webhooks \
-H "Authorization: ApiKey $CLIENT_ID:$CLIENT_SECRET"Reponse de Succes (200)
{
"worked": true,
"webhooks": [
{
"id": "wh_a1b2c3d4e5f6",
"url": "https://votredomaine.com/webhook",
"events": ["pix.charge.paid", "pix.payout.confirmed"],
"status": "active",
"created_at": "2026-03-07T15:30:00Z"
}
]
}Supprimer un Webhook
DELETE /api/external/webhooks/:idHeaders
| Header | Type | Obligatoire | Description |
|---|---|---|---|
Authorization | String | Oui | ApiKey {client_id}:{client_secret} |
Parametres de Chemin
| Parametre | Type | Obligatoire | Description |
|---|---|---|---|
id | String | Oui | ID du webhook |
Exemple
curl -X DELETE https://api.owem.com.br/api/external/webhooks/wh_a1b2c3d4e5f6 \
-H "Authorization: ApiKey $CLIENT_ID:$CLIENT_SECRET"Reponse de Succes (200)
{
"worked": true
}Reponse d'Erreur (404)
{
"worked": false,
"detail": "Webhook non trouve"
}