SaaS and time-limited licensing
In this article you'll learn how to use TurboActivate in tandem with the LimeLM web-api for Software as a Service (SaaS) licensing or permanent licenses with time-limited maintenance and servicing contracts.
- For C# or VB.NET use the "limit-updates.aspx" file.
- For PHP use the "\PHP\limit-updates\index.php" file.
And if you're using another language then use the web API reference to help you write the necessary code.
Defining the problem
Let's say you offer your customers a permanent license but you charge annually for software updates. The problem is such: how do you limit the updates?
Step 1: Add an "update_expires" field
Then create a new field "update_expires" with the type "Date / Time". Also, make sure the "Required" and "Readable form your app" checkboxes are checked.
Step 2: Verify "update_expires" using the web API
In this example, all of the work to verify that the user has permission to download the updates will be done server-side. That is, you'll send the user's product key to your server and the server will query LimeLM to get the "update_expires" field value associated with the product key.
The first step is to send the product key to the server along with the request to download the update.
We're going to assume you're using wyBuild to build and deliver your updates, but the same concept can be applied no matter what updater program you use. Add 2 download sites to wyBuild: 1 for your server file and 1 for the updates file.
Notice that update site passes the
%urlargs% variables to be parsed by the "index.php" file.
When you run wyUpdate.exe make sure you pass the product key to wyUpdate via the -urlargs commandline switch. You can get the current product key using the
GetPKey() function in TurboActivate. Here's a simple example of what it should look like:
Or, if you're using the AutomaticUpdater control, use the
automaticUpdater1.wyUpdateCommandline = "-urlargs:\"" + TurboActivate.GetPKey() + "\"";
Then when wyUpdate checks for updates it will download the server file (*.wys file) unencumbered. And if there are updates available wyUpdate will try to download the file by passing the requested file along with the product key to the verification script on the server. The script then validates the details and either sends the file or rejects the user.
There are 4 steps to limiting updates server-side:
- Convert the product key to a product key ID using the limelm.pkey.getID API function.
- Get the field values of the product key using the limelm.pkey.getDetails API function.
- Verifying the "update_expires" field value is a date later than today.
- Deliver the update file requested OR throw an error (403 error code).
If you're using PHP or ASP.NET (C# or VB.NET) then you don't have to write this yourself. Just use the "\PHP\limit-updates\index.php" file or the "limit-updates.aspx" file for ASP.NET. Of course you'll need to set your API key and version ID in the code before you can use them on your site.