1.
Read the raw request body (exact bytes, before JSON parse).
2.
Compute expected = HMAC_SHA256(webhookSecret, timestamp + "." + rawBody).
3.
Compare expected with x-sxpay-signature using constant-time comparison.
4.
Optionally reject if the timestamp is too old (e.g., > 5 minutes) to mitigate replay attacks.
Store webhookSecret securely; it is only returned at link creation time.
Use HTTPS for webhookUrl.
Log request IDs and timestamps to help debug delivery issues.
Rotate API keys and webhook endpoints/secrets when decommissioning environments.