On a schedule
Email me customers whose cards expire this month
On the 1st of each month, an email lists Stripe customers with an active subscription whose saved card expires this month, so they can be asked to update it before a payment fails.
- Runs
- On a schedule
- Apps
- Stripe
- AI
- Not needed
- Access
- API key (read)
Send this to your assistant
Create a ClickRuntime automation: on the 1st of every month, email me Stripe customers with an active subscription whose default card expires this month, with their email, card brand and last 4 digits.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A card that expires is the most common reason a loyal customer's renewal fails. The customer did not mean to leave, and they often never see Stripe's failed-payment email.
On the first of each month, this automation finds subscribers whose saved card expires that month and emails you the list. You can reach out early, or keep an eye on those accounts when renewal day comes.
It reads subscriptions and payment methods only, so it fits alongside any dunning settings you already use in Stripe.
What you get out of it
Prevent failed payments
You hear about expiring cards before a renewal fails.
A short list
Only active subscribers with a card expiring this month are listed.
Right card checked
It looks at the card the subscription will actually charge.
Your choice of follow-up
Email the list yourself, or add a customer reminder later.
Read only
Nothing in Stripe is changed.
How it works
What happens, step by step
On the 1st of each month, ClickRuntime lists your active Stripe subscriptions.
For each, it looks at the card that will be charged: the subscription's own card, or the customer's default.
It keeps the cards whose expiry month and year are this month.
You get an email with each customer's email, card brand, last 4 digits and plan.
Before it runs live
- Connect Stripe
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
- Run it at a different time, more or less often, or only on weekdays
- Add an AI step, for example to summarize, sort or draft a reply
- Add another app, for example also send it to Slack
- Combine it with other Stripe steps into one automation
Under the hood
The code that runs this automation
import stripe
from datetime import date
from clickruntime import on_trigger, credentials, notify, report_fetched
@on_trigger
def run(event):
stripe.api_key = credentials.secret("STRIPE_API_KEY")
today = date.today()
found = []
for sub in stripe.Subscription.list(status="active", limit=100,
expand=["data.default_payment_method", "data.customer"]).auto_paging_iter():
pm = sub.default_payment_method
if not pm:
pm_id = sub.customer.invoice_settings.default_payment_method
pm = stripe.PaymentMethod.retrieve(pm_id) if pm_id else None
if not pm or pm.type != "card":
continue
if pm.card.exp_month == today.month and pm.card.exp_year == today.year:
plan = sub["items"]["data"][0]["price"].get("nickname") or sub["items"]["data"][0]["price"]["id"]
found.append(f"- {sub.customer.email} · {pm.card.brand.title()} ••{pm.card.last4} · {plan}")
report_fetched(len(found))
if found:
notify.email_me(f"{len(found)} subscribers' cards expire in {today:%B}", "\n".join(found))
return {"expiring": len(found)}FAQ
Common questions
Doesn't Stripe update expired cards automatically?
Does it email the customers?
What about customers paying by bank debit?
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
Get yesterday's revenue every morning
Each morning you see yesterday's charges, refunds and new subscriptions in one message.
See how it worksGet a monthly revenue report
On the 1st you get last month's gross, refunds, net and new vs cancelled subscriptions, compared with the month before.
See how it worksSee overdue invoices every week
Each Monday you get open invoices past their due date, oldest first.
See how it worksKeep exploring
Set up “Email me customers whose cards expire this month” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.