Webhook Endpoints#
Webhook Endpoints are configured URLs where CasaPay sends event notifications via HTTP POST.
The Webhook Endpoint object#
| Attribute | Type | Description |
|---|---|---|
id | string | Unique identifier with we_ prefix |
object | string | Always "webhook_endpoint" |
url | string | The URL of the webhook endpoint |
enabled_events | array | Events this endpoint receives |
status | enum | enabled, disabled |
secret | string | Signing secret for signature verification |
api_version | string | API version for event rendering |
description | string | Endpoint description |
metadata | hash | Key-value pairs |
created | timestamp | Time at which the object was created |
{
"id": "we_abc123",
"object": "webhook_endpoint",
"url": "https://your-app.com/webhooks/casapay",
"enabled_events": [
"payment_intent.succeeded",
"payment_intent.payment_failed",
"invoice.paid",
"verification_session.completed"
],
"status": "enabled",
"secret": "whsec_abc123...",
"api_version": "2025-01-15",
"description": "Production webhook endpoint",
"created": 1706140800
}Create a Webhook Endpoint#
POST /v1/webhook_endpoints
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Endpoint URL (must be HTTPS) |
enabled_events | array | Yes | Events to subscribe to |
description | string | No | Endpoint description |
api_version | string | No | API version for events |
metadata | hash | No | Key-value pairs |
curl https://api.casapay.com/v1/webhook_endpoints \
-H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-app.com/webhooks/casapay",
"enabled_events": [
"payment_intent.succeeded",
"payment_intent.payment_failed",
"invoice.paid"
],
"description": "Production payment events"
}'{
"id": "we_abc123",
"object": "webhook_endpoint",
"url": "https://your-app.com/webhooks/casapay",
"status": "enabled",
"secret": "whsec_abc123def456...",
"created": 1706140800
}Save the signing secret
The webhook signing secret is only returned when creating the endpoint. Store it securely for signature verification.
Retrieve a Webhook Endpoint#
GET /v1/webhook_endpoints/:id
curl https://api.casapay.com/v1/webhook_endpoints/we_abc123 \
-H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc"Update a Webhook Endpoint#
POST /v1/webhook_endpoints/:id
| Parameter | Type | Description |
|---|---|---|
url | string | Updated URL |
enabled_events | array | Updated event list |
status | string | enabled or disabled |
description | string | Updated description |
curl https://api.casapay.com/v1/webhook_endpoints/we_abc123 \
-H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc" \
-H "Content-Type: application/json" \
-d '{
"enabled_events": [
"payment_intent.succeeded",
"payment_intent.payment_failed",
"invoice.paid",
"verification_session.completed",
"collection_case.updated"
]
}'Delete a Webhook Endpoint#
DELETE /v1/webhook_endpoints/:id
curl -X DELETE https://api.casapay.com/v1/webhook_endpoints/we_abc123 \
-H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc"List Webhook Endpoints#
GET /v1/webhook_endpoints
curl https://api.casapay.com/v1/webhook_endpoints \
-H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc"