Skip to content

The moment it happens

Win back failed payments with a friendly email

When a card fails, the customer gets a short note from you with a link to pay, and a reminder three days later if it's still unpaid.

Runs
The moment it happens
Apps
Gmail, Stripe
AI
Optional
Access
Stripe read; gmail.send

Send this to your assistant

Create a ClickRuntime automation: when a Stripe payment fails, email the customer from Gmail with a link to update their card, and remind them again in 3 days if the invoice is still unpaid.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

Most failed subscription payments are not customers leaving. They are expired cards, bank blocks and new card numbers nobody remembered to update. Stripe's automated emails help, but they look like system mail and are easy to ignore, and a customer who never fixes their card is lost as surely as one who cancelled.

This automation sends a short, personal email from your own Gmail address when a payment fails, with the link to pay the invoice. It remembers the invoice and checks again three days later; if it is still unpaid, a gentle reminder goes out. A friendly note from a real person recovers revenue that would otherwise slip away quietly.

What you get out of it

  • More failed payments recovered

    A personal email from your address gets more attention than an automated notice.

  • A follow-up you don't have to remember

    Unpaid invoices get a reminder three days later without anyone tracking them.

  • Paid invoices are left alone

    The reminder is skipped if the customer has already paid, so nobody is chased unnecessarily.

  • A tone that fits your business

    AI can write each email in your voice, mentioning the plan and amount.

  • Replies reach you

    Customers who reply with a problem land in your inbox, where you can help them directly.

How it works

What happens, step by step

  1. When a payment fails, Stripe tells ClickRuntime straight away, and the message is checked to be genuinely from Stripe.

  2. AI writes a short, friendly email with the amount and the link to pay, and it is sent from your Gmail.

  3. The invoice is remembered with a reminder date three days ahead.

  4. On each scheduled check, invoices that are due are looked up again; still-unpaid ones get a reminder and paid ones are dropped.

Before it runs live

  • Connect Google through your own Google app (a one-time, 10-minute setup), so it works with your own Gmail
  • Connect Stripe
  • Paste your automation's link into the other app's webhook settings

What you get

RunsThe moment it happens
Win back failed payments with a friendly emailjust nowSucceeded
Email · Sent to customerHi Alex, your payment of 29.00 USD for the Team plan didn't go through. You can update your card here: https://invoice.stripe.com/i/acct_ex/inv_ex

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Act only on the items that match your own rules, and skip the rest
  • Change what the AI looks for, or how it writes the result
  • Add another app, for example also send it to Slack
  • Combine it with other Gmail and Stripe steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
recover_failed_payments_by_email.pyexample
import base64, time
from email.message import EmailMessage
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
import stripe
from clickruntime import on_event, on_trigger, credentials, verify, state, ai

def send(to, subject, text):
    msg = EmailMessage(); msg["To"], msg["Subject"] = to, subject; msg.set_content(text)
    g = build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
    g.users().messages().send(userId="me", body={"raw": base64.urlsafe_b64encode(msg.as_bytes()).decode()}).execute()

@on_event
def handle(event):
    if not verify.stripe(event.body, event.header("Stripe-Signature"), credentials.secret("STRIPE_WEBHOOK_SECRET")):
        return {"ignored": "bad signature"}
    inv = event.json["data"]["object"]
    send(inv["customer_email"], "Your payment didn't go through", ai.generate(f"Write a short, friendly email asking the customer to update "
         f"their card. Amount: {inv['amount_due'] / 100:.2f} {inv['currency'].upper()}. Link: {inv['hosted_invoice_url']}", max_output_tokens=250).text)
    state.set("pending", {**(state.get("pending") or {}), inv["id"]: time.time() + 3 * 86400})
    return {"emailed": inv["id"]}
@on_trigger
def remind(event):
    stripe.api_key, pending = credentials.secret("STRIPE_API_KEY"), state.get("pending") or {}
    for inv_id in [i for i, due in pending.items() if due <= time.time()]:
        inv = stripe.Invoice.retrieve(inv_id); pending.pop(inv_id)
        if inv.status == "open":
            send(inv.customer_email, "Reminder: payment still due", f"A quick reminder that your invoice is still open: {inv.hosted_invoice_url}")
    state.set("pending", pending)
    return {"waiting": len(pending)}

FAQ

Common questions

What link does the customer get?
Stripe's hosted invoice page for the failed invoice, where they can pay with a new card. No login is needed.
How many reminders are sent?
One email when the payment fails and one reminder three days later if it is still unpaid. You can change the gap or add a second reminder.
Will it clash with Stripe's own retry emails?
It can run alongside them. Many businesses switch Stripe's failed-payment emails off once this is running so customers only hear from them once.
What permissions does it need?
Stripe read; gmail.send. Nothing else in your accounts is used.
Does it need AI?
No, but you can ask for an AI step (for example a summary). It then uses ClickRuntime's built-in AI allowance.
How many runs does it use?
One run for each event the app sends.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Win back failed payments with a friendly email” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.