A cancel flow on Stripe is three pieces: a place that catches the cancel click, an offer step, and a webhook that tells your app whether the cancellation was scheduled, stopped or finished. Set cancel_at_period_end to true so the subscriber keeps what they paid for, and revoke access only when customer.subscription.deleted arrives.
Cancel at period end, not immediately
By default, cancelling a subscription through the API takes effect immediately and no more invoices are generated. To let the subscriber keep the period they already paid for, update the subscription with cancel_at_period_end=true .
Schedule it: set cancel_at_period_end to true . Stripe sends customer.subscription.updated .
Offer something (optional): the subscriber is still active, so there is time to show an offer and apply it.
Stop it: set cancel_at_period_end to false any time before the period ends. Stripe sends customer.subscription.updated again.…