Callback Events
Understand callback events and webhooks for the WooCommerce plugin
Callback Events
The Bridge WooCommerce Plugin uses callbacks to receive real-time payment notifications and update order statuses automatically.
Overview
Callbacks are HTTP POST requests sent to your WooCommerce site when payment events occur. The plugin automatically handles these callbacks to update order statuses and send notifications.
Callback URL
Default Callback URL
https://your-site.com/wc-api/bridge_callbackCustom Callback URL
You can set a custom callback URL in the plugin settings, but the default URL is recommended.
Callback Events
Payment Success
Triggered when a payment is successfully completed.
Event Data:
{
"event_type": "payment_success",
"transaction_id": "79",
"order_id": "1234",
"status": "000",
"status_desc": "Transaction Successful",
"network_transaction_id": "57537797464",
"amount": 0.1,
"currency_code": "GHS",
"customer_number": "0541234567",
"reference": "Transfer to momo",
"timestamp": "2025-08-31T23:45:00Z"
}Plugin Actions:
- Update order status to "Processing"
- Add order note with transaction details
- Send confirmation email to customer
- Send SMS notification (if enabled)
Payment Failure
Triggered when a payment fails.
Event Data:
{
"event_type": "payment_failure",
"transaction_id": "80",
"order_id": "1235",
"status": "001",
"status_desc": "Transaction Failed",
"network_transaction_id": "61962982397",
"amount": 0.1,
"currency_code": "GHS",
"customer_number": "0541234567",
"reference": "Transfer to momo",
"timestamp": "2025-08-31T23:46:00Z"
}Plugin Actions:
- Update order status to "Failed"
- Add order note with failure reason
- Send failure notification to customer
- Send SMS notification (if enabled)
Payment Pending
Triggered when a payment is still being processed.
Event Data:
{
"event_type": "payment_pending",
"transaction_id": "81",
"order_id": "1236",
"status": "002",
"status_desc": "Transaction Pending",
"network_transaction_id": "pending_12345",
"amount": 0.1,
"currency_code": "GHS",
"customer_number": "0541234567",
"reference": "Transfer to momo",
"timestamp": "2025-08-31T23:47:00Z"
}Plugin Actions:
- Keep order status as "Pending Payment"
- Add order note with pending status
- Send pending notification to customer
Payment Cancelled
Triggered when a payment is cancelled.
Event Data:
{
"event_type": "payment_cancelled",
"transaction_id": "82",
"order_id": "1237",
"status": "003",
"status_desc": "Transaction Cancelled",
"network_transaction_id": "cancelled_12345",
"amount": 0.1,
"currency_code": "GHS",
"customer_number": "0541234567",
"reference": "Transfer to momo",
"timestamp": "2025-08-31T23:48:00Z"
}Plugin Actions:
- Update order status to "Cancelled"
- Add order note with cancellation reason
- Send cancellation notification to customer
Callback Processing
Automatic Processing
The plugin automatically processes callbacks and:
- Validates the callback data
- Updates the order status
- Adds order notes
- Sends notifications
- Logs the event
Manual Processing
You can also process callbacks manually by:
- Going to WooCommerce > Bridge > Callbacks
- Viewing recent callbacks
- Manually processing failed callbacks
Callback Security
Signature Verification
The plugin verifies callback signatures to ensure authenticity:
// Verify callback signature
$signature = $_SERVER['HTTP_X_BRIDGE_SIGNATURE'];
$payload = file_get_contents('php://input');
$expected_signature = hash_hmac('sha256', $payload, $secret_key);
if (!hash_equals($expected_signature, $signature)) {
wp_die('Invalid signature', 'Unauthorized', 401);
}IP Whitelisting
You can whitelist Bridge IP addresses for additional security:
// Allowed IP addresses
$allowed_ips = [
'203.0.113.1',
'203.0.113.2',
'203.0.113.3'
];
$client_ip = $_SERVER['REMOTE_ADDR'];
if (!in_array($client_ip, $allowed_ips)) {
wp_die('Unauthorized IP', 'Forbidden', 403);
}Callback Logging
Log Files
Callbacks are logged in:
/wp-content/uploads/bridge-logs/callbacks-YYYY-MM-DD.logLog Format
[2025-08-31 23:45:00] SUCCESS: Payment callback received for order 1234
[2025-08-31 23:46:00] ERROR: Invalid signature for callback
[2025-08-31 23:47:00] INFO: Payment status updated for order 1235Log Levels
- SUCCESS: Successful callback processing
- ERROR: Callback processing failed
- INFO: General callback information
- DEBUG: Detailed debugging information
Testing Callbacks
Test Callback URL
Use our test endpoint to verify your callback URL:
curl -X POST "https://your-site.com/wc-api/bridge_callback" \
-H "Content-Type: application/json" \
-H "X-Bridge-Signature: test_signature" \
-d '{
"event_type": "payment_success",
"transaction_id": "test_123",
"order_id": "1234",
"status": "000",
"status_desc": "Test Transaction",
"amount": 1.00,
"currency_code": "GHS"
}'Test with Webhook.site
- Go to webhook.site
- Copy the provided URL
- Use it as your callback URL for testing
- Make a test payment
- Check webhook.site for the callback data
Test in Sandbox Mode
- Enable test mode in plugin settings
- Use test API credentials
- Make test payments
- Verify callbacks are received
Troubleshooting Callbacks
Common Issues
Issue: Callbacks not received
Possible Causes:
- Callback URL not accessible
- SSL certificate issues
- Firewall blocking requests
- Plugin not activated
Solutions:
- Check callback URL accessibility
- Verify SSL certificate
- Check firewall settings
- Ensure plugin is active
Issue: Invalid signature errors
Possible Causes:
- Secret key mismatch
- Payload corruption
- Header issues
Solutions:
- Verify secret key in plugin settings
- Check payload format
- Verify signature header
Issue: Order not updating
Possible Causes:
- Order ID mismatch
- Database issues
- Plugin conflicts
Solutions:
- Check order ID in callback data
- Verify database connectivity
- Disable conflicting plugins
Debug Mode
Enable debug mode to troubleshoot callback issues:
- Go to WooCommerce > Settings > Bridge
- Enable "Debug Mode"
- Check logs in
/wp-content/uploads/bridge-logs/
Callback Monitoring
Monitor callback health:
- Go to WooCommerce > Bridge > Callbacks
- View recent callback activity
- Check for failed callbacks
- Review error messages
Callback Retry Policy
Automatic Retries
Bridge automatically retries failed callbacks:
- Retry Count: 3 attempts
- Retry Interval: 5 minutes
- Timeout: 30 seconds per attempt
Manual Retries
You can manually retry failed callbacks:
- Go to WooCommerce > Bridge > Callbacks
- Find the failed callback
- Click "Retry"
- Check the result
Best Practices
1. Monitor Callback Health
- Check callback logs regularly
- Monitor failed callbacks
- Set up alerts for callback failures
2. Handle Callback Failures
- Implement retry logic
- Log all callback attempts
- Notify administrators of failures
3. Secure Callback Endpoint
- Use HTTPS only
- Verify signatures
- Implement IP whitelisting
- Rate limit requests
4. Test Regularly
- Test callbacks in sandbox mode
- Verify all event types
- Test error scenarios
- Monitor production callbacks
Support
If you need help with callbacks:
- Check Logs: Review callback logs for errors
- Test Callbacks: Use our test tools
- Contact Support: Email support@thebridgesolutions.com
- Include Details: Provide callback logs and error messages