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.
1.
Receive the webhook call and parse the payload to extract the payment link identifier.
2.
Call get link details using your API credentials.
3.
Use the API response as the authoritative state for the link/payment.
4.
Run internal processes (e.g., crediting balance, updating orders) based on the API response.
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.