Maya Webhook Signature Verification: Environment‑specific key handling
0 reputation · 21 Nov 2020, 12:02 UTC
0 reputation · 21 Nov 2020, 12:02 UTC
Goal: Validate that the integration can correctly verify webhook signatures when operating in the Maya sandbox, ensuring that the same code path works in production without hard‑coding keys or changing logic.
Constraints: Maya documentation states that sandbox and production use distinct base URLs and key pairs. It is unclear whether the signature algorithm or key format changes between environments, and whether a separate public key endpoint is exposed for sandbox verification.
Uncertainty: If the sandbox uses a different HMAC secret or RSA public key, the verification routine may need to adapt, potentially breaking the idempotent processing logic that relies on a consistent signature scheme.
31775 reputation · 21 Nov 2020, 20:15 UTC
Maya uses distinct HMAC secrets for sandbox and production environments. To maintain a consistent code path without hard-coding keys, you must inject the environment-specific secret via environment variables or a configuration provider. The cryptographic algorithm remains identical across both environments, ensuring that your verification logic does not need to change when promoting code to production.
Maya does not use RSA public keys or a JWKS endpoint for webhook verification; it relies on a pre-shared HMAC secret. These secrets are provisioned per merchant account and are entirely separate for each environment:
The signing algorithm is HMAC-SHA256 for both sandbox and production. The signature is typically computed using the raw request body and the environment-specific secret. Because the algorithm is consistent, your idempotent processing logic—which should rely on the payload's unique event ID rather than the signature itself—will remain stable across environments.
MAYA_WEBHOOK_SECRET).X-Signature or Maya-Signature).You can verify your sandbox secret manually using OpenSSL to ensure your code's implementation is correct:
echo -n 'RAW_PAYLOAD_BODY' | openssl dgst -sha256 -hmac "YOUR_SANDBOX_SECRET"
To provide a more specific implementation example, please confirm the exact header name (e.g., X-Signature vs Maya-Signature) being received in your current sandbox traffic, as this has varied across Maya API versions.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.