Zengain beta open for customers sign up now:
click here
Documentation
SupportNalpeiron.comGithubFree TrialFeedback
  • Documentation
  • Zentitle2 Docs
  • Zengain Docs
  • Zentitle I (V10)
  • Education & Training
  • Welcome
    • Zentitle2 documentation: License Management Software
    • Introduction to Zentitle2
  • Latest UI Changes
  • Zentitle Overview
    • Zentitle Quick Overview
      • Zentitle2 Features & Benefits
      • A single source of truth: 1 platform
      • Zentitle Architecture
      • Zentitle supports every platform
      • Zentitle business models
      • Critical differences for secure site/offline/dark site management
      • Zentitle for SaaS Licensing
  • Quick Start
    • Onboarding Zentitle2
    • Integrating is easy
    • Pricing & Packaging with Zentitle
  • Using the Platform UI
    • Introduction
    • New User Setup
    • Getting around
      • Search
      • Using reports
      • Providing feedback
    • Getting started
  • UI: ADMINISTRATION
    • Introduction
    • Users
      • Managing Users
      • Resending user invites
      • User permissions
      • Lost password
    • API Credentials
      • Package Registry
    • Webhooks
      • Logs
      • Workflow automation software
    • Integrations
      • FastSpring
      • SalesForce Sample Integration
        • Sample Integration Installation
        • Post-Installation Configuration
        • Connecting Salesforce to Zentitle
        • Creating a Zentitle Customer in SalesForce
        • Creating a Zentitle Entitlement in SalesForce
        • Editing Zentitle Entitlements in SalesForce
        • Managing Software Activations in SalesForce
    • Configuration
      • Import customers
      • Account Based Licensing (Identity-based licensing)
        • Setup Account Based Licensing with OpenID tokens.
        • Setup Account Based Licensing with username/password
        • Branding the user experience
      • End User Portal
        • End User Portal User Access
        • End user - Use of the portal
        • End User Offline Activation
      • Custom Fields
      • Security (2FA)
    • "Hard" Delete
  • UI: Dashboard
    • The Dashboard
  • UI: Customers
    • Customers and contacts
    • Customers
      • Adding (managing) contacts
      • The contact page
      • Setting up End User Portal (EUP) access
      • Inviting contacts to EUP
      • Disabling Customers
      • Managing Entitlements (from the Customer page)
  • UI: Entitlements
    • Entitlements
      • Using Entitlements
      • Maintenance options
    • Working with Entitlements
      • Activation Codes
      • Contacts (ABL)
      • Activations
      • Activity log
      • Notes
    • Managing Entitlements
      • Allocating entitlements
      • Change the offering (upgrade/downgrade)
      • Entitlements with overrides/changes
      • Renewing an entitlement
      • Resetting the usage count
      • Disabling Entitlements
      • Entitlements in overdraft (seats)
  • UI: Product Catalog
    • Product paradigm
    • Products
      • Product Features
      • Overdraft option (feature usage)
      • Feature Control
      • Product Attributes
      • Product Editions
      • Edition Setup
    • Offerings
      • Overdraft option (seats)
      • Managing offerings
      • Maintenance options
      • Change offering (upgrade/downgrade)
      • Custom Fields
    • Plans
      • Trial plans
    • Global Features (and attributes)
  • UI: Local License Server
    • Local License Server (LLS)
      • Local License Server Installation
      • LLS License End-User Management
      • Entitlements to be used on LLS instances
      • LLS Licensing API
      • LLS Release Notes
  • UI: Help
    • Support
  • Developers
    • Licensing & Management APIs
      • API docs
      • API Rate limits
      • Collecting credentials for integration
      • API Versioning
    • The Licensing Client (.NET)
      • Configure NuGet Source
      • Configuring the Activation
      • Configuring the SharedActivation
      • Working with SharedActivation
      • Licensing API Nonce
      • IActivation interface
      • Zentitle2Core Library
      • Exceptions
      • FAQ
      • Release Notes
    • The Licensing Client (C++)
      • Configuring the Activation
      • Licensing API Nonce
      • IActivation interface
      • Zentitle2Core Library
      • Exceptions
      • Release Notes
    • The Licensing Client (Java)
      • Configure JAR Source
      • Configuring the Activation
      • Licensing API Nonce
      • IActivation interface
      • Zentitle2Core Library
      • Exceptions
      • FAQ
      • Release Notes
    • The Zentitle2Core Library (C++)
      • Security
      • Offline Activation
      • Generating Device Fingerprint
      • Using the Zentitle2Core Library
      • Troubleshooting and FAQs
    • Platform Summary
      • Turboscale architecture
      • SaaS Application Licensing
      • On-Premise Licensing
        • 1-Step Offline Deactivation: On-Premise
        • 2-Step Offline Activation: On-Premise
    • Offline Activation
    • Virtual Machine Control
    • No-code Test Application
      • Creating a Product and Entitlement
      • Download the demo files
      • OnPremDemo.dll.config setup
      • Test the demo application
        • Install Desktop Runtime
    • No-code SaaS Example
      • Creating a Product and Entitlement
      • Download the demo files
      • Collecting the serverside parameters
      • Edit appsettings.json file for IDE based Testing
      • Edit docker-compose.yml file for Docker-based Testing
      • Test the demo application
        • Using docker to test
    • Naming conventions/Glossary
  • Premium Features
    • Overdraft Tracker (Basic)
      • API references (Overdraft)
      • Overdraft Tracker on the dashboard
      • Reporting with the Overdraft Tracker
    • Network Licensing
    • Change log feature
  • Use Cases
    • Dark Site Local License Server (Network-based licensing)
    • Renewals (Customer Success) Management
    • Subscription grace periods
    • Self-service - End-user portal
    • Virtualized Environments
    • Usage-Based Licensing
    • Trial Management
    • Identity Based Licensing: Understanding IDP
    • Single Tenant Option
    • Entitlements with ERP & billing systems
    • Entitlements with Subscriptions
    • Entitlements with a CRM
    • E-commerce Integration
    • IoT and hardware licensing
    • SaaS Applications
    • Overuse tracking (overdrafts)
    • Order Fulfillment
  • Zentitle and M&A deals
  • Other
    • Zentitle2 Changelog
      • Terms and Conditions Changelog
