Webhooks
Pay can be configured to send webhook events to notify your application any time an event happens on your transaction. Pay sends a response, via a HTTP request, to any endpoint URLs that you have provided us in the Pay dashboard.
Events
To listen to events, create a webhook in the Pay dashboard. Webhook URLs must start with https://
.
Purchase Complete
Triggered when a transaction is confirmed onchain. This event provides information about the new status of the order and its transactionHash, as well as other relevant information.
Example Response:
Webhook Verification (Recommended)
Since any outside origin can call your webhook endpoint, it is recommended to verify the webhook signature to ensure a request comes from your Pay instance.
Check the Signature
The payload body is signed with the webhook secret and provided in the X-Pay-Signature request header.
Get the webhook secret for your webhook endpoint from the dashboard.
This code example checks if the signature is valid:
Check the timestamp The event timestamp is provided in the X-Pay-Timestamp request header.
This code example checks if the event exceeds a given expiration duration:
Example webhook endpoint
This NodeJS code example listens for event notifications on the /webhook endpoint: