Route failed Stripe payouts to the finance team
Failed Stripe payouts become Linear finance issues with a Slack handoff, so the people responsible can investigate without watching the Stripe dashboard all day.
Integrations used in this example
Put the failed transfer in a finance queue
When Stripe reports a failed payout, the automation fetches that payout's current status and failure details. It creates a high-priority Linear issue in a finance team you choose, then posts the issue link to Slack. The issue includes the payout ID, failure code and message when Stripe supplies them, amount in the smallest currency unit, and the event ID.
The finance owner checks the payout and bank details in Stripe before taking action. This workflow assigns the investigation; it cannot repair a bank account, clear a Stripe restriction, or retry the payout.
The merchant said payouts had failed for an entire week, including future scheduled payouts, and was still trying to understand the cause.Source: A merchant's week of failed Stripe payouts on Reddit
What you'll tell the agent
- The Linear team that handles payout and bank investigations.
- The Slack conversation where finance should see urgent issues.
- Account authorization.
The agent will create the project and ask you for these details. When Automate.ax asks you to connect an account, authorize the integrations you want this workflow to use.
The agent will create the Automate.ax project and help find your Linear team and Slack conversation IDs after account authorization. A restricted Stripe key needs Account and Payouts read plus Webhook Endpoints write access. Automate.ax currently requires a paid Slack workspace connection.
The automation
The Stripe failure event supplies the payout ID. The automation retrieves the payout, writes a Linear issue with the current details, and posts its link to Slack.
import { automation, t } from "automate.ax"
import { linear } from "automate.ax/linear"
import { slack } from "automate.ax/slack"
import { stripe } from "automate.ax/stripe"
export default automation(
"Give failed Stripe payouts a finance owner",
{
parameters: [
{ label: "Finance Linear team ID", name: "financeTeamId", type: "text" },
{
label: "Finance Slack conversation ID",
name: "financeConversationId",
type: "text",
},
],
},
({ parameters }) => {
const failure = stripe.onPayoutFailed()
const payout = stripe.getPayout({ payoutId: failure.data.object.id })
const details = payout.transform(
({ id, amount, currency, status, failureCode, failureMessage }) => ({
id,
amount,
currency: currency.toUpperCase(),
status,
failureCode: failureCode ?? "Not supplied",
failureMessage: failureMessage ?? "Not supplied",
}),
)
const issue = linear.createIssue({
teamId: parameters.financeTeamId,
title: t`Investigate failed Stripe payout ${details.id}`,
description: t`Stripe payout: ${details.id}\nCurrent status: ${details.status}\nAmount in the smallest currency unit: ${details.amount} ${details.currency}\nFailure code: ${details.failureCode}\nFailure message: ${details.failureMessage}\nStripe event: ${failure.id}\nReview the payout and bank details in Stripe. Do not retry it until the cause is understood.`,
priority: 2,
})
slack.sendMessage({
conversation: parameters.financeConversationId,
text: t`Stripe payout ${details.id} failed. Finance review: ${issue.url}. Check Stripe for the current status before taking action.`,
})
},
)
What a run looks like
Example input
Stripe reports payout po_123 failed and returns a bank-related failure code on retrieval.
Expected result
Finance gets a Linear issue with po_123, the returned status and failure code, and a Slack link to the issue. The payout is not retried.
Set it up
- Copy the setup prompt at the top into your coding agent.
- Choose the finance Linear team and Slack conversation. The agent can look up their IDs after you connect the accounts.
- Review who will own new issues in the Linear team. This example assigns the team but does not choose a person or change Stripe payout settings.
- Authorize the accounts, deploy, and test against a Stripe test event or approved fixture before relying on the handoff.
Check the result
Trigger a Stripe test payout-failed event or use a test fixture. Compare the payout ID, current status, failure details, event ID, and amount in Linear with Stripe; confirm Slack links to the issue. Do not create a real bank failure for a test.
Where this workflow stops
- A failure code or message may be absent. The issue says Not supplied instead of guessing at the cause.
- The amount is shown in Stripe's smallest currency unit, not formatted as a bank statement amount. Confirm the currency and value in Stripe.
- The issue is not a payout retry or bank-account repair. Stripe's status may change after the alert, so the owner should check it again.
- Repeated failures for one payout can create more than one issue. Add payout-level deduplication if that happens in your account.
Common questions
Will this retry the payout?
No. It gives finance a current payout snapshot and an issue to investigate. A person decides what to do in Stripe.
Does Slack include the bank account details?
No. Slack receives the payout ID and Linear issue link. Sensitive payout and bank details stay in Stripe.