Powered by GitBook
LogoLogo

Nalpeiron Privacy Policy

  • Privacy and Cookie Policy

Nalpeiron Growth Platform Terms

  • Nalpeiron ELTC

Get a FREE Trial

  • Click here for FREE Trial

© Copyright - Nalpeiron, all rights reserved. Nalpeiron, The Nalpeiron Growth Platform, Zentitle and Zengain are trademarks of Nalpeiron Inc. All use subject to our Terms above.

On this page
  • Info
  • Features
  • State
  • Methods
  • Initialize
  • Activate
  • GenerateOfflineActivationRequestToken
  • ActivateOffline
  • DeactivateOffline
  • Deactivate
  • RefreshLease
  • RefreshLeaseOffline
  • PullRemoteState
  • PullPersistedState
  • GetActivationEntitlement
  • Features operations
  • Checkout a Feature
  • Return a Feature
  • Track Feature Usage

Was this helpful?

Export as PDF
  1. Developers
  2. The Licensing Client (.NET)

IActivation interface

The license state can be accessed and manipulated through the IActivation interface. Let's look more closely at the most common licensing use cases and how they can be handled using our SDK.

Info

Information such as activation ID, entitlement ID, lease expiry, seat name, etc., can be retrieved via the activation.Info property.

Features

You can access the activation features using the activation.Features property.

The Features property provides access to all available features as a collection:

// get all access control features
var accessControlFeatures = activation.Features
    .Where(f => f.Type == FeatureType.Bool)
    .ToArray();

Or request a specific feature using TryGet API:

// Get a feature by key
if (activation.Features.TryGet("feature-key", out var feature))
{
    // Feature exists and is accessible through the 'feature' variable
    Console.WriteLine($"Feature {feature.DisplayName} is {(feature.Enabled ? "enabled" : "disabled")}");
    Console.WriteLine($"Available amount: {feature.Available}");
}
else
{
    // Feature doesn't exist
    Console.WriteLine("Feature not found");
}

State

The seat's activation state can be accessed through the activation.State property.

Possible activation states:

  • Uninitialized: The local activation state has not been initialized from the local persistence yet.

  • Active: The seat and its entitlement (license) are active.

  • LeaseExpired: Seat activation's lease period expired.

  • NotActivated: The seat has not been activated yet, or it has been deactivated, or the activation seat has been deleted on the server.

  • EntitlementNotActive: The seat has been activated, but the entitlement (license) is not active (disabled, expired, etc.)

Usage

ActivationState is used in the IActivation interface to represent the current state of the activation. It helps in understanding the context and making decisions based on the activation's state during various activation-related operations.

For example, when calling the Initialize method in the IActivation interface, the activation state should be Uninitialized. After successful initialization, the state may transition to Active, LeaseExpired, NotActivated, or EntitlementNotActive based on specific conditions.

Understanding the activation state is crucial for implementing robust licensing logic within your application. Refer to the methods' documentation below for more details on using activation states in the licensing client.

Methods

Initialize

Task Initialize()
  • Description: Initializes the activation from the locally persisted state.

  • Allowed in States: Uninitialized

  • Transitions To:

    • Active - When the seat has been successfully activated, and its lease has not expired.

    • LeaseExpired - When the seat has been activated, but its lease has expired.

    • NotActivated - When there is no activated seat.

    • EntitlementNotActive - When there is an activated seat, but the entitlement has expired or has been disabled.

Activate

Task Activate(ActivationCredentialsModel activationCredentials, string seatName = null)
  • Description: Activates the seat in online mode.

  • Allowed in States: NotActivated, EntitlementNotActive

  • Transitions To:

    • Active - When the seat has been successfully activated on the server.

GenerateOfflineActivationRequestToken

Task<string> GenerateOfflineActivationRequestToken(string activationCode, string seatName = null, string stateMetadata = null)
  • Description: Generates a request token for offline activation.

  • Allowed in States: NotActivated, LeaseExpired, EntitlementNotActive

  • Transitions To: None.

ActivateOffline

Task<string> ActivateOffline(string offlineActivationResponseToken)
  • Description: Activates the seat offline with the token received from the EUP.

  • Allowed in States: NotActivated, LeaseExpired, EntitlementNotActive

  • Transitions To:

    • Active - When the offline activation response token was successfully applied.

DeactivateOffline

Task<string> DeactivateOffline()
  • Description: Deactivate the offline-activated seat.

  • Allowed in States: Active, LeaseExpired, EntitlementNotActive (when Info.Mode: ActivationMode.Offline)

  • Transitions To:

    • NotActivated - When the deactivation token has been successfully generated, and the activation state has been deleted from local storage.

Deactivate

Task<bool> Deactivate()
  • Description: Deletes the online-activated seat from the Licensing Server.

  • Allowed in States: Active, LeaseExpired , EntitlementNotActive (when Info.Mode: ActivationMode.Online)

  • Transitions To:

    • NotActivated - When the seat deactivation has been successful and the activation has been removed from the licensing server.

    • EntitlementNotActive - When the entitlement has expired or has been disabled.

RefreshLease

Task<bool> RefreshLease()
  • Description: Refreshes the online activation's lease time. Should be called periodically before the activation's lease period expires, otherwise the activation transitions into the LeaseExpired state.

  • Allowed in States: Active, LeaseExpired (When Info.Mode: ActivationMode.Online)

  • Transitions To:

    • None - When called in Active state and the lease period is successfully refreshed.

    • Active - When called in LeaseExpired state and the lease period is successfully refreshed.

    • NotActivated - When the seat activation has been deleted on the server.

    • EntitlementNotActive - When the seat activation exists on the server, but the entitlement has expired or has been disabled.

RefreshLeaseOffline

Task RefreshLeaseOffline(string offlineRefreshToken)
  • Description: Refreshes the offline activation's lease period.

  • Allowed in States: Active, LeaseExpired (When Info.Mode: ActivationMode.Offline)

  • Transitions To:

    • None - When called in Active state and the lease period is successfully refreshed.

    • Active - When called in LeaseExpired state and the lease period is successfully refreshed.

PullRemoteState

Task PullRemoteState()
  • Description: Pulls the current activation's state from the remote Licensing server and updates the local activation's state accordingly.

  • Allowed in States: Active, LeaseExpired, EntitlementNotActive (when Info.Mode: ActivationMode.Online)

  • Transitions To:

    • None - When the activation state on the server matches the local activation state.

    • Active - When both the seat and the entitlement are active on the Licensing server.

    • LeaseExpired - When the seat has been activated, but its lease already expired.

    • NotActivated - When the seat activation has been deleted on the server.

    • EntitlementNotActive - When the seat activation exists on the server, but the entitlement has expired or has been disabled.

PullPersistedState

Task PullPersistedState()
  • Description: Pulls the current activation's state from persistent storage and updates the activation's in-memory state if necessary.

  • Allowed in States: NotActivated, Active, LeaseExpired, EntitlementNotActive

  • Transitions To:

    • None - When the activation state in persistent storage matches the in-memory activation state.

    • Active

    • LeaseExpired

    • NotActivated

    • EntitlementNotActive

GetActivationEntitlement

Task<ActivationEntitlementModel> GetActivationEntitlement()
  • Description: Returns details about the entitlement associated with the current activation.

  • Allowed in States: Active, LeaseExpired, EntitlementNotActive

  • Transitions To: None.

Features operations

Checkout a Feature

Checkout feature to track consumption of a consumable or element pool resource:

// First, get the feature reference
if (activation.Features.TryGet("feature-key", out var feature))
{
    // Check if we have enough available
    if (feature.Available >= 5)
    {
        // Checkout 5 units of the feature
        await activation.CheckoutFeature(feature, 5);
        
        // After checkout, the feature object is updated with the new available amount
        Console.WriteLine($"Remaining amount: {feature.Available}");
    }
}

Note: The CheckoutFeature method is only available when the activation is in the Active state.

Return a Feature

Return previously checked-out units of a element pool feature:

// First, get the feature reference
if (activation.Features.TryGet("feature-key", out var feature))
{
    // Return 3 units of the feature
    await activation.ReturnFeature(feature, 3);
    
    // After return, the feature object is updated with the new available amount
    Console.WriteLine($"Available amount after return: {feature.Available}");
}

Note: The ReturnFeature method is only available when the activation is in the Active state.

Track Feature Usage

For boolean features (enabled/disabled), you can track usage:

// First, get the feature reference
if (activation.Features.TryGet("feature", out var feature) && feature.Enabled)
{
    // Track that this feature was used
    await activation.TrackFeatureUsage(feature);
    
    // Application code that uses the feature
    Console.WriteLine("Feature used successfully");
}

Note: The TrackFeatureUsage method is only available when the activation is in the Active state, and only works with boolean features that are enabled on entitlement level.

PreviousLicensing API NonceNextZentitle2Core Library

Last updated 1 month ago

Was this helpful?