Webhook Endpoints
Register webhook endpoints to receive real-time notifications for payment events. Manage endpoints, rotate secrets, and verify signatures programmatically.
Create a webhook endpoint
⚠️
Save the secret
The signing secret is only returned when you create the endpoint or rotate the secret. Store it securely in your environment variables.
List endpoints
Send a test ping
List webhook deliveries
Update events
Rotate the signing secret
Rotate the secret if you suspect it has been compromised. This invalidates the old secret immediately.
Delete an endpoint
Verifying webhook signatures
When you receive a webhook, verify its signature before processing. The constructEvent method is a static utility that works without initializing the SDK client.
⚠️
Always verify signatures
Never process a webhook without verifying its signature first. The
constructEvent method throws a SignatureVerificationError if the signature is invalid or the timestamp is too old (5 minute tolerance).Methods reference
| Method | Description |
|---|---|
create(params) | Create a new webhook endpoint |
list() | List all endpoints |
update(id, params) | Update endpoint configuration |
delete(id) | Delete an endpoint |
rotateSecret(id) | Rotate the signing secret |
testPing(id) | Send a test webhook delivery |
listDeliveries(id, params?) | List webhook deliveries with cursor pagination |
| Static Method | Description |
|---|---|
NodeRails.webhooks.constructEvent(...) | Verify signature and parse webhook payload |
Response body reference
All responses are wrapped in { success: true, data: ... }. The fields below describe what's inside data.
create() response
WebhookEndpoint (create)
idstringUnique endpoint ID (UUID)urlstringYour webhook URLeventsstring[]Array of event types subscribed toactivebooleanWhether the endpoint is activecreatedAtstringISO 8601 creation timestampsecretstringSigning secret (only returned on create and rotateSecret)⚠️
Secret is only returned once
The
secret field is only included when you create the endpoint or rotate its secret. It is never returned in list() or update() responses.list() response
WebhookEndpoint (list)
idstringEndpoint IDurlstringWebhook URLeventsstring[]Subscribed event typesactivebooleanWhether activecreatedAtstringISO 8601 creation timestampupdatedAtstringISO 8601 last update timestampupdate() response
WebhookEndpoint (update)
idstringEndpoint IDurlstringWebhook URLeventsstring[]Updated event typesactivebooleanWhether activeupdatedAtstringISO 8601 last update timestamprotateSecret() response
Rotate secret
secretstringNew 64-character hex signing secretdelete() response
Returns 204 No Content (no response body).