Send a Stripe failed payment recovery email automatically

When a Stripe charge fails, send the customer a short, plain-English email that explains what happened, how to fix it, and when Stripe will retry.

Agentic Task
StripeSend EmailFinanceCustomer SupportEmail AutomationNotifications & Alerts

Build me an agent workflow that automatically sends a recovery email to any customer whose Stripe invoice payment fails.

Trigger: an incoming webhook from Stripe on the invoice.payment_failed event. The workflow should fire the instant Stripe delivers the event, not on a schedule.

When the webhook fires, the agent should:

1. Call Stripe Retrieve Invoice using the invoice id from the webhook payload. Pull the amount due, currency, attempt_count, next_payment_attempt, the hosted_invoice_url (the one-click link the customer uses to update their card and pay), the customer id, and any subscription context (subscription id, plan or product name if available).

2. Call Stripe Retrieve Customer using that customer id to get the customer's name and email address.

3. Draft a short HTML email body. The tone should sound like billing operations, not marketing. No exclamation points, no growth language, no upsell. Keep it under 150 words. Include:

- A clear one-line subject like "Action needed: your payment to {Company} did not go through".

- A greeting using the customer's first name when available, otherwise their full name.

- A plain sentence stating what failed: the amount (formatted nicely from cents, with currency), the invoice or subscription it was for, and the date the charge was attempted.

- A single, prominent call to action button or link pointing to the hosted_invoice_url so the customer can update their card in one click.

- A sentence telling the customer when Stripe will automatically retry (use next_payment_attempt; format as a human-readable date).

- A short sign-off pointing to a billing contact email for replies (the no-reply sender address cannot receive replies).

4. Adjust tone based on attempt_count. For early attempts (1 or 2), keep the message calm and operational: "this happens, here's the fix, no action needed beyond updating your card." If this is the final retry (Stripe will not attempt again, i.e. next_payment_attempt is null or attempt_count indicates the last try), switch to a more urgent framing: "this was the final retry. If your card is not updated, your subscription or service will be paused on {date}." Make the urgency unmistakable but still professional.

5. Use Send Email to deliver the HTML message to the customer's email address. The subject line, body, and recipient should all be set by the agent based on the retrieved Stripe data.

Guardrails: if the invoice has already been paid by the time the webhook is processed (status is paid), or the customer has no email on file, skip sending and log why. Format all currency amounts using the invoice's currency, never assume USD. Always link the customer to Stripe's hosted_invoice_url, never construct your own payment URL.

Additional information

What does this prompt do?
  • Catches every failed invoice payment in Stripe the moment it happens.
  • Pulls the customer's name, email, amount due, retry attempt number, and next retry date from Stripe.
  • Drafts a short, operational recovery email that tells the customer what failed, what's affected, and how to update their card.
  • Escalates to an urgent service-pause warning automatically on the final retry attempt.
What do I need to use this?
  • A Stripe account with permission to read invoices and customers.
  • A verified billing or operations email address you want the recovery messages to come from in the customer's eyes.
How can I customize it?
  • Tweak the tone or wording of the email so it matches your brand voice.
  • Adjust the urgency thresholds, like switching to the service-pause message on the third attempt instead of the final one.
  • Add internal cc or bcc recipients so your finance or success team gets a copy of every recovery email.

Frequently asked questions

When does this email actually send?
The moment Stripe reports that a customer's invoice payment failed. There is no batching or daily digest. Every failed charge gets its own recovery email.
Does the email change based on the retry attempt?
Yes. Early attempts read like a calm operational nudge. On the final retry, the message switches to a more urgent tone warning that service will be paused if the card is not updated.
Will this email feel like spam to my customers?
It should not. The tone is written to sound like a billing operations note, not a marketing campaign. It focuses on the facts of the failed charge and the one action the customer needs to take.
Can I send the recovery email from my own domain?
Today the email is sent from a General Input no-reply address. You can include your brand name in the subject line and signature, and reference your billing contact for replies.
What if the same customer fails multiple invoices?
Each failed invoice triggers its own email with the specific amount, attempt number, and retry date for that invoice. The agent does not deduplicate across invoices.

Stop losing revenue to failed cards you never followed up on.

Connect Stripe once, and Geni sends a clean recovery email to every customer whose payment fails, the moment it fails.