Webhook Verification Information
Security: All webhooks are signed with HMAC-SHA256
Headers:
X-Webhook-Signature: Contains the signature in formatsha256=<hex_signature>User-Agent: AlwaysVesuvioPay-Webhooks/1.0Content-Type: Alwaysapplication/json
Verification Process:
- Get your webhook secret from the webhook configuration
- Compute HMAC-SHA256 of the raw request body using your secret
- Compare with the signature from the header (use timing-safe comparison)
Response Requirements:
- Respond with 2xx status code within 30 seconds
- VesuvioPay will retry failed deliveries with exponential backoff
- Use the webhook event
idfor idempotency (events may be delivered more than once)
Example verification code:
const crypto = require('crypto');
function verifyWebhook(payload, signature, secret) {
const expectedSignature = 'sha256=' +
crypto.createHmac('sha256', secret)
.update(payload, 'utf8')
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expectedSignature)
);
}