What do I need to do to have a paid subscription membership scheme?

Topics: Customizing Orchard, Writing modules
Dec 5, 2012 at 7:24 AM

I am a developer very new to Orchard. Today is my second full day working with it. I would like to create a site where membership is based on a paid subscription. Different prices allow different content access, notifications, etc.

What are the higher level tasks I need to complete to achieve this? So far, I have a Subscriptions module skeleton, which I intend to use for the user to choose a subscription level, and for PayPal and other gateway payments.

Now I need to know:

1. How would I store a user's subscription data and static subscription data, e.g. different levels and pricing etc.

2. How would I integrate my custom roles with the default authorization engine in Orchard.

3. How would I include a mandatory visit to the subscrioption module as part of the new user registration process.

I think with some nice outlines how to achieve these three, I can keep myself busy learning for a good few hours.

Dec 9, 2012 at 7:28 AM
  1. Using a database is the obvious answer here I guess, but I'm sure you came up with that answer yourself. Please be more specific, so that we can be more specific as well.
  2. By implementing your own Permissions. To see how that works, have a look at the Orchard.Blogs module. Should contain all the samples to get you started with.
  3. I'm not sure what you mean by that, could you elaborate a bit?
Dec 9, 2012 at 7:35 AM

1. Do you mean a DB external to the Orchard DB? I was asking about using the existing Orchard data access components. Would adding a Part to the User content type maybe be a suitable application of Parts here?

3. When a user registers, how can I use Orchard functionality to ensure that a user account isn't active until the user has also a valid subscription record. How can I extend the existing user account creation workflow to direct the user to the subscriptions module after the default Orchard forms have been completed?

Dec 9, 2012 at 8:09 AM

1. Both will work, although what you choose will depend on any specific requirements that you may have. I am currently working on a similar application, and chose to do everything inside Orchard. I implemented all of my products (not exactly the same as a subscription, but conceptually close enough) as content items, because it's great for my needs. Others may prefer working with entity records directly instead of working with the content model. Either way should work fine (although working directly with records is more lightweight, which could be crucial when you're working with millions of records. I'm betting we'll be running on a document DB by then before I reach the millions ;)). If you choose to work with the content model (content types and content items), you will be using the IContentManager to work with your content / subscriptions. Otherwise you will be working with the IRepository<T> interface to access your data stored in the Orchard database. Alternatively, you may connect to an external database. I haven't done that myself, but have seen a number of people doing this on these forums. Essentially you will connect to your external database like you would from any other application, with an extra required step to suppress the ambient transaction. You should be able to find more info on that on these forums.

3. Ah. In that case I would implement my own controller to handle user registration and login. It's very easy to do, and the Orchard.Users module provides a perfect example on how to do it.

Not sure if you need it, but in case you do, I started an implementation of a PayPal payment provider here: http://darkskycommerce.codeplex.com/SourceControl/changeset/view/3a0ff6025fb9

It's already functional, though not yet feature complete.

Dec 9, 2012 at 8:11 AM

By the way, I also have a tutorial on custom user registration here: http://skywalkersoftwaredevelopment.net/blog/writing-an-orchard-webshop-module-from-scratch-part-8


Dec 9, 2012 at 8:39 AM

Yes, thanks. I already found your tutorial series some minutes ago. I'm busy working through the whole lot, from step 1.