ProductLicense ProductLicense ProductLicense ProductLicense Class

Definition

Provides info about a license that is associated with an add-on (also called an in-app product or IAP).

public : sealed class ProductLicense : IProductLicense, IProductLicenseWithFulfillmentpublic sealed class ProductLicense : IProductLicense, IProductLicenseWithFulfillmentPublic NotInheritable Class ProductLicense Implements IProductLicense, IProductLicenseWithFulfillment// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Examples

The following code example demonstrates how to use this object to get the expiration date of an add-on offer.

// get current app object using the simulator interface
currentApp = Windows.ApplicationModel.Store.CurrentAppSimulator;

// get the license information object
licenseInformation = CurrentAppSimulator.licenseInformation;

// get info about the licenses of the app's in-app offers
inAppOfferLicenses = licenseInformation.productLicenses;

// get the license information for a specific in-app offer
myFavoriteInAppOffer = inAppOfferLicenses("MyFavoriteInAppOffer");

// and look up the offer's expiration date
myFavoriteInAppOffer.expirationDate;
// get the license info for this app from the simulator
LicenseInformation licenseInformation = CurrentAppSimulator.LicenseInformation;

// get the license info for one of the app's in-app offers
ProductLicense inAppOfferLicense =
    licenseInformation.ProductLicenses["MyFavoriteInAppOffer"];

// get the expiration date of this in-app offer
DateTimeOffset expirationDate = inAppOfferLicense.ExpirationDate;

Remarks

The ProductLicenses property of the LicenseInformation object contains one or more instances of this object.

Properties

ExpirationDate ExpirationDate ExpirationDate ExpirationDate

Gets the current expiration date and time of the add-on (also called an in-app product or IAP) license.

public : DateTime ExpirationDate { get; }public DateTimeOffset ExpirationDate { get; }Public ReadOnly Property ExpirationDate As DateTimeOffset// You can use this property in JavaScript.
Value
DateTime DateTimeOffset DateTimeOffset DateTimeOffset

The date and time indicating when the add-on license expires.

IsActive IsActive IsActive IsActive

Indicates if the add-on (also called an in-app product or IAP) license is currently active.

public : PlatForm::Boolean IsActive { get; }public bool IsActive { get; }Public ReadOnly Property IsActive As bool// You can use this property in JavaScript.
Value
PlatForm::Boolean bool bool bool

Returns true if the add-on's license is active, and otherwise false. This property can return false if the license is missing, expired, or revoked.

IsConsumable IsConsumable IsConsumable IsConsumable

Indicates if the add-on (also called an in-app product or IAP) is consumable. A consumable add-on can be purchased, used, and purchased again.

public : PlatForm::Boolean IsConsumable { get; }public bool IsConsumable { get; }Public ReadOnly Property IsConsumable As bool// You can use this property in JavaScript.
Value
PlatForm::Boolean bool bool bool

true if the add-on is a consumable add-on; Otherwise, false.

ProductId ProductId ProductId ProductId

Gets the ID of an add-on (also called an in-app product or IAP). This ID is used by the app to get info about the product or feature that is enabled when the customer buys it through an in-app purchase.

public : PlatForm::String ProductId { get; }public string ProductId { get; }Public ReadOnly Property ProductId As string// You can use this property in JavaScript.
Value
PlatForm::String string string string

The ID specified in the Windows Dev Center dashboard to identify this add-on.

Remarks

The product ID is the string that the app uses to identify the add-on. You enter the product ID when submitting your add-on in the Windows Dev Center dashboard, where it is associated with the description, price tier and lifetime. For more information, see How to use product IDs for add-ons in your code.

See Also