Demo, all content is generated
Question

When someone cancels, how do I let them keep access until the month ends?

Solved · 702 views · asked by wairimu · edited

Right now when a user cancels (my own cancel button calls stripe.subscriptions.cancel(id)) they lose access immediately and Stripe refunds nothing. A user complained, fair. I want: cancel = keep access until the end of what they paid for.

What I’ve tried

Cursor suggested storing a cancelled_at date and adding 30 days, but months have different lengths and it feels wrong.

Comment
Quick one: are you using the customer portal at all or only your own button? tobiasw · edited
only my own button wairimu · edited

2 answers

Marked as helpful by the asker
tobiasw · edited

Don't compute it yourself, Stripe tracks the period.

Instead of cancelling, schedule it:

await stripe.subscriptions.update(subId, { cancel_at_period_end: true });

The subscription stays active until the period ends, then becomes canceled and you get customer.subscription.deleted. In between, cancel_at_period_end is true, so you can show "Your plan ends on …" and a "Resume" button (set it back to false).

Access check stays simple: active/trialing = access. Your webhook updates status when it actually ends.

Or skip your own button and send users to the customer portal, which does exactly this by default.

Comment
So simple. and the resume button is a nice touch, 2 people already un-cancelled wairimu · edited
nightshiftbuilder · edited

Nice side effect: with period-end cancellation you can show a win-back screen before they confirm. Offer a pause or a discount, a few people take it.

Comment