- 1.Save the product as a draft
- 2.Note the ID for the product at the top of page
- 3.Add licensing into your assembly, compile and upload files
The product ID is the identifier of your product which is to be used in the code.
External libraries might be a subject of tampering by hackers to work around the licensing infrastructure. It's a good practice to validate its origin by comparing the code signature and making sure it hasn't tampered before executing any functions.
var assembly = Assembly.GetAssembly(typeof(ItemLicense));
var certificate = X509Certificate.CreateFromSignedFile(assembly.Location);
if (certificate.GetCertHashString() != "07FF85A977EF497368AA1ADEB64D43B2B55BD4D8")
throw new Exception("Could not validate 'PoshTrader.Licensing' assembly origin.");
This doesn't apply to the cTrader platform and trying to validate its origin using the method above won't work.
Those attributes serve as important data during communication with our licensing server. Make sure that these attributes are correct, and the version is up to date.
[Item(ID, "Sample Indicator", Version = "1.0.0", Author = "John Doe")]
At the beginning of your app life cycle, you need to create an item license object where you pass your main class object with item attributes as a parameter.
var license = new ItemLicense(this);
The next thing you need to do is to check the license status. If the license is not valid, then a window will pop out asking for License Activation. If the user fails to validate his purchase, you will want to terminate the app or take some other action.
// limited features
// all features
You can do these checks as often and as many times as you need. The license validation process is done on the background asynchronously and syncs the status with our servers periodically.