Subscription
In this guide, we'll delve into the realm of subscription licensing, accompanied by LicenseSpring's powerful SDKs.
Whether you're a seasoned developer or just beginning, this tutorial will equip you to seamlessly integrate subscription licenses into your software offerings.
- Initialized LicenseManager (or LicenseHandler) with your configuration using the appropriate settings.
- Created a LicenseID using either LicenseID::fromKey or LicenseID::fromUser function, depending on the activation method you prefer.
- Activated a license of any type.
Similar to time-limited licensing, you gain the ability to set the default validity period for generated license keys.
This validity period signifies the duration in days between the initial activation of the license key and its expiration.
With subscription licenses, however, there exist getters for the validity period including the grace period.
Just like with time-limited licenses, the SDKs offer the ability to retrieve these fields in local time and UTC:
Grace periods offer you the flexibility to determine a specific timeframe, measured in hours, subsequent to the expiry of the designated validity period.
During this defined interval, the license will retain its validity (isExpired() status will remain false), ensuring a seamless transition even after the official expiration.
To access the current license's grace period, developers can use the following:
Note: C++ and C# grace period retrieval returns the time remaining in hours, while the Java implementation returns days remaining.
It is also possible to check whether the grace period has started through:
By employing our system, you can easily determine whether a license has expired or remains valid.
This process empowers you with accurate information to manage software access effectively, ensuring a seamless user experience.
The isExpired() method provides an efficient way to check whether a license has reached its expiration date.
Our SDKs offer the ability to check the expiration status through the use of the following License methods:
Note: Our Java SDK's isExpired() method is called on the LicenseData object.
A local license check involves assessing the validity and expiration status of a software license within the immediate operating environment.
By performing checks locally, the software verifies the license's authenticity and expiration status without relying on external connections.
If the local license is expired, the SDKs will throw the following exceptions:
See License Checks for more information about local license checks.
Developers can also access a field within the License object that holds the number of days remaining until the license expires.
This number of days can be retrieved using the following methods, in the current time zone and UTC, respectively:
Note: The Java SDK only offers the ability to retrieve the days remaining in the current time zone.