Verify Webhook Requests

How to verify BagelPay signature on webhook objects.

How to verify BagelPay signature?

BagelPay signature is sent in the Bagelpay-Signature header of the webhook request. The signature is generated using the HMAC-SHA256 algorithm with the Signing Secret as the key, and the Request Body and Timestamp as the message.

Sample Webhook Header
{
	"Bagelpay-Signature": "dd7bdd2cf1f6bac6e171c6c508c157b7cd3cc1fd196394277fb59ba0bdd9b87b",
	"timestamp": "1756301826"
}

To verify the signature, you need to generate the signature using the same algorithm and compare it with the signature sent in the header.

If the two signatures match, the request is authentic.

You can find your webhook secret on the Developer>Webhook page.

To generate the Bagelpay-Signature, you can use the following code example:

Simply compare the generated Signature with the one received on the header to complete the verification process.

Last updated