Signature Verification
To ensure the security and integrity of callback notifications, Scenext uses the HMAC-SHA256 algorithm to sign all callback requests.Signature Algorithm
Generation Process
- Convert callback data to JSON string (sorted by key names)
- Use your API key as the secret key
- Generate signature using HMAC-SHA256 algorithm
- Convert signature to hexadecimal string
Python Implementation
JavaScript Implementation
PHP Implementation
Complete Verification Examples
Flask (Python) Server
Express (Node.js) Server
Security Best Practices
Important Tips
FAQ
What to do if signature verification fails?
What to do if signature verification fails?
- Check if the API key is correct
- Ensure JSON serialization sorts keys by name
- Verify that request data hasn’t been modified
- Check that character encoding is UTF-8
Can I skip signature verification?
Can I skip signature verification?
We strongly recommend not skipping signature verification. This would expose your system to security risks, including but not limited to: forged callback requests, data tampering, etc.
Is timestamp verification required?
Is timestamp verification required?
Timestamp verification is not required but recommended. You can check if the timestamp is within a reasonable range (e.g., within 5 minutes) to prevent replay attacks.