Webhooks
Set up event notifications
Webhooks
Webhooks allow PayMongo to notify your application when events happen in your account. Receive real-time updates about payments, refunds, and other events.
What are Webhooks?
Webhooks are HTTP callbacks that notify your application when specific events occur:
- Payment completed
- Payment failed
- Refund processed
- Payout sent
Instead of polling the API, your application receives instant notifications.
Dashboard Overview
View all configured webhooks:
| Column | Description |
|---|---|
| URL | Your endpoint URL |
| Events | Subscribed events |
| Status | Active, Inactive, Failed |
| Created | When configured |
| Last Triggered | Most recent event |
Creating a Webhook
Step 1: Add Endpoint
- Click "Add Webhook"
- Enter your endpoint URL
- Must be HTTPS
- Must be publicly accessible
Step 2: Select Events
Choose which events to receive:
| Event | Description |
|---|---|
payment.paid | Payment successful |
payment.failed | Payment failed |
source.chargeable | Source ready for payment |
refund.created | Refund initiated |
payout.created | Payout generated |
Step 3: Save
Click "Create Webhook" to activate.
Webhook Secret
Each webhook has a secret key for verification:
Viewing Secret
- Click on the webhook
- Click "Show Secret"
- Copy the secret key
Verifying Webhooks
Use the secret to verify webhook authenticity:
signature = HMAC-SHA256(secret, payload)
Compare with the Paymongo-Signature header.
Managing Webhooks
Enabling/Disabling
Toggle webhooks on or off:
- Find the webhook
- Click the toggle
- Status changes immediately
Editing Webhooks
Modify existing webhooks:
- Click the webhook
- Click "Edit"
- Update URL or events
- Save changes
Deleting Webhooks
Remove webhooks you no longer need:
- Click the webhook
- Click "Delete"
- Confirm deletion
Webhook Events
Payment Events
| Event | Trigger |
|---|---|
payment.paid | Successful payment |
payment.failed | Failed payment |
payment.refunded | Payment refunded |
payment.pending | Payment awaiting action |
Source Events
| Event | Trigger |
|---|---|
source.chargeable | Ready to charge |
source.cancelled | Source cancelled |
source.expired | Source expired |
source.failed | Source creation failed |
Payout Events
| Event | Trigger |
|---|---|
payout.created | Payout initiated |
payout.paid | Payout completed |
payout.failed | Payout failed |
Webhook Payload
Payload Structure
{
"data": {
"id": "evt_xxx",
"type": "event",
"attributes": {
"type": "payment.paid",
"data": {
// Event data
}
}
}
}Headers
| Header | Description |
|---|---|
Paymongo-Signature | HMAC signature |
Content-Type | application/json |
Retry Policy
Failed webhooks are retried automatically:
| Attempt | Delay |
|---|---|
| 1st retry | 1 minute |
| 2nd retry | 5 minutes |
| 3rd retry | 30 minutes |
| 4th retry | 2 hours |
| 5th retry | 4 hours |
After 5 failed attempts, the webhook is marked as failed.
Viewing Webhook Logs
Recent Deliveries
View delivery history:
| Column | Description |
|---|---|
| Event | Event type |
| Time | When sent |
| Status | Success/Failed |
| Response | HTTP response code |
Debugging
Click on a delivery to see:
- Request payload
- Response body
- Headers
- Timing
Best Practices
| Practice | Recommendation |
|---|---|
| Use HTTPS | Secure your endpoints |
| Verify signatures | Always validate authenticity |
| Respond quickly | Return 200 within 30 seconds |
| Handle duplicates | Events may be sent more than once |
| Process async | Queue events for background processing |
| Monitor failures | Watch for delivery issues |
Troubleshooting
Common Issues
| Issue | Solution |
|---|---|
| Not receiving | Check URL accessibility |
| Signature invalid | Verify using correct secret |
| Timeout | Speed up endpoint response |
| SSL error | Check certificate validity |
Feel free to reach out to [email protected] if you have questions about webhooks!
Updated about 15 hours ago
