website logo
⌘K
Getting Started
Introduction
Basic Concepts
Opening an Account
Creating & Configuring Products
Integrating SDK and Configuring License Fulfillment
Activate a Key-Based License
Vendor Platform
Issuing New Licenses
License Detail View
Order Detail View
Customer Detail View
Metadata
Analytics
Settings
Product Configuration
Product Features
Product Custom Fields
Product Versioning
License Policies
Product Bundles
License Entitlements
License Types
Activations & Device Transfers
Features
Custom Fields
License Start Date
License Note
Maintenance Period
Trial Licenses
Floating Licenses
License Activation Types
Portals
End-User Portal
Offline Portal
Air-Gapped Portal
License API
License API Authorization
License Activation/Deactivation
License Check
Consumption
Floating
Trial Key
Product Details
Device Variables
Changing Password
Management API
Making API Requests
Management API Authorization
Customer
Product
Order
License
Device
Analytics
SDKs
Tutorials
.NET/C# SDK
.NET/C# Management SDK
C++ SDK
Java SDK
Python SDK
Go SDK
Delphi SDK
Swift/Objective-C SDK
Android SDK
Unity SDK
Errors and Response Codes
Floating Server
API Reference
Deployment
Configuration
Floating Server UI
Securing the Server
Whitelabeling
FAQ
Floating Server Changelog
Integrations
Salesforce
FastSpring
Stripe
Shopify
Common Scenarios
Single Sign On (SSO)
Glossary
General
SDK Glossary
Vendor Platform
Product Configuration Glossary
License Configuration
Postman Collections
Frequently Asked Questions
Changelog
License API changelog
Platform changelog
Docs powered by
Archbee
SDKs
...
Licensing Scenarios
License Type Options

Time-Limited

13min

In this guide, you'll learn how to manage time-limited licenses using the LicenseSpring SDKs.

This includes understanding validity periods, detecting license expiry with methods like "isExpired," implementing local checks, and gaining insights into remaining days for effective software access management.

By mastering these strategies, you can enhance your software distribution through precise time-based licensing techniques.

Prerequisites

  1. Completed the Getting Started Tutorial, including:
    • 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.

Interpreting and Retrieving Validity Period

Upon configuring a new product in LicenseSpring, 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.

Note: A license key can be configured for perpetual validity or restricted within a specific time frame.

Retrieving Validity Period in Local Time

With our SDK, obtaining the validity period of a license key in your local time zone becomes a seamless process.

The validity period is stored within the License object and can be accessed by using the following method:

C++
C#
Java
Swift
|
license.validityPeriod // Date?


Retrieving Validity Period in UTC

Developers also have the ability to get the validity period in UTC, rather than local time.

This is done with the following:

C++
C#
|
tm LicenseSpring::License::validityPeriodUtc()	


How to Verify if a License has Expired

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.

Utilizing the "isExpired" Method to Check License Expiry

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:

C++
C#
Java
Swift
|
license.isExpired


Note: Our Java SDK's isExpired() method is called on the LicenseData object.

Implementing Local Checks for License Expiry

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:

C++
C#
Java
|
LicenseExpiredException


See License Checks for more information about local license checks.

Understanding the "Days Remaining" Value

Developers can also access a field within the License object that holds the number of days remiaining until the license expires.

This number of days can be retrieved using the following methods, in the current time zone and UTC, respectively:

C++
C#
Java
|
long daysRemaining()


Note: The Java SDK only offers the ability to retrieve the days remaining in the current time zone.



Updated 05 Sep 2023
Did this page help you?
PREVIOUS
Consumption-Based
NEXT
Subscription
Docs powered by
Archbee
TABLE OF CONTENTS
Prerequisites
Interpreting and Retrieving Validity Period
Retrieving Validity Period in Local Time
Retrieving Validity Period in UTC
How to Verify if a License has Expired
Utilizing the "isExpired" Method to Check License Expiry
Implementing Local Checks for License Expiry
Understanding the "Days Remaining" Value
Docs powered by
Archbee