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.
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
When a payment fails, Stripe tells ClickRuntime straight away, and the message is checked to be genuinely from Stripe.
AI writes a short, friendly email with the amount and the link to pay, and it is sent from your Gmail.
The invoice is remembered with a reminder date three days ahead.
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
Build your own
Need it to work differently?
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
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?
How many reminders are sent?
Will it clash with Stripe's own retry emails?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Email buyers their product and receipt after a Stripe payment
As soon as someone pays, they get their download link and a receipt from your own Gmail address.
See how it worksCheck VAT numbers on Stripe invoices and email the right person
When Stripe drafts an invoice, an invalid VAT number is flagged to finance; when it's finalised, the customer gets an email from you.
See how it worksAsk cancelling customers why, and get a weekly churn summary
Customers who cancel get one personal question by email, their replies are sorted by reason, and you get a weekly summary.
See how it worksKeep exploring
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.