Recover failed Stripe payments with personalized Resend emails

By General Input

When a Stripe invoice payment fails, send a tailored recovery email through Resend with a one-click payment update link, then alert your revenue team in Slack.

Integrations

  • Stripe
  • Resend
  • Slack Bot

Type

Agentic Task

Categories

  • Finance
  • Operations

Build me a failed-payment recovery workflow that runs as an agent.

Trigger: incoming webhook from Stripe on the invoice.payment_failed event (and optionally charge.failed). I will register the webhook in Stripe to point at this workflow's URL.

When the webhook fires, the agent should:

1. Use Stripe's Retrieve Invoice operation to pull the failed invoice and get the amount due, currency, invoice ID, attempt count, next payment attempt time, decline reason, and hosted invoice URL.

2. Use Stripe's Retrieve Customer operation with the customer ID from the invoice to get the customer's email, name, and signup date.

3. If the invoice is tied to a subscription, use Stripe's Retrieve Subscription operation to get the plan or price tier and how long they have been subscribed.

4. Decide the tone of the email based on tenure and history: softer and apologetic for long-tenured customers on a first failure, more direct and businesslike for repeat failures or very new accounts.

5. Draft a customer-appropriate recovery email that references their plan, the failed amount in the correct currency, and the decline reason in plain language. Include a clear call-to-action link for them to update their payment method, using the Stripe hosted invoice URL (or a billing portal link if one is configured).

6. Send the email using Resend's Send Email operation from a configurable from address on my verified Resend domain. Set the Idempotency-Key header to a value derived from the invoice ID and attempt count, for example recovery-{invoice_id}-{attempt_count}, so retries of the same event do not produce duplicate sends.

7. Post a short one or two line heads-up to a configurable Slack channel using the Slack Bot's Send a Message operation. Include the customer name, plan, failed amount, decline reason, and a link to the invoice in Stripe.

Deduplication: do not email the customer or post to Slack twice for the same invoice ID and attempt count combination. Use that pair as the dedupe key.

Make the Slack channel and the Resend from address configurable inputs when I set up the workflow.

Related prompts

Explore more prompts
Let support send one-off Loops emails without an engineerA brand asset library your marketing team actually searchesTurn Mailjet email clicks into ranked HubSpot follow-upsClean out the Looker dashboards and Looks nobody opensLiveKit live operations console for room moderationWake up dormant Keap leads with a researched reasonCustomer lifecycle inspector for Loops, Stripe and PostHogLiveChat coverage board for planning next week's shiftsPhone routing control panel for LiveKit voice agentsLinkedIn Ads budget pacing dashboard for every client account