Webhook endpoints
/v1/webhook-endpoints — configura a dónde Rekurra te envía eventos
(subscription.created, charge.approved, etc.). Ver la guía completa de
verificación de firma en Webhooks.
El objeto WebhookEndpoint
{
"id": "we_01HZXK7QJ5M8Z9X2R3TVQ7A1B2",
"url": "https://tuapp.com/webhooks/rekurra",
"secret": "whsec_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"events": ["subscription.created", "charge.approved"],
"active": true
}| Campo | Tipo |
|---|---|
id | string |
url | string |
secret | string (solo en la respuesta de creación) |
events | string[] |
active | boolean |
Crear un webhook endpoint
POST /v1/webhook-endpoints
Request body
{
"url": "https://tuapp.com/webhooks/rekurra",
"events": ["subscription.created", "charge.approved", "charge.declined", "subscription.canceled"]
}curl
curl -X POST https://api.rekurra.dev/v1/webhook-endpoints \
-H "Authorization: Bearer rk_live_XXXXXXXXXXXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{
"url": "https://tuapp.com/webhooks/rekurra",
"events": ["subscription.created", "charge.approved"]
}'JavaScript (fetch)
const res = await fetch("https://api.rekurra.dev/v1/webhook-endpoints", {
method: "POST",
headers: {
Authorization: "Bearer rk_live_XXXXXXXXXXXXXXXXXXXXXXXX",
"Content-Type": "application/json",
},
body: JSON.stringify({
url: "https://tuapp.com/webhooks/rekurra",
events: ["subscription.created", "charge.approved"],
}),
});
const endpoint = await res.json();Python (requests)
import requests
res = requests.post(
"https://api.rekurra.dev/v1/webhook-endpoints",
headers={
"Authorization": "Bearer rk_live_XXXXXXXXXXXXXXXXXXXXXXXX",
"Content-Type": "application/json",
},
json={
"url": "https://tuapp.com/webhooks/rekurra",
"events": ["subscription.created", "charge.approved"],
},
)
endpoint = res.json()Response — 201 Created
Devuelve el objeto con secret incluido — guárdalo, no se vuelve a
mostrar.
Errores posibles
| Status | error.type | Causa |
|---|---|---|
400 | invalid_request | url inválida o events con un tipo desconocido |
Listar webhook endpoints
GET /v1/webhook-endpoints
curl
curl https://api.rekurra.dev/v1/webhook-endpoints \
-H "Authorization: Bearer rk_live_XXXXXXXXXXXXXXXXXXXXXXXX"JavaScript (fetch)
const res = await fetch("https://api.rekurra.dev/v1/webhook-endpoints", {
headers: { Authorization: "Bearer rk_live_XXXXXXXXXXXXXXXXXXXXXXXX" },
});
const { data } = await res.json();Python (requests)
import requests
res = requests.get(
"https://api.rekurra.dev/v1/webhook-endpoints",
headers={"Authorization": "Bearer rk_live_XXXXXXXXXXXXXXXXXXXXXXXX"},
)
body = res.json()Nota: los objetos devueltos en el listado no incluyen secret.
Actualizar un webhook endpoint
PATCH /v1/webhook-endpoints/{id}
curl
curl -X PATCH https://api.rekurra.dev/v1/webhook-endpoints/we_01HZXK7QJ5M8Z9X2R3TVQ7A1B2 \
-H "Authorization: Bearer rk_live_XXXXXXXXXXXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "active": false }'JavaScript (fetch)
const res = await fetch(
"https://api.rekurra.dev/v1/webhook-endpoints/we_01HZXK7QJ5M8Z9X2R3TVQ7A1B2",
{
method: "PATCH",
headers: {
Authorization: "Bearer rk_live_XXXXXXXXXXXXXXXXXXXXXXXX",
"Content-Type": "application/json",
},
body: JSON.stringify({ active: false }),
}
);
const endpoint = await res.json();Python (requests)
import requests
res = requests.patch(
"https://api.rekurra.dev/v1/webhook-endpoints/we_01HZXK7QJ5M8Z9X2R3TVQ7A1B2",
headers={
"Authorization": "Bearer rk_live_XXXXXXXXXXXXXXXXXXXXXXXX",
"Content-Type": "application/json",
},
json={"active": False},
)
endpoint = res.json()Errores posibles
| Status | error.type | Causa |
|---|---|---|
404 | invalid_request | El webhook endpoint no existe |
Eliminar un webhook endpoint
DELETE /v1/webhook-endpoints/{id}
curl
curl -X DELETE https://api.rekurra.dev/v1/webhook-endpoints/we_01HZXK7QJ5M8Z9X2R3TVQ7A1B2 \
-H "Authorization: Bearer rk_live_XXXXXXXXXXXXXXXXXXXXXXXX"JavaScript (fetch)
await fetch(
"https://api.rekurra.dev/v1/webhook-endpoints/we_01HZXK7QJ5M8Z9X2R3TVQ7A1B2",
{
method: "DELETE",
headers: { Authorization: "Bearer rk_live_XXXXXXXXXXXXXXXXXXXXXXXX" },
}
);Python (requests)
import requests
requests.delete(
"https://api.rekurra.dev/v1/webhook-endpoints/we_01HZXK7QJ5M8Z9X2R3TVQ7A1B2",
headers={"Authorization": "Bearer rk_live_XXXXXXXXXXXXXXXXXXXXXXXX"},
)