Setup
Prerequisites
You will need:- Your CDP API Key ID and secret
- A webhook notification HTTPS URL
- (Recommended) Install cdpcurl
Create a webhook subscription
- Prepare your subscription configuration:
target.urlshould be your webhook endpoint that will receive the events- You can also set a
headersobject intargetif your url requires specific headers:
- All Payment Link event types should be included to ensure you receive notifications for every payment link state change:
| Event type | Description |
|---|---|
payment_link.payment.success | Payment link successfully paid |
payment_link.payment.failed | Payment link payment failed |
payment_link.payment.expired | Payment link expired without payment |
- Create the webhook subscription:
subscriptionId from the response to view, update, or delete the subscription.
List all subscriptions
Webhook signature verification
How it works
When you create a webhook subscription, the response includes a secret inmetadata.secret. This secret is used to verify that incoming webhooks are authentic.
Each webhook request includes an X-Hook0-Signature header containing:
tfield - the timestamphfield - list of headers included in the signaturev1field - the signature
Implementation
Here’s an example of how to verify webhook signatures:Node.js
Node.js