Setup
Prerequisites
You will need:- Your CDP API Key ID and secret
- A webhook notification HTTPS URL
- Install the CDP CLI and run
cdp env live --key-file ./cdp_api_key.jsononce to configure credentials.
Create a webhook subscription
- Review the configuration you’ll submit:
-
labelsis a required field. You must include it as an empty object ({}) -
target.urlshould be your webhook endpoint that will receive the events -
You can also set a
headersobject intargetif your url requires specific headers. Pass it inline with'target.headers:={"custom-header":"value"}'. - 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 with the CDP CLI:
Manage subscriptions
Use thesubscriptionId from the response to view, update, or delete the subscription.
List all subscriptions
update is a full replace — pass every field, including ones you aren’t changing:
Webhook signature verification
How it works
When you create a webhook subscription, the response includes a top-levelsecret. Use this value 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