The SDK provides a constructEvent method that verifies the webhook signature and returns a typed event object. This ensures the payload has not been tampered with and was sent by UQPAY.
Prerequisites
Set the webhookSecret when you create the client:
Verify and handle events
Use a raw body parser for your webhook route. Do not use express.json() — the signature verification requires the original request body as a string or Buffer.
The req.body passed to constructEvent must be the original request body string or Buffer, not a parsed JSON object.