Referencia de APIWebhook endpoints

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
}
CampoTipoDescripción
idstringIdentificador único del endpoint
urlstringURL a la que Rekurra entrega los eventos
secretstringSecreto de firma (solo en la respuesta de creación)
eventsstring[]Tipos de evento suscritos
activebooleanSi el endpoint está activo

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 -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"]
  }'

Response — 201 Created

Devuelve el objeto con secret incluido — guárdalo, no se vuelve a mostrar.

Errores posibles

Statuserror.typeCausa
400invalid_requesturl inválida o events con un tipo desconocido

Listar webhook endpoints

GET /v1/webhook-endpoints

curl https://api.rekurra.dev/v1/webhook-endpoints \
  -H "Authorization: Bearer rk_live_XXXXXXXXXXXXXXXXXXXXXXXX"

Nota: los objetos devueltos en el listado no incluyen secret.


Actualizar un webhook endpoint

PATCH /v1/webhook-endpoints/{id}

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 }'

Errores posibles

Statuserror.typeCausa
404invalid_requestEl webhook endpoint no existe

Eliminar un webhook endpoint

DELETE /v1/webhook-endpoints/{id}

curl -X DELETE https://api.rekurra.dev/v1/webhook-endpoints/we_01HZXK7QJ5M8Z9X2R3TVQ7A1B2 \
  -H "Authorization: Bearer rk_live_XXXXXXXXXXXXXXXXXXXXXXXX"