Skip to main content

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

  1. Convert callback data to JSON string (sorted by key names)
  2. Use your API key as the secret key
  3. Generate signature using HMAC-SHA256 algorithm
  4. 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

  1. Check if the API key is correct
  2. Ensure JSON serialization sorts keys by name
  3. Verify that request data hasn’t been modified
  4. Check that character encoding is UTF-8
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.
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.