Open VictorWangwz opened 5 years ago
Thank you for the question. There is an auto_renew
in the Plan
model and an auto_renew
in the Subscription
model. When a subscriber (i.e. Organization
instance) subscribes to a Plan
with auto_renew == True
, a Subscription
with auto_renew == True
is created.
The manage.py renewals
command calls saas.renewals.extend_subscriptions(at_time). The algorithm looks for all Subscription
with auto_renew == True
that are also ending within a day of at_time
and extends those, creating a Transaction
in the process that later is used to create a Charge
in saas.renewals.create_charges_for_balance
.
The idea behind manage.py renewals
and all other complexities in the code base usually have to deal with making sure that running the script a second time with the same at_time
will not create unintended charges, etc.
I will keep this issue open until this gets merged into the documentation.
If you have other questions, please ask. We are thriving to improve and feedback greatly helps. Thank you.
Hi, Thx for ur work on this saas app. I am also working on handling subscription stuff now and ur app really helps a lot. I have a question that how do u realize auto renew, is there any configs to set? Previously, I used celery to create scheduled tasks to check it daily. I read the document that u also run cronjob daily with renew commends but do not explain how it is implemented in detail. Thus I raise this issue here.