Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow cancellation at end of billing period #141

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mediavrog
Copy link
Contributor

see https://stripe.com/docs/subscriptions#canceling-a-customers-subscriptions

usage example:
subscription.rb

  # we want customers to use the paid subscription until the paid billing period
  def prepare_for_cancelation
    self.cancel_at_period_end = true
  end

@pcboy
Copy link
Contributor

pcboy commented Dec 15, 2015

LGTM

@le-doude
Copy link

LGTM
LGTM

👍 👎

@ACPK
Copy link

ACPK commented Jul 18, 2016

+1 @andrewculver - Is this ready to be merged?

@@ -48,7 +48,7 @@ def processing!
self.current_price = nil

# delete the subscription.
customer.cancel_subscription
customer.cancel_subscription(cancel_at_period_end ? {at_period_end: true} : {})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better to have spaces inside the brackets { at_period_end: true }.

@andrewculver
Copy link
Owner

@mediavrog Hey, sorry for the delay getting back to you on this! I see the plumbing for actually setting the flag on Stripe, but how were you keeping track of the "still active" status of the subscription in the app? Off the top of my head, even if you send this flag to Stripe, the Rails app will still see the subscription as being canceled. Am I missing something?

@kwent
Copy link

kwent commented May 24, 2020

Per https://stripe.com/docs/billing/subscriptions/cancel#events.

This PR looks safe to me since it will go through canceled webhook at this end of the billing period instead immediately. status will stay unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants