Payout Webhooks
Handle real-time payout status notifications with webhook events
Payout Webhooks
Webhooks allow your application to receive real-time notifications when payout events occur. Instead of polling the API, Plexy pushes event data to your endpoint as payouts progress through their lifecycle.
Configure webhook endpoints in your Plexy Dashboard under Settings > Webhooks. You can set up different endpoints for different event types.
Webhook Events
| Event | Description |
|---|---|
PAYOUT_SUBMITTED | Payout created and stored, awaiting confirmation (staged payouts) |
PAYOUT_CONFIRMED | Staged payout approved and processing started |
PAYOUT_DECLINED | Staged payout rejected during review |
PAYOUT_PAID | Funds successfully delivered to recipient |
PAYOUT_FAILED | Payout processing failed |
Event Payloads
PAYOUT_SUBMITTED
Triggered when a staged payout is created and stored, awaiting approval.
{
"id": "evt_payout_submitted_001",
"type": "PAYOUT_SUBMITTED",
"created_at": "2026-03-25T09:00:00Z",
"api_version": "2026-03-01",
"data": {
"payout": {
"id": "po_staged_abc123def456",
"object": "payout",
"status": "stored",
"amount": {
"value": 500000,
"currency": "KZT"
},
"method": "instant_card",
"recipient": {
"id": "rec_xyz789",
"type": "individual",
"first_name": "Alex",
"last_name": "Johnson",
"card": {
"brand": "visa",
"last4": "1111"
}
},
"reference": "expense_reimbursement_001",
"description": "Q1 expense reimbursement",
"created_at": "2026-03-25T09:00:00Z",
"expires_at": "2026-03-26T09:00:00Z",
"metadata": {
"expense_report_id": "exp_789",
"department": "engineering",
"submitted_by": "user_456"
}
}
}
}PAYOUT_CONFIRMED
Triggered when a staged payout is approved and processing begins.
{
"id": "evt_payout_confirmed_001",
"type": "PAYOUT_CONFIRMED",
"created_at": "2026-03-25T10:30:00Z",
"api_version": "2026-03-01",
"data": {
"payout": {
"id": "po_staged_abc123def456",
"object": "payout",
"status": "processing",
"amount": {
"value": 500000,
"currency": "KZT"
},
"method": "instant_card",
"recipient": {
"id": "rec_xyz789",
"type": "individual",
"first_name": "Alex",
"last_name": "Johnson",
"card": {
"brand": "visa",
"last4": "1111"
}
},
"reference": "expense_reimbursement_001",
"created_at": "2026-03-25T09:00:00Z",
"confirmed_at": "2026-03-25T10:30:00Z",
"estimated_arrival": "2026-03-25T11:00:00Z",
"approved_by": "approver_user_123",
"approval_notes": "Verified against expense report EXP-789",
"metadata": {
"expense_report_id": "exp_789",
"department": "engineering",
"submitted_by": "user_456"
}
}
}
}PAYOUT_DECLINED
Triggered when a staged payout is rejected during the review process.
{
"id": "evt_payout_declined_001",
"type": "PAYOUT_DECLINED",
"created_at": "2026-03-25T10:30:00Z",
"api_version": "2026-03-01",
"data": {
"payout": {
"id": "po_staged_abc123def456",
"object": "payout",
"status": "declined",
"amount": {
"value": 500000,
"currency": "KZT"
},
"method": "instant_card",
"recipient": {
"id": "rec_xyz789",
"type": "individual",
"first_name": "Alex",
"last_name": "Johnson",
"card": {
"brand": "visa",
"last4": "1111"
}
},
"reference": "expense_reimbursement_001",
"created_at": "2026-03-25T09:00:00Z",
"declined_at": "2026-03-25T10:30:00Z",
"declined_by": "approver_user_123",
"decline_reason": "duplicate_request",
"decline_notes": "This expense was already reimbursed in batch #42",
"metadata": {
"expense_report_id": "exp_789",
"department": "engineering",
"submitted_by": "user_456"
}
}
}
}PAYOUT_PAID
Triggered when funds are successfully delivered to the recipient.
{
"id": "evt_payout_paid_001",
"type": "PAYOUT_PAID",
"created_at": "2026-03-25T10:35:00Z",
"api_version": "2026-03-01",
"data": {
"payout": {
"id": "po_staged_abc123def456",
"object": "payout",
"status": "completed",
"amount": {
"value": 500000,
"currency": "KZT"
},
"fee": {
"value": 7550,
"currency": "KZT"
},
"net_amount": {
"value": 500000,
"currency": "KZT"
},
"method": "instant_card",
"recipient": {
"id": "rec_xyz789",
"type": "individual",
"first_name": "Alex",
"last_name": "Johnson",
"card": {
"brand": "visa",
"last4": "1111"
}
},
"reference": "expense_reimbursement_001",
"network": "visa_direct",
"network_reference": "VD789012345678",
"created_at": "2026-03-25T09:00:00Z",
"confirmed_at": "2026-03-25T10:30:00Z",
"completed_at": "2026-03-25T10:35:00Z",
"metadata": {
"expense_report_id": "exp_789",
"department": "engineering",
"submitted_by": "user_456"
}
}
}
}PAYOUT_FAILED
Triggered when payout processing fails.
{
"id": "evt_payout_failed_001",
"type": "PAYOUT_FAILED",
"created_at": "2026-03-25T10:32:00Z",
"api_version": "2026-03-01",
"data": {
"payout": {
"id": "po_staged_abc123def456",
"object": "payout",
"status": "failed",
"amount": {
"value": 500000,
"currency": "KZT"
},
"method": "instant_card",
"recipient": {
"id": "rec_xyz789",
"type": "individual",
"first_name": "Alex",
"last_name": "Johnson",
"card": {
"brand": "visa",
"last4": "1111"
}
},
"reference": "expense_reimbursement_001",
"failure_reason": "card_not_eligible",
"failure_code": "CARD_INELIGIBLE",
"failure_message": "Card does not support push-to-card transactions. Visa Direct not available for this card.",
"created_at": "2026-03-25T09:00:00Z",
"confirmed_at": "2026-03-25T10:30:00Z",
"failed_at": "2026-03-25T10:32:00Z",
"metadata": {
"expense_report_id": "exp_789",
"department": "engineering",
"submitted_by": "user_456"
}
}
}
}Implementing Webhook Handlers
Endpoint Setup
Plexy sends an inbound POST request to your configured endpoint when a payout event occurs. The following example shows a PAYOUT_CONFIRMED event — the representative payload for an approved payout that is now processing:
curl -X POST https://your-app.example.com/webhooks/plexy \
-H "Plexy-Signature: t=1716640000,v1=ab12cd34ef5678..." \
-H "Content-Type: application/json" \
-d '{
"type": "PAYOUT_CONFIRMED",
"data": {
"payout": {
"id": "po_staged_abc123def456",
"status": "processing",
"amount": { "value": 500000, "currency": "KZT" },
"method": "instant_card",
"recipient": {
"id": "rec_xyz789",
"first_name": "Alex",
"last_name": "Johnson",
"card": { "brand": "visa", "last4": "1111" }
},
"reference": "expense_reimbursement_001",
"confirmed_at": "2026-03-25T10:30:00Z",
"approved_by": "approver_user_123"
}
}
}'Verify the signature
Compute HMAC-SHA256(<raw request body>, <your webhook secret>), hex-encode the result, and compare against the v1= value in the Plexy-Signature header using a constant-time comparison. Reject the request if they differ.
Other event types sent to your endpoint: PAYOUT_SUBMITTED, PAYOUT_DECLINED, PAYOUT_PAID, PAYOUT_FAILED. See the Event Payloads section above for the full payload structure of each event.
Signature Verification
Every webhook includes a Plexy-Signature header for verification. Always verify signatures to ensure requests come from Plexy.
Signature Format
The signature header contains a timestamp and signature hash:
Plexy-Signature: t=1711356000,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bdManual Verification
To verify the signature without an SDK:
- Parse the
Plexy-Signatureheader to extract thet(timestamp) andv1(hash) values. - Reject the request if the timestamp is more than 5 minutes from the current time (replay protection).
- Build the signed payload string:
<timestamp>.<raw request body>. - Compute
HMAC-SHA256(signed_payload, webhook_secret)and hex-encode the result. - Compare the computed hex digest against the
v1value using a constant-time comparison. Reject the request if they differ.
import crypto from 'crypto';
function verifyWebhookSignature(payload, signature, secret) {
const elements = signature.split(',');
const timestamp = elements.find(e => e.startsWith('t=')).split('=')[1];
const signatureHash = elements.find(e => e.startsWith('v1=')).split('=')[1];
// Reject stale webhooks (> 5 minutes)
const currentTime = Math.floor(Date.now() / 1000);
if (Math.abs(currentTime - parseInt(timestamp)) > 300) {
throw new Error('Webhook timestamp too old');
}
const signedPayload = `${timestamp}.${payload}`;
const expectedSignature = crypto
.createHmac('sha256', secret)
.update(signedPayload)
.digest('hex');
if (!crypto.timingSafeEqual(Buffer.from(signatureHash), Buffer.from(expectedSignature))) {
throw new Error('Invalid webhook signature');
}
return true;
}Webhook Configuration
Register Endpoint via API
curl -X POST https://api.plexypay.com/v2/webhooks \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-domain.com/webhooks/plexy",
"events": [
"PAYOUT_SUBMITTED",
"PAYOUT_CONFIRMED",
"PAYOUT_DECLINED",
"PAYOUT_PAID",
"PAYOUT_FAILED"
],
"description": "Production payout webhook"
}'Response
{
"id": "wh_endpoint_abc123",
"object": "webhook_endpoint",
"url": "https://your-domain.com/webhooks/plexy",
"events": [
"PAYOUT_SUBMITTED",
"PAYOUT_CONFIRMED",
"PAYOUT_DECLINED",
"PAYOUT_PAID",
"PAYOUT_FAILED"
],
"secret": "whsec_abc123xyz789...",
"status": "active",
"created_at": "2026-03-25T10:00:00Z"
}Store the webhook secret securely. It is only shown once when the endpoint is created. If lost, you must rotate the secret.
List Webhook Endpoints
curl -X GET https://api.plexypay.com/v2/webhooks \
-H "x-api-key: YOUR_API_KEY"Update Endpoint
curl -X PATCH https://api.plexypay.com/v2/webhooks/wh_endpoint_abc123 \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"events": ["PAYOUT_PAID", "PAYOUT_FAILED"],
"status": "active"
}'Rotate Webhook Secret
curl -X POST https://api.plexypay.com/v2/webhooks/wh_endpoint_abc123/rotate-secret \
-H "x-api-key: YOUR_API_KEY"Retry Policy
Plexy automatically retries failed webhook deliveries with exponential backoff.
| Attempt | Delay |
|---|---|
| 1 | Immediate |
| 2 | 1 minute |
| 3 | 5 minutes |
| 4 | 30 minutes |
| 5 | 2 hours |
| 6 | 8 hours |
| 7 | 24 hours |
After 7 failed attempts, the webhook is marked as failed and no further retries occur.
Delivery Status
A webhook delivery is considered successful when your endpoint returns a 2xx status code within 30 seconds.
| Response | Result |
|---|---|
200, 201, 202, 204 | Success, no retry |
3xx | Failure, will retry |
4xx | Failure, will retry (except 410 Gone) |
410 Gone | Endpoint disabled, no retry |
5xx | Failure, will retry |
| Timeout (30s) | Failure, will retry |
View Webhook Logs
List Recent Deliveries
curl -X GET "https://api.plexypay.com/v2/webhooks/wh_endpoint_abc123/deliveries?limit=20" \
-H "x-api-key: YOUR_API_KEY"Delivery Response
{
"data": [
{
"id": "del_123456",
"event_id": "evt_payout_paid_001",
"event_type": "PAYOUT_PAID",
"status": "delivered",
"response_status": 200,
"response_time_ms": 156,
"attempts": 1,
"created_at": "2026-03-25T10:35:00Z",
"delivered_at": "2026-03-25T10:35:00Z"
},
{
"id": "del_123457",
"event_id": "evt_payout_failed_001",
"event_type": "PAYOUT_FAILED",
"status": "failed",
"response_status": 500,
"response_time_ms": 2340,
"attempts": 3,
"created_at": "2026-03-25T10:32:00Z",
"next_retry_at": "2026-03-25T11:02:00Z"
}
]
}Manually Retry a Delivery
curl -X POST https://api.plexypay.com/v2/webhooks/deliveries/del_123457/retry \
-H "x-api-key: YOUR_API_KEY"Idempotency
Webhook events include a unique id field. Store processed event IDs to handle duplicate deliveries.
async function handleWebhook(event) {
// Check if already processed
const processed = await db.webhookEvents.findOne({ eventId: event.id });
if (processed) {
console.log(`Event ${event.id} already processed, skipping`);
return { status: 'duplicate' };
}
// Process the event
await processPayoutEvent(event);
// Mark as processed
await db.webhookEvents.insertOne({
eventId: event.id,
type: event.type,
processedAt: new Date(),
});
return { status: 'processed' };
}Testing Webhooks
Send Test Event
curl -X POST https://api.plexypay.com/v2/webhooks/wh_endpoint_abc123/test \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"event_type": "PAYOUT_PAID"
}'Local Development
Use tools like ngrok or localtunnel to expose your local server.
# Start your local server
npm run dev
# In another terminal, start ngrok
ngrok http 3000
# Use the ngrok URL for your webhook endpoint
# https://abc123.ngrok.io/webhooks/plexyBest Practices
Never process webhooks without verifying the Plexy-Signature header to prevent spoofed requests.
Return a 200 response as soon as you receive the webhook. Process the event
asynchronously to avoid timeouts.
Store processed event IDs and check before processing to handle duplicate deliveries gracefully.
Webhook endpoints must use HTTPS in production. Plexy rejects HTTP endpoints for live environments.
Set up alerts for failed webhook deliveries and review logs regularly to catch integration issues.
Return appropriate status codes. Use 4xx for permanent errors (bad request) and 5xx for temporary issues (retry later).
Failure Reasons Reference
failure_reason | failure_code | Description |
|---|---|---|
card_not_eligible | CARD_INELIGIBLE | Card doesn't support push-to-card |
card_expired | CARD_EXPIRED | Card has expired |
card_lost_stolen | CARD_LOST_STOLEN | Card reported lost/stolen |
insufficient_balance | INSUFFICIENT_BALANCE | Merchant balance too low |
daily_limit_exceeded | LIMIT_EXCEEDED | Recipient's daily limit reached |
invalid_card_number | INVALID_CARD | Card number is invalid |
network_unavailable | NETWORK_ERROR | Payment network temporarily down |
issuer_declined | ISSUER_DECLINED | Issuing bank declined |
fraud_suspected | FRAUD_BLOCK | Transaction flagged for fraud |
recipient_blocked | RECIPIENT_BLOCKED | Recipient on sanctions list |
invalid_bank_account | INVALID_ACCOUNT | Bank account details invalid |
bank_not_supported | BANK_NOT_SUPPORTED | Bank doesn't accept transfers |
Next Steps
- Staged Payouts - Multi-step approval workflow
- Instant Payouts - Card payout implementation
- Bank Account Payouts - Bank transfer webhooks