Advertisement

Your Ad could be here. I want to connect my readers to relavant ads. If you have a product targeted at developers, let's talk. [email protected]

Here's my thought on Cancel subscriptions | Stripe Documentation


This is a handy guide to cancelling stripe subscriptions.


# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://dashboard.stripe.com/apikeys
import stripe
stripe.api_key = "sk_test_51ODvHtB26msLKqCAPBAo1qkBBuIfT5tQBX6YFWCLMsPixIExxITCRVa9tNCIqkdQS8olhR79NYXsFWBPKsM3LbGO00zEcNQfNI"

stripe.Subscription.modify(
  "sub_49ty4767H20z6a",
  cancel_at_period_end=True,
)

You can even inverse it by flipping True to False and re activate the subscription.


This post was a thought by Waylon Walker see all my thoughts at https://waylonwalker.com/thoughts