ProductLicense ProductLicense ProductLicense ProductLicense Class

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

Syntax

Declaration

public sealed class ProductLicensepublic sealed class ProductLicensePublic NotInheritable Class ProductLicense

Remarks

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

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;

Properties summary

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

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

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.

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.

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 DateTime ExpirationDate { get; }Public ReadOnly Property ExpirationDate As DateTime

    Property Value

  • IsActive
    IsActive
    IsActive
    IsActive

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

    public bool IsActive { get; }public bool IsActive { get; }Public ReadOnly Property IsActive As bool

    Property Value

    • bool
      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 bool IsConsumable { get; }public bool IsConsumable { get; }Public ReadOnly Property IsConsumable As bool

    Property Value

    • bool
      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 string ProductId { get; }public string ProductId { get; }Public ReadOnly Property ProductId As string

    Property Value

    • 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.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.ThreadingAttribute

Details

Assembly

Windows.ApplicationModel.Store.dll