The .NET CPS dll component currently has pre-made forms for license validation and activation, but what if you want more control with your own forms?
Fortunately there are service methods that can be called directly from your code to activate, validate and deactivate licenses for your software users.
The benefits of using these custom service methods are:
- Use your own forms that exactly match your app with design and feel.
- Control when activate, validate and deactivate are called so that the architecture of your app is clean.
- Use from any .NET based application. You can now use CPS in any .NET based app.
The CpsService has the following methods implemented from the interface ICpsService:
- CpsServiceResult Activate(string email, string transactionId, string fullname);
- CpsServiceResult Deactivate();
- CpsServiceResult Validate();
The CpsServiceResult class has 2 properties:
- Result (bool)
- Description (string)
Here’s an example of using the Validate method
Why use CPS License Manager in a membership system?
There are great advantages to using some sort of membership system for customers of your software.
Using the License Manager inside a members-only area customizes the customer’s experience based on the product license they own.
- You can also restrict access to users that don’t have a valid license.
- The ‘resend activation email’ self-serve button works for logged in users, which will save you on customer support issues.
- Once a user is logged in to a site, you can show content based on their current license, and block others.
- If their license is made inactive, they will be automatically blocked from viewing this content.
You don’t have to use a membership system to use the License Manager
Strictly speaking, you don’t have to use a membership based system to use the License Manager.
- You can deliver product download links via the licensing activation email, so that users never have to become a member.
- License activation emails can be resent by an administrator from the License Manager
- This requires very minimal setup and might be all that you need.
What to do with your membership system IPN processing Url
Most advanced membership systems use an IPN type processing url to add members to WordPress when a product has been bought.
They will typically generate a URL that you would need to use in Paypal buttons or other payment processors.
The License Manager works the same way, and adds licenses when products are bought when information is posted to the IPN url generated in the CPS License Generator screen .
- To make sure that the membership system and the License Manager both perform as intended, you can add the membership IPN url to the License Manager IPN settings screen (the field marked Membership IPN url).
- You would then use the License manager IPN url in paypal buttons or other payment processors.
- When the IPN url is sent transaction information, the License Mnager processes it, and then hands it over to the membership system for its processing tasks
Creating WordPress Users When Licenses are generated
Some very simple membership systems do not create users, and simply lock the wordpress site away from non-wordpress users.
In this case you can use the CPS Registration Form shortcode to create a user after a purchase is made.
- You can also use other registration forms and ‘hook’ them into the License Manager so that a license check is done while they are registering. This can be done using the ‘Custom Validation’ hook settings found on the site integration screen – advanced users.
- You can actually create a user when a license is generated by using the generated optin form code, and checking ‘Create User & Autologon’.
- This is only relevant for ‘content’ based products as opposed to ‘software’ product types.