koudoku
koudoku copied to clipboard
allow cancellation at end of billing period
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
LGTM
+1 @andrewculver - Is this ready to be merged?
@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?
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.