pinax / pinax-stripe-light

a payments Django app for Stripe
MIT License
684 stars 285 forks source link

reactivate subscription #626

Open maxipeli opened 5 years ago

maxipeli commented 5 years ago

Hi,

Thank you very much for this amazing library. I am trying to reactivate a cancelled subscription (the subscription period does not end yet), but I am not finding the way to do it.

I am not sure if it's a issue, or maybe this feature is not developed yet.

Thanks for your help!

Updated

I am using actions functions. My problem is that I cancel a subscription with the function 'cancel' of the actions of subscriptions, but I would like to offer to my user the possibility of enabled again the subscription, I mean put again the field 'at_period_end' to False.

KatherineMichel commented 5 years ago

It looks to me like what is happening is that the subscription is cancelled through SubscriptionDeleteView.
https://github.com/pinax/pinax-stripe/blob/master/pinax/stripe/views.py#L132 It looks as though that view calls a function in actions/subscriptions.py https://github.com/pinax/pinax-stripe/blob/master/pinax/stripe/actions/subscriptions.py#L11 I think there is an option to cancel at the end of the subscription through at_period_end or immediately. After the delete, the view is redirected to SubscriptionListView, which has the option to create or update a subscription. I don't think there is an option to reactivate. It looks like it's best to use at_period_end instead. https://github.com/pinax/pinax-stripe/blob/master/pinax/stripe/views.py#L99 There are people here with more experience with pinax-stripe than me who might have more input.

maxipeli commented 5 years ago

@KatherineMichel, thanks for your help. I have updated my issue to explain that I am not using the views.

As you said the best option seem to be to use at_period_end, but I did not see how to put again it to False. In the View to update a Subscription you can change the plan, but I was not able to see how to change any other field.

KatherineMichel commented 5 years ago

@maxipeli It looks like there is an issue related to this referenced in the recent pinax-stripe sprint. https://github.com/pinax/pinax-stripe/issues/617