What you're talking about is usually referred to as "feature licensing", where you license individual features of your application, as opposed to all features with a single license. Each user would have a certain set of licenses associated with their user account; the set of licenses would be dependent upon which features they've purchased from you.
Within your code, upon login, you could validate each of a user's licenses to determine which features they're allowed to and not allowed to use. For example, here's some pseudo-code:
features = {
FEATURE_X: false,
FEATURE_Y: false,
FEATURE_Z: false
}
for license in licenses
switch license.policy
case 'FEATURE_X'
features.FEATURE_X = license.is_valid()
case 'FEATURE_Y'
features.FEATURE_Y = license.is_valid()
case 'FEATURE_Z'
features.FEATURE_Y = license.is_valid()
# Later in your software:
if features.FEATURE_X
# … let the user do X
else
# … don't let them
I built a software licensing API that makes this type of license model a lot easier to manage than it has been in the past. Using my service, Keygen, you can create different license types (policies) which represent your individual features, e.g. "Feature X", "Menu Item Y", etc.
Keygen also provides user management features, so associating multiple licenses with a single user, like for this particular licensing model, is a breeze.