How to determine plugin is in Free Trial through PluginLicenseManager

I have a plugin with licensing, which works fine with the timebomb licences. But when I do a fresh install on my developer instance, I get the “Free Trial” licence - by my thinking, in free trial everything should work just like in the paid version.

But here comes my problem, how do I actually determine that the plugin is in the free trial? I use this function to determine if the plugin is licensed:

private Boolean isLicenceOK() {
    if (pluginLicenseManager.getLicense().isDefined()) {
        PluginLicense pluginLicense = pluginLicenseManager.getLicense().get();
        return !pluginLicense.getError().isDefined();
    } else {
        return false;

Which works fine when I have/dont have a license. But when the plugin is in the free trial, it just says there is no license.

So is there a way to find out if the plugin is currently in the free trial?

That should work as long as the evaluation license isn’t expired… You might want to add in some logging about the details about the contents that getError() returns.

If you’re wanting different behaviors for evaluation licenses - there are a couple of getters on the PluginLicense object that will give you that:

I dont even get to the getError() part - the biggest problem seems to be that pluginLicenseManager.getLicense() returns none() and pluginLicenseManager.getLicense().isDefined() returns false.
I dont even know how would I simulate license expiration - I have it on my own development environment and every time I start the server, it says “Try jiraPlugin free for 30 days.” and shows it as a free trial, unless I add a license key.

If you can tell me which time bomb license are you using - I’ll be more than happy to try it out locally.

I think I know where the problem is - because I install the plugin through the atlassian scripts and not through the marketplace, there is no license and yet it still shows it is in free trial on my development machine.
So when it will be installed through the marketplace, the license will be provided and it will work.
It is a weird thing though, that the plugin says Unlicensed and Free Trial at the same time.

I’m assuming that the ”Atlassian scripts” you’re referring to is the sdk? The sdk only installs the license for the host product. You’ll need to paste in the app specific license yourself (you could do this through curl if you want to or take a Data snapshot through afterwards ).

Yes, that is exactly what I am trying to say. Thanks for your help :slight_smile: