Stripe payout.failed Event Notification to Slack & Email
Learn how to listen to the payout.failed webhook event from Stripe to trigger a notification workflow in MagicBell.
Event payload
Sample payload for the payout.failed event.
{
"api_version": "2023-10-16",
"created": 1694109861,
"data": {
"object": {
"amount": 50000,
"created": 1694109801,
"currency": "usd",
"description": "STRIPE PAYOUT",
"destination": "ba_1NqInRLkdIwHu7ixIiS1Tu4v",
"failure_code": "account_closed",
"failure_message": "The bank account has been closed.",
"id": "po_1NqInRLkdIwHu7ixHhR0St3u",
"livemode": false,
"object": "payout",
"status": "failed",
"type": "bank_account"
}
},
"id": "evt_1NqInSLkdIwHu7ixGgQ9Rs2t",
"livemode": false,
"object": "event",
"type": "payout.failed"
}Connect Stripe to MagicBell to receive events and trigger workflows. This guide uses the MagicBell CLI.
Add the Stripe integration
Save your Stripe webhook signing secret in MagicBell. See Stripe webhooks.
magicbell integration save_stripe \
--data '{"webhook_signing_secret":"whsec_xxx"}'Copy the ID from the response and use it to build your webhook URL:
https://api.magicbell.com/v2/integrations/stripe/webhooks/incoming/{id}Setup the webhook
- Setup a webhook in Stripe with the URL from the last step.
- Select the payout.failed event.
- If you already have a webhook configured, make sure it includes this event.
Add a workflow
Create a workflow that triggers automatically when Stripe sends this event. Use liquid templates to access fields in your workflow.
Workflow key
Use this key to trigger the workflow when Stripe sends a payout.failed:
integration.stripe.payout.failedExample workflow
Notify finance team immediately when a payout fails so they can resolve the issue.
{
"key": "integration.stripe.payout.failed",
"steps": [
{
"command": "broadcast",
"input": {
"content": "Payout of ${{payload.data.object.amount}} failed. Reason: {{payload.data.object.failure_message}}. Please update your bank account details.",
"overrides": {
"providers": {
"email": {},
"slack": {}
}
},
"recipients": [
{
"external_id": "finance-team"
}
],
"title": "⚠️ Payout failed"
}
}
]
}Save with the CLI
Use the MagicBell CLI to save this workflow to your project. You can also use the Workflows API endpoint instead.
magicbell workflow save \
--data '{"key":"integration.stripe.payout.failed","steps":[{"command":"broadcast","input":{"content":"Payout of ${{payload.data.object.amount}} failed. Reason: {{payload.data.object.failure_message}}. Please update your bank account details.","overrides":{"providers":{"email":{},"slack":{}}},"recipients":[{"external_id":"finance-team"}],"title":"⚠️ Payout failed"}}]}'Test the workflow
Use the Stripe CLI to trigger test events and verify your workflow executes correctly.
1. Trigger a test event
Use the Stripe CLI to send a test event:
stripe trigger payout.failed2. Verify the workflow ran
Check that MagicBell received the event and executed the workflow:
magicbell workflow list_runs --workflow_key integration.stripe.payout.failed3. Debug issues
If the workflow failed or you need more details, fetch the run to see step-by-step execution:
magicbell workflow fetch_run --run_id {run_id}