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

Using django-plans with recurring payments #64

Open
amitjindal opened this issue Dec 20, 2017 · 8 comments
Open

Using django-plans with recurring payments #64

amitjindal opened this issue Dec 20, 2017 · 8 comments

Comments

@amitjindal
Copy link

Hi, thanks for a great module. I installed and played with the demo and this works beautifully with what I am trying to do. However I need this for a subscription model where someone who is in a plan is on monthly or yearly payments. So I need to generate invoices for that on the same frequency.

Is there a built-in way to handle such payments?

Thanks
Amit

@cypreess
Copy link
Collaborator

cypreess commented Dec 20, 2017

@amitjindal Let me maybe describe what was the architectural idea behind django-plans and then you will be able to answer yourself if this fits your needs.

In django-plans each user has object UserPlan that describes which type of plan did he purchased and what is the expiration date of this plan. System is automatically checking when this expiration date happens and sends some mailing before. User is asked to manualy create new order for next period, this will generate Order Confirmation document, and then once paid user gets updated UserPlan with additional expiration time.

There is one extra thing, django-plans have also support different periods for plans, so you can define anything you want like 30 days or 365 days plan extend.

At this moment there is no support for automatic subscriptions, however I can easily see how this could be implemented as some feature. Here are my tips:

  • I would add a field to UserPlan automatic_renewal = True/False
  • I would add a field to PlanPricing definiton default_for_automatic_renewal=True/False
  • Add setting PLANS_AUTOMATIC_RENEWAL=True/False that would set the default state of the field in UserPlan when new user is created.

And then I would add an extra logic that when it sees that account is just going to be expired it first checks what kind of account it is (automatic renewal off or on) and then decide if its off - send email reminding customer to pay manualy, if its on it will search for PlanPricing matching user's current Plan that have attribute default_for_automatic_renewal=True.

That should do the trick and still be as flexible as possible.

@amitjindal
Copy link
Author

@cypreess Awesome. Thank you so much. I will try to figure this out and ask if I need help. I am also making changes to handle multi-tenant support since you use User objects in models and in multitenant the user is not in shared database.

Really appreciate your quick reply and help.

Regards
Amit

@Alir3z4
Copy link
Collaborator

Alir3z4 commented May 18, 2018

@amitjindal were you able to get anywhere with this ?
Would love to know if you could get it done

@amitjindal
Copy link
Author

amitjindal commented May 19, 2018

@Alir3z4 Nope. I didn't end up completing this and its still on back burner. It seemed much more complex to handle multi-tenancy with this.

However I do home to get back to this sometime soon.

@Alir3z4
Copy link
Collaborator

Alir3z4 commented May 19, 2018

Oh, I see.
Thanks for letting us know about the result.

I leave this issue open for future discussion and possible implementation of this future.

@anuj9196
Copy link

#100 This pull has added is_recurring flag to mark orders as recurring and one can easily use this field to do tasks accordingly.

@PetrDlouhy
Copy link
Collaborator

Hi,

I started with experimental implementation of recurring payments with the django-paypal.
I have written the code in the django-plans-paypal as connector to the django-plans.

Currently it doesn't need any support from the django-plans to have basic functionality. It simply creates new Order (uses the existing for first payment) and calls order.complete_order() when the succesfull PayPal IPN notification arrives.

Of course I would need to give the user information about state of his/hers subscribtion, so I will have to add some fields like those suggested by @cypreess and @anuj9196. I will try to make PR from this, when my implementation progress.

@PetrDlouhy
Copy link
Collaborator

Please review recurring code in PR #106

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

No branches or pull requests

5 participants