Skip to content

Monthly

Email a list of cards expiring this month

On the first of each month you get the customers whose saved cards run out before their next renewal.

Runs
Monthly
Apps
Chargebee
AI
Not needed
Access
read-only

Send this to your assistant

Create a ClickRuntime automation: on the 1st of every month at 9am, email me the Chargebee customers whose card expires this month, with their email and the card's last four 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 subscription business loses a surprising number of renewals to something nobody decided: a card on file simply reached its expiry month. The customer never chose to leave, but the Chargebee invoice fails, the dunning emails start, and some of those accounts churn quietly. Finance usually only notices when the failed-payment report grows at month end.

On the first of each month, this pulls the saved payment sources from Chargebee, sorts them by expiry date, and emails you the customers whose cards will expire before their next renewal date. You get a plain list with customer, card brand, last four digits and expiry, so there is something concrete to act on.

It is most useful for teams with annual plans or high-value accounts, where one failed renewal is a real revenue event and a friendly heads-up beats an automated dunning sequence.

What you get out of it

  • Fix cards before the charge fails

    A customer asked to update a card three weeks early does it in a calm moment. The same customer, told after a declined renewal, is already annoyed and may be mid-contract with your competitor. The earlier request costs you nothing and avoids the dunning cycle altogether.

  • Protect your largest annual renewals

    Annual plans concentrate revenue into a single charge. A list of expiring cards lets account managers personally contact the few customers whose failed payment would hurt, instead of leaving those accounts to a generic automated retry schedule.

  • Cut involuntary churn you can see coming

    Involuntary churn is the part of cancellation customers never chose. Because expiry dates are known months ahead, a monthly list turns an unpredictable loss into a short to-do list that someone can finish in an afternoon.

  • Spread the work across the month

    Checking cards once a month keeps the workload small and regular. Rather than a panic when failures pile up on the first of the month, support sends a handful of notes each cycle and the queue never builds.

  • Give finance fewer failed payments to explain

    When fewer renewals fail, the month-end reconciliation has fewer exceptions to chase. Finance can compare each month's expiring-card list against later failures and see how well the outreach actually worked. Comparing each month's list with later failures tells you whether the early outreach is really paying off.

How it works

What happens, step by step

  1. Once a month, ClickRuntime looks in Chargebee for customer cards that expire this month.

  2. It collects the customer email and the last four digits of each card.

  3. You get an email with the number of cards and a line for each customer with the last four digits of their card, so you can ask them to update it before a payment fails.

Before it runs live

  • Connect Chargebee

What you get

RunsMonthly
Email a list of cards expiring this monthtoday, 9:00Succeeded
Email · Cards expiring3 cards expire this month - billing@northwind.example: card ending 4242

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 Chargebee 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.
expiring_card_reminder.pyexample
from datetime import date
from clickruntime import on_trigger, credentials, http, notify

SITE = "yourcompany"  # yourcompany.chargebee.com

@on_trigger
def run(event):
    api, auth = f"https://{SITE}.chargebee.com/api/v2", (credentials.secret("CHARGEBEE_API_KEY"), "")
    today = date.today()
    expiring, offset = [], None
    while True:
        params = {"type[is]": "card", "status[is]": "valid", "limit": 100, **({"offset": offset} if offset else {})}
        body = http.get(f"{api}/payment_sources", auth=auth, params=params).json()
        for row in body["list"]:
            card = row["payment_source"]["card"]
            if card["expiry_year"] == today.year and card["expiry_month"] == today.month:
                expiring.append((row["payment_source"]["customer_id"], card["last4"]))
        offset = body.get("next_offset")
        if not offset:
            break
    lines = []
    for customer_id, last4 in expiring:
        customer = http.get(f"{api}/customers/{customer_id}", auth=auth).json()["customer"]
        lines.append(f"- {customer.get('email', customer_id)}: card ending {last4}")
    if lines:
        notify.email_me(f"{len(lines)} cards expire this month", "\n".join(lines))
    return {"expiring": len(lines)}

FAQ

Common questions

Does it include cards that already expired?
It is built around cards expiring this month and before their next renewal, so it looks ahead. Cards that have already expired will usually surface through Chargebee's own failed-payment flow, which you can cover with a separate payment failure alert.
Which Chargebee permissions does it need?
It needs an API key that can read customers and their payment sources. Read-only access is enough, because the automation only lists cards and sends an email. The key is stored as a secret and never appears in the email or the logs.
Will customers receive the email directly?
The email goes to the address you choose, such as a support or finance inbox, so a person reviews the list first. If you want customers contacted automatically, tell your AI assistant and the extra step waits for your yes before anything is sent.
What permissions does it need?
read-only. 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 (monthly). 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 a list of cards expiring this month” from your assistant

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