Recover failed Stripe payments with personalized Resend emails
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
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.
What it does
- Catches every failed Stripe charge the moment it happens and kicks off a recovery touch automatically.
- Reads each customer's plan, signup date, and decline reason so the email matches the situation: softer for long-tenured loyal customers, more direct for repeat failures.
- Sends the recovery email from your verified Resend domain with a clear link for the customer to update their payment method.
- Posts a one-line heads-up to your revenue or finance Slack channel so the team knows who got dunned without digging through Stripe.
What you’ll need
- A Stripe account with admin access so you can point the failed-payment webhook at this workflow.
- A Resend account with a verified sending domain and an address you want to send from.
- A Slack workspace and the channel where you want revenue alerts to land.
How to customize it
- Choose which address on your verified Resend domain the email comes from.
- Pick the Slack channel where the revenue heads-up should be posted.
- Tune the tone rules, like what counts as a loyal customer or a repeat failure, so the copy fits how you talk to your customers.
Use cases
- Notifications & Alerts
- Email Automation