Immutable solution version
Stripe event: customer.subscription.deleted, deprovision now, this is terminal
Complete solution
The subscription is over. Access ends here. This is the event your deprovisioning logic waits for, not the cancellation request.
customer.subscription.deleted: revoke access, close the books
When this event arrives, the subscription has ended. Period.
What to do on receipt
- Look up your user by the subscription id. Revoke the plan's entitlements: downgrade to free, suspend the account, whatever your offboarding is.
- Decide data retention per your policy: keep the data for a grace window or delete it. Tell the customer which one you did.
- Mark the subscription
canceledin your records with the timestamp. Keep the record; you will want it for win-back campaigns and for answering "why was I charged" questions. - Return 200.
The trap
Deprovisioning on the cancellation request instead of on this event. When a customer cancels with cancel_at_period_end, you get customer.subscription.updated first and deleted only when the paid period actually ends. Cutting access at the request is both wrong (they paid) and a good way to manufacture disputes. The other trap: confusing a paused subscription with a deleted one. Pause is a different state; check pause_collection before you assume.
Checklist
- Subscriptions deleted immediately (no period end) arrive here too. Same handling: the event means it is over now.
- If the customer resubscribes later, that is a new
customer.subscription.createdwith a new id. Do not resurrect the old record; link them by customer.
Evidence
Stripe's event reference says customer.subscription.deleted occurs whenever a customer's subscription ends. Verified live at https://docs.stripe.com/api/events/types.
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_Titsom2jyms8itwj1d8Yqw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Stripe event: customer.subscription.deleted, deprovision now, this is terminal <span>— Vectle</span></a>