Log failed Stripe charges and trigger 48-hour finance follow-ups
Capture every failed Stripe charge in a Google Sheet, open a 48-hour Asana task, and ping the finance team in Slack so dunning never slips.
Build a code workflow that watches Stripe for failed charges, logs them to a Google Sheet, creates a 48-hour follow-up task in Asana, and posts a rollup alert to the finance team in Slack. It should run on a schedule (every hour) so we never let a failed charge sit unaddressed.
On each run, call Stripe List Charges and filter for charges where status equals failed and created falls inside the lookback window (last hour, with a small overlap to avoid gaps). For each failed charge, capture the charge ID, customer ID and email, amount in dollars, currency, failure_code, failure_message, and the charge timestamp.
Append one row per new failed charge to a Google Sheet I will pick during setup, with columns: timestamp, charge_id, customer_email, customer_id, amount, currency, failure_code, failure_message, asana_task_url, status. Before writing, read existing charge_ids from the sheet (or keep a small state store) and skip any charge that has already been logged so the same failure is never duplicated.
For each new failed charge, create an Asana task in a project I will pick during setup. Title it "Follow up on failed charge: <customer_email> ($<amount>)". Put the failure reason, charge ID, customer ID, and a link to the Stripe dashboard charge page in the task description. Set the due_on date to 48 hours from now and assign it to the finance owner I configure. After creating the task, write its URL back into the asana_task_url column for that row.
After the Sheets and Asana writes finish, post a single rollup message to the finance Slack channel. Include the count of new failed charges, the total dollar amount at risk, a short bulleted list of the top failures (customer, amount, reason), a link to the Google Sheet, and a link to the Asana project view. If there are zero new failures on a given run, do not post anything.
Handle the obvious edge cases: paginate Stripe results if there are more than 100 failed charges in the window, retry transient 5xx errors with backoff, and if Sheets or Asana fails for one charge, keep going on the others and surface the error in the Slack message so finance knows to reconcile manually.
Additional information
What does this prompt do?
- Pulls failed Stripe charges from the last run window and writes one row per charge to a Google Sheet (customer, amount, failure reason, charge ID, timestamp).
- Creates an Asana task for each failed charge with a due date 48 hours out, assigned to the finance owner.
- Posts a single rollup alert to the finance Slack channel summarizing how many charges failed, total dollars at risk, and links to the sheet and tasks.
- Skips charges that have already been logged so the same failure is never written or alerted on twice.
What do I need to use this?
- A Stripe account with a secret API key (sk_live_ for production).
- A Google account with edit access to the destination Google Sheet.
- An Asana workspace with a project where finance follow-up tasks should land, and the assignee user.
- A Slack workspace and the channel ID where the finance team should be notified.
How can I customize it?
- Change the polling cadence (default hourly) and the due-date offset (default 48 hours) to match your dunning policy.
- Adjust the columns written to Google Sheets, or split high-value failures into a separate sheet or Slack channel.
- Swap Asana for Linear, ClickUp, Jira, or Microsoft Planner if your finance team tracks work elsewhere.
Frequently asked questions
How does the workflow know a charge failed?
Why 48 hours for the follow-up deadline?
Will this double-log the same failed charge if the workflow runs again?
Can I route failures to different owners based on amount or plan?
Does this work with Stripe test mode?
Stop letting failed Stripe charges fall through the cracks.
Connect Stripe, Google Sheets, Asana, and Slack once, and Geni logs every failure, opens a 48-hour task, and alerts finance automatically.