Webhooks
You can create a webhook in your project dashboard under the Universal Bridge tab. You'll be prompted to copy a secret key before saving the webhook. This will be used for verification on all webhook requests received by your backend.
To get the TypeScript type for webhook responses, see the Webhook.Payload
type in the SDK.
There are two ways to verify a webhook request authenticity:
- Checking that the bearer token in the
Authorization
header matches the secret key received when you created the webhook. - Decrypting the payload signature from the
x-payload-signature
header and verifying it against the received webhook body.
The payload signature is constructed using the x-timestamp
header and the webhook's full body:
The x-timestamp
header is a UNIX timestamp in seconds, and the webhook body is the JSON payload received by your webhook endpoint.
Then verify that the signature matches the x-payload-signature
header.
When using webhooks to distribute purchased items, always verify that the proper amount was paid to the proper address.