On a schedule
Email me Stripe subscriptions renewing next week
Every Monday, an email lists the Stripe subscriptions that renew in the next 7 days, with the amount each will be charged and the customer's email.
- Runs
- On a schedule
- Apps
- Stripe
- AI
- Not needed
- Access
- API key (read)
Send this to your assistant
Create a ClickRuntime automation: every Monday at 9, email me the Stripe subscriptions renewing in the next 7 days, with the customer's email, the amount they'll be charged and the renewal date; put annual plans first.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Annual renewals are where a lot of churn and a lot of surprise refunds come from. The customer forgot they signed up a year ago, the card on file has changed, or their finance team needs an invoice in advance.
This automation emails you every Monday with the subscriptions that renew in the coming week, annual plans first, so you can send a heads-up, check the card or prepare an invoice before the charge runs.
It also gives a simple forecast of the cash coming in from renewals over the next seven days.
What you get out of it
No surprise charges
Customers on annual plans can get a reminder from you before they are billed.
Fewer refund requests
A heads-up before renewal heads off "I forgot I had this" emails.
A cash forecast
The total shows what renewals should bring in this week.
Skips cancellations
Subscriptions already set to cancel are not counted.
Read only
Nothing in Stripe is changed.
How it works
What happens, step by step
Every Monday morning, ClickRuntime lists your active Stripe subscriptions.
It keeps the ones whose current period ends in the next 7 days.
It works out the renewal amount from each subscription's prices and quantities.
You get one email with annual renewals first, then monthly ones, and a total.
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 time
import stripe
from datetime import datetime, timezone
from clickruntime import on_trigger, credentials, notify, report_fetched
@on_trigger
def run(event):
stripe.api_key = credentials.secret("STRIPE_API_KEY")
now, cutoff = time.time(), time.time() + 7 * 86400
rows = []
for sub in stripe.Subscription.list(status="active", limit=100, expand=["data.customer"]).auto_paging_iter():
items = sub["items"]["data"]
end = items[0]["current_period_end"] if "current_period_end" in items[0] else sub.get("current_period_end")
if sub.cancel_at_period_end or not (now <= end <= cutoff):
continue
amount = sum((i["price"]["unit_amount"] or 0) * (i.get("quantity") or 1) for i in items) / 100
rows.append((items[0]["price"]["recurring"]["interval"], end, sub.customer.email, amount, sub.currency.upper()))
report_fetched(len(rows))
if not rows:
return {"renewals": 0}
fmt = lambda r: f"- {datetime.fromtimestamp(r[1], timezone.utc):%a %d %b} · {r[2]} · {r[3]:,.2f} {r[4]}"
annual = sorted((r for r in rows if r[0] == "year"), key=lambda r: r[1])
other = sorted((r for r in rows if r[0] != "year"), key=lambda r: r[1])
total = sum(r[3] for r in rows)
body = ("Annual:\n" + ("\n".join(map(fmt, annual)) or "- none") +
f"\n\nMonthly and other ({len(other)}):\n" + ("\n".join(map(fmt, other)) or "- none") +
f"\n\nTotal: {total:,.2f} {rows[0][4]}")
notify.email_me(f"{len(rows)} Stripe renewals next week, {total:,.2f} {rows[0][4]}", body)
return {"renewals": len(rows)}FAQ
Common questions
Are subscriptions set to cancel left out?
Does the amount include discounts and tax?
I bill in several currencies. Is the total still right?
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 Stripe subscriptions renewing next week” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.