Log failed Stripe charges and trigger 48-hour finance follow-ups

By General Input

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.

Integrations

  • Stripe
  • Google Sheets
  • Asana
  • Slack

Type

Deterministic Code

Categories

  • Finance
  • Operations

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.

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentLocal listing health board for every location you manageWin back LiveChat visitors whose chats went unansweredLet support send one-off Loops emails without an engineerStop cold emails to anyone with a live deal in PipedriveCustomer lifecycle inspector for Loops, Stripe and PostHogiMessage campaign console with pre-flight checks and delivery boardChat quality review board for LiveChat support leadsLinkedIn Ads budget pacing dashboard for every client accountFront desk appointment confirmation board for the next 3 days