How to enable a subscription model?

158 views
Skip to first unread message

LeopoldJ

unread,
Sep 9, 2015, 11:41:08 AM9/9/15
to General Open edX discussion
Hi,

I am fairly new to Open Edx. I have managed to run it in devstack and change theme. Now I am looking into payment. Our business model is simple. A student must buy a monthly subscription to take any course. Student should be able to view a course only if she has a valid subscription.

I know I will have to write custom code for this. I have done programming with Stripe before so I can handle setting up subscription. But how do I protect access to courses for valid subscribes only? Any kind of general guideline will be helpful.

Thank you.


Chris Dodge

unread,
Sep 9, 2015, 5:13:26 PM9/9/15
to General Open edX discussion
Hello LeopoldJ,

Thank you for your interest in Open edX!

The group I am with at edX has done a lot of work with "paywalled" course content and supporting infrastructure. Right now - as you probably noticed - we only support "pay to enroll" use cases and we do not have a subscription model in place.

Not knowing a lot about your plans, perhaps one simple way would be to add code/database tables/periodic task to record a user's financial standing in terms of the recurring billing performed through a payment provider before allowing him/her to enroll in a course. Likewise, perhaps after a warning period (via email and in-web messaging), you could in-activate any existing course enrollments (there is an is_active flag in the student_courseenrollments table that would be handy for this).

Of course, if you want to partition your course catalog (e.g. Subscription Plan #1 you can take Course X, Y, Z and Subscription Plan #2 you can take Course A, B, C), then that will get a bit more complicated.

Good luck. If you want to bat around some ideas before formalizing your designs, feel free to post them. I'd also encourage you to think about submitting your changes back upstream to Open edX repositories so that the broader community could benefit - I'm sure there's a bunch of demand for a subscription model.

- Chris

LeopoldJ

unread,
Sep 10, 2015, 4:17:48 PM9/10/15
to General Open edX discussion
Hi Chris,

Thank you so much for the ideas. I was thinking in the exact same lines. But you mentioning the table and column names saved me a lot of time.

Do you know if Edx has a mechanism to schedule tasks? If not that is fine. I can always use Linux's cron.

L.

Chris Dodge

unread,
Sep 10, 2015, 7:44:06 PM9/10/15
to General Open edX discussion
For recurring tasks (say a daily subscription status check) you might want to look into Celery Beat (http://celery.readthedocs.org/en/latest/userguide/periodic-tasks.html). I runs on Celery (which is in the Open edX stack out of the box).

I haven't used it personally, so I can't vouch for it, perhaps someone else with more Celery experience can chime in. Otherwise you can brute force it my writing a django management command (typically in a /management/commands subdirectories in the Django "apps") and trigger through OS level timers/schedulers.

You will still have some additional work to do regarding a payment provider gateway. I'm only familiar with CyberSource, but recurring billing is probably offered through most payment gateways - but you'll still have to tie it into the eCommerce flows that are currently in lms/djangoapps/shoppingcart.

Please note that a team here at edX is working on a next generation eComm engine  (our internal project is nicknamed Otto) based on Django Oscar, a standard Django library. I'm not aware of any plans by that team to do subscription model support for our own internal needs, but you should first decide if you might want to take on working with the existing shoppingcart platform or work towards the newer platform.

While Otto hasn't been fully packaged up for easy deployment yet (I can't speak to the timing), all the repos are open sourced already (see https://github.com/edx/ecommerce and some other repos). Also, all that said, I'm not even sure if Django-Oscar (https://django-oscar.readthedocs.org) supports recurring billing.

Sorry I can't give a concise answers, but I think quite a few of the pieces are in place.

Best,

Chris

Jim Abramson

unread,
Sep 11, 2015, 11:27:25 AM9/11/15
to General Open edX discussion

On Thursday, September 10, 2015 at 7:44:06 PM UTC-4, Chris Dodge wrote:
For recurring tasks (say a daily subscription status check) you might want to look into Celery Beat (http://celery.readthedocs.org/en/latest/userguide/periodic-tasks.html). I runs on Celery (which is in the Open edX stack out of the box).

I haven't used it personally, so I can't vouch for it, perhaps someone else with more Celery experience can chime in. Otherwise you can brute force it my writing a django management command (typically in a /management/commands subdirectories in the Django "apps") and trigger through OS level timers/schedulers.


The edx notifier service uses the Advanced Python Scheduler.  


We started initially with Celery Beat but had problems getting it to work / debugging the problems.  That was a couple years ago - it may be more reliable at this point, but APScheduler has been rock-solid for us.

Jim

Reply all
Reply to author
Forward
0 new messages