A license Stock Keeping Unit (SKU) is a license template from which individual licenses may be issued. In effect a license SKU predefines all the properties of a license, including:
- Product/Version/Features,
- Environment and Locking - either Standalone, Network, Removable, or Cloud
- Lifecycle - either Perpetual, Time-limited or Subscription
- Activation controls - when, where and how often the license may be activated.
For example, you may wish to offer customers the ability to register on-line for a 30 Day Trail License. To do this you would first create a 30 Day Trial License SKU that specifies the required license properties, including the license period/duration post activation and the features to include in the trial. When the customer requests a 30 Day Trial License on your website, the website would use the Software Potential web service to request a license based on the 30 Day Trial SKU from the Software Potential service.
Issuing a license based on a SKU is a two step process:
- First you retrieve the SKU / license template from Software Potential service. To do this you will require the SKU's unique identifier or SKUId.
- Then you create a license based on the license template data retrieved in the first step. (You can optionally modify the default template data before creating the license e.g. to add/remove features, modify usage limitations etc.)
SKU Unique Identifier
Each license SKU created in Software Potential has a unique reference ID, the SKU Id, that should be used whenever retrieving SKU data using the Software Potential web service API. The SKU Id is displayed at the bottom of the SKU Details page
You will need to store the SKU Id in whatever application you intend issuing licenses from e.g. CRM, ERP, eCommere site; typically this is stored in a field in the product catalog entry for the corresponding license.
Issue License From SKU
To issue a license from a SKU without modification:
- Call
GetSkuById
with the SKUId - Call
CreateLicense
with the retrieved LicenseInfo
The following code snippet issues a license from SKU using the LicenseManagement web service:
public License CreateLicenseFromSkuId(LicenseManagementApi api, string skuId ) { try { return api.Execute(client => { //Retrieve the SKU using the SKU Identifier LicenseInfo licenseInfo = client.GetSkuById( skuId ).LicenseInfo; //Issue License based on the License info in the retrieved SKU License license = client.CreateLicense( licenseInfo ); return license; } } catch ( FaultException apiEx ) { client.Abort(); throw apiEx; } }
Issue License from SKU with Options
When issuing a license based on a license SKU you can, where necessary, update the predefined license property values in the SKU before you issue the license. For example, you could offer an Enterprise license (containing a predefined set of features) but allow customers to add optional features when ordering the Enterprise license. When a customer selects the Enterprise license, together with one or more optional features, you would use the Software Potential web service API to request a license based on an Enterprise SKU but with the optional features added.
To issue a license from a SKU with additional features:
- Call GetSkuById with the SKUId
- Add the additional features to the LicenseInfo object retrieved in 1.
- Call CreateLicense with the updated LicenseInfo from 2.
To create Features and add them to a license:
NewFeatures = new LicenseFeature[] { new LicenseFeature { Name = "ProtectedAction1", Limitations= new Limitations { ExpirationDate = DateTime.MaxValue, ExpirationPeriod = TimeSpan.MaxValue, GatherUsageCount = false, GracePeriod = TimeSpan.Zero, MaxTotalUsage = 5, MaxConcurrentUsage = 1 } }, new LicenseFeature { Name = "ProtectedAction2", Limitations= new Limitations { ExpirationDate = DateTime.MaxValue, ExpirationPeriod = TimeSpan.MaxValue, GatherUsageCount = false, GracePeriod = TimeSpan.Zero, MaxTotalUsage = int.MaxValue } } } public static LicenseInfo AddNewLicenseFeatures(LicenseInfo LicenseInfo, LicenseFeature[] NewFeatures) { List LicenseFeatures = LicenseInfo.Features.ToList(); foreach ( var feature in NewFeatures ) { if (!LicenseFeatures.Where( f => f.Name == feature.Name).Any()) LicenseFeatures.Add( feature ); } LicenseInfo.Features = LicenseFeatures.ToArray(); return LicenseInfo; }
Issue License from SKU with Custom Tags
When issuing a license based on a license SKU you can, where necessary, add one or more Custom Tags to to the license before you issue it. For example, you may wish to restrict activation of a license to a given domain. To do this you would you would use the Software Potential web service API to request a license based on an appropriate SKU but with the required Custom Tags added.
To issue a license from a SKU with Custom Tags added:
- Call GetSkuById with the required SKUId
- Add the Custom Tags to the LicenseInfo retrieved from Step1
- Call CreateLicense with the updated LicenseInfo from Step 2
To create and add Custom Tags:
CustomTag[] newTags = new CustomTag[] { new CustomTag { TagName = "Domain", TagValue = "acme.com" }, new CustomTag { TagName = "IP Range", TagValue = "192.168.0.0 - 192.168.1.100" }, }; public static LicenseInfo AddCustomTags(LicenseInfo LicenseInfo, CustomTag[] CustomTags) { List tags = LicenseInfo.CustomTags.ToList(); tags.AddRange(CustomTags); LicenseInfo.CustomTags = tags.ToArray(); return LicenseInfo; }
Comments
0 comments
Article is closed for comments.