Webhooks
Webhook endpoints receive HTTP POST notifications when payment events occur. Register one or more endpoints and subscribe to the event types you care about. See the Webhooks guide for signature verification and best practices.
Register a webhook
/v1/webhooksRegister a new webhook endpoint
secret for signature verification is set at the merchant level in the dashboard. See Verifying signatures.Body parameters
urlstringrequiredHTTPS URL that will receive webhook POST requests. HTTP URLs are rejected.
eventsarrayrequiredList of event types to subscribe to.One of: payment.confirmed, payment.expired, payment.underpaid, payment.frozen, withdrawal.completed, withdrawal.failed
Returns Returns the Webhook object.
Request
curl -X POST https://api.mpchat.com/v1/webhooks \
-H "Authorization: Bearer mk_live_abc:{ts}:{sig}" \
-H "Content-Type: application/json" \
-d '{
"url": "https://acme.com/webhooks/mp",
"events": [
"payment.confirmed",
"payment.expired",
"withdrawal.completed"
]
}'Response 201
{
"id": "wh_01HQ8ZTXV...",
"merchant_id": "a1b2c3d4-...",
"url": "https://acme.com/webhooks/mp",
"events": [
"payment.confirmed",
"payment.expired",
"withdrawal.completed"
],
"is_active": true,
"created_at": "2024-01-15T10:00:00Z",
"updated_at": "2024-01-15T10:00:00Z"
}List webhooks
/v1/webhooksReturn all registered webhook endpoints
No parameters.
Returns Returns an array of Webhook objects.
Request
curl https://api.mpchat.com/v1/webhooks \
-H "Authorization: Bearer mk_live_abc:{ts}:{sig}"Response 200
[
{
"id": "wh_01HQ8ZTXV...",
"merchant_id": "a1b2c3d4-...",
"url": "https://acme.com/webhooks/mp",
"events": ["payment.confirmed", "payment.expired"],
"is_active": true,
"created_at": "2024-01-15T10:00:00Z",
"updated_at": "2024-01-15T10:00:00Z"
}
]List webhook deliveries
/v1/webhooks/{id}/deliveriesList delivery attempts for a webhook endpoint
Path parameters
idstringrequiredThe webhook endpoint UUID.
Query parameters
limitintegeroptionaldefault: 20Maximum deliveries to return. Max 100.
offsetintegeroptionaldefault: 0Number of deliveries to skip.
Returns Returns an object with a deliveries array and total count. Use this to diagnose failed deliveries.
Request
curl "https://api.mpchat.com/v1/webhooks/wh_01HQ.../deliveries?limit=20" \
-H "Authorization: Bearer mk_live_abc:{ts}:{sig}"Response 200
{
"deliveries": [
{
"id": "wd_01HQ...",
"webhook_id": "wh_01HQ8ZTXV...",
"event_type": "payment.confirmed",
"payload": {
"event": "payment.confirmed",
"data": {"order_id": "c3d4e5f6-...", "status": "PAID"}
},
"status": "DELIVERED",
"attempts": 1,
"max_attempts": 6,
"last_error": null,
"delivered_at": "2024-01-15T10:05:03Z",
"created_at": "2024-01-15T10:05:01Z"
}
],
"total": 14
}Next: Withdrawals API