Skip to content

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.

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

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

  1. On the 1st of each month, ClickRuntime lists your active Stripe subscriptions.

  2. For each, it looks at the card that will be charged: the subscription's own card, or the customer's default.

  3. It keeps the cards whose expiry month and year are this month.

  4. 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

RunsOn a schedule
Email me customers whose cards expire this monthtoday, 9:00Succeeded
Email · 7 subscribers' cards expire in November- jo@wildfern.co · Visa ••4242 · Pro monthly - accounts@tallyhouse.com · Mastercard ••5100 · Team annual - ben@quietharbor.io · Amex ••0005 · Starter ...

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

  • 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

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.
email_me_customers_whose_cards_expire_this_month.pyexample
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?
Often it does, through the card networks' updater service, but not for every bank or card type. This list shows who could still fail, and you can check it again later in the month.
Does it email the customers?
No. It emails you the list. If you want customers to get a polite update-your-card email, ask your assistant to add that step.
What about customers paying by bank debit?
Only card payment methods have an expiry date, so bank debits and other methods are skipped.
What permissions does it need?
API key (read). Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it runs (on a schedule). Checks that find nothing to do and stop right away aren't counted.
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 “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.