โก Real-time Updates
Receive instant notifications when events occur
๐ Secure Delivery
Cryptographically signed payloads for verification
Payment Notification Security
Critical security measures to protect your webhook endpoint from unauthorized access and ensure data integrity.๐ Security Implementation Requirements
1
Verify Payvessel Hash Signature
Validate HMAC SHA-512 signature to ensure data integrity
2
Verify Payvessel IP Address
Check that requests originate from trusted Payvessel servers
3
Prevent Duplicate Transactions
Implement transaction history checks to avoid duplicate processing
Webhook Security Implementation
๐ก๏ธ Hash Signature Verification
When receiving data from a webhook, itโs crucial to ensure the data hasnโt been tampered with during transmission:Retrieve Payvessel Signature
Retrieve Payvessel Signature
Extract the Payvessel signature from the requestโs metadata. This will be available in the
HTTP_PAYVESSEL_HTTP_SIGNATURE header.Generate Hash for Payload
Generate Hash for Payload
Use your secret key (
PVSECRET-) as the key for an HMAC with the SHA-512 algorithm. The payload of the webhook request is used as the message input for this HMAC function.Compare Hashes
Compare Hashes
Compare the generated hash with the Payvessel signature received in the requestโs metadata. If they match, the data hasnโt been tampered with.
๐ IP Address Verification
Validate that incoming webhook requests originate from trusted Payvessel servers: Trusted IP Addresses:3.255.23.38162.246.254.36
๐ Duplicate Transaction Prevention
Webhooks can sometimes be delivered multiple times due to network issues or retries:- Transaction History Check: Query your payment transaction database to check if a transaction with the same reference already exists
- Duplicate Handling: If a matching transaction is found, ignore the duplicate request
- Idempotency: Ensure your webhook processing is idempotent
Implementation Examples
๐ Python Django Webhook Handler
Complete Django implementation with security verification:๐ PHP Webhook Handler
Secure PHP implementation for webhook processing:๐จ Node.js Express Webhook Handler
Complete Node.js implementation with security verification:๐ Ruby on Rails Webhook Handler
Rails implementation with security verification:โ Java Spring Boot Webhook Handler
Spring Boot implementation with security verification:Webhook Payload Structure
๐ Standard Webhook Format
Payvessel webhook payloads contain transaction and order information:Testing Your Webhook Implementation
๐งช Local Development Setup
Test webhooks locally using ngrok or similar tools:๏ฟฝ Webhook Testing Checklist
1
Signature Verification
โ
Verify HMAC SHA-512 signature matches
โ
Use correct secret key (PVSECRET-)
โ
Handle raw payload for hash calculation
2
IP Address Validation
โ
Check against trusted IP list
โ
Handle different IP header formats
โ
Account for proxy configurations
3
Duplicate Prevention
โ
Check transaction reference uniqueness
โ
Handle duplicate webhook deliveries
โ
Implement idempotent processing
4
Error Handling
โ
Return appropriate HTTP status codes
โ
Log webhook events for debugging
โ
Handle malformed payloads gracefully
Webhook Best Practices
โ Implementation Guidelines
๏ฟฝ Performance
- Respond within 30 seconds
- Process asynchronously when possible
- Return 200 status immediately
- Use queues for heavy processing
๐ Security
- Always verify signatures
- Validate IP addresses
- Use HTTPS endpoints only
- Log security events
๐ Reliability Measures
Retry Handling
Retry Handling
Payvessel Retry Policy:
- Immediate retry for 5xx errors
- Exponential backoff for subsequent attempts
- Up to 3 days of retry attempts
- Manual replay available in dashboard
Data Persistence
Data Persistence
Store webhook data:
- Log all incoming webhooks
- Store raw payload for debugging
- Track processing status
- Maintain audit trails
Troubleshooting Common Issues
Signature Verification Failed
Signature Verification Failed
Common Causes:
- Using wrong secret key
- Modifying payload before verification
- Incorrect HMAC algorithm (should be SHA-512)
- Character encoding issues
- Verify secret key format (starts with PVSECRET-)
- Use raw payload for hash calculation
- Ensure UTF-8 encoding
- Check header name formatting
IP Address Validation Failed
IP Address Validation Failed
Common Causes:
- Proxy or load balancer configuration
- Different IP header formats
- Firewall or NAT translation
- Check X-Forwarded-For header
- Handle multiple IP formats
- Update trusted IP list if needed
- Test with different IP detection methods
Duplicate Transactions
Duplicate Transactions
Common Causes:
- Network timeouts causing retries
- Multiple webhook endpoints
- Race conditions in processing
- Check transaction reference before processing
- Use database transactions for atomicity
- Implement proper locking mechanisms
- Return success for already processed transactions
Ready to implement webhooks?
โ๏ธ Configure Webhooks
Set up webhook endpoints in your dashboard
๐งช Test Integration
Learn how to test your webhook implementation
