Overview
Webhooks enable real-time notifications for critical e-commerce events including payments, order status changes, and shipping updates. The system receives webhooks from payment gateways and shipping providers to automate order processing.Webhook Types
Payment Webhooks
Receive payment status updates from integrated payment gateways:- Payment Success - Order payment completed successfully
- Payment Failed - Payment attempt failed
- Refund Initiated - Refund process started
- Refund Completed - Refund successfully processed
Shipping Webhooks
Receive shipping status updates from logistics partners:- Order Shipped - Order dispatched from warehouse
- In Transit - Order in delivery
- Out for Delivery - Order out for final delivery
- Delivered - Order successfully delivered
- Delivery Failed - Delivery attempt unsuccessful
User Activity Webhooks
Receive notifications for user-related events:- Points Update - User loyalty points changed (see TssPointHistoryController.py:1)
- Transfer Completed - Money transfer webhook events (see UserController.py:1)
Webhook Endpoints
Payment Gateway Webhook
Shipping Provider Webhook
Gmetri Points Webhook
Webhook Security
Authentication
Webhooks require proper authentication to prevent unauthorized access:IP Whitelisting
For enhanced security, configure IP whitelisting for webhook sources:Webhook Payload Examples
Payment Success Webhook
Shipping Status Webhook
Points Update Webhook
Processing Webhooks
Webhook Handler Implementation
Asynchronous Processing
For time-consuming operations, process webhooks asynchronously:Retry Mechanism
Implement retry logic for failed webhook processing:Webhook Logging
All webhook events are logged for auditing and debugging:Testing Webhooks
Local Testing
Use tools like ngrok to expose your local server for webhook testing:Webhook Simulation
Test webhook handlers with simulated payloads:Webhook Monitoring
Monitor webhook health using:
- Success Rate - Percentage of successfully processed webhooks
- Processing Time - Average time to process webhooks
- Failure Alerts - Notifications for repeated webhook failures
- Queue Depth - Number of pending webhooks in Celery queues
Common Integration Patterns
Order Status Updates
Payment Processing
Refund Processing
Slack Notifications
Webhook events can trigger Slack notifications:Best Practices
Related Resources
Celery Tasks
Background processing for webhook events
Order API
Order management endpoints