CurrentApp CurrentApp CurrentApp CurrentApp Class

Defines methods and properties you can use to get license and listing info about the current app and perform in-app product purchases.

Syntax

Declaration

public static class CurrentApppublic static class CurrentAppPublic Static Class CurrentApp

Remarks

This object obtains its data from the Windows Store, so you must have a developer account and the app must be published in the Windows Store. Before submitting to the Windows Store, you can test your code with a simulated version of this class (whose state is initialized from an XML file). See CurrentAppSimulator.

Note

If your app targets Windows 10, version 1607 or later, we recommend that you use members of the Windows.Services.Store namespace instead of the Windows.ApplicationModel.Store namespace. The Windows.Services.Store namespace supports the latest add-on types, such as Store-managed consumable add-ons, and is designed to be compatible with future types of products and features supported by Windows Dev Center and the Store. The Windows.Services.Store namespace is also designed to have better performance. For more information, see In-app purchases and trials.

The CurrentApp class is not supported in Windows desktop applications that use the Desktop Bridge. These applications must use the Windows.Services.Store namespace to implement in-app purchases and trials. For more information, see In-app purchases and trials.

Properties summary

Gets the GUID generated by the Windows Store when your app has been certified for listing in the Windows Store.

Note

Once your app is in the Windows Store, future app updates or changes to the app description will not result in a change to the AppId.

Gets the license metadata for the current app.

Gets the Uniform Resource Identifier (URI) of the app's listing page in the web catalog of the Windows Store.

Methods summary

Retrieves the promotion campaign ID for the current app.

Requests all receipts for the purchase of the app and any in-app products. For examples of how receipt information can be used, see Using receipts to verify product purchases.

Retrieves a Windows Store collections ID key that can be used to query for product entitlements or to consume product entitlements that are owned by the current user.

Retrieves a Windows Store purchase ID key that can be used to grant entitlements for free products on behalf of the current user.

Requests the receipt for the specified product ID. For examples of how receipt information can be used, see Using receipts to verify product purchases.

Returns a list of purchased consumable in-app products that have not been reported to the Windows Store as fulfilled.

Loads the app's listing information asynchronously.

The returned LoadListingInformationAsync() object contains listing information (e.g. name, price, age rating) specific to the market the user currently resides in. Additionally, the listing information for available in-app products is also provided.

Loads the app listing information asynchronously, returning features and products in the ProductListings collection that match all supplied keywords.

Loads the app listing information asynchronously, returning features and products in the ProductListings collection that match any of the given products IDs.

Notifies the Windows Store that the purchase of a consumable is fulfilled and that the user has the right to access the content.

Notifies the Windows Store that the application has fulfilled the in-app product. This product cannot be re-purchased until the app has confirmed fulfillment using this method.

Requests the purchase of a full app license.

Requests the purchase of an in-app product. Additionally, calling this method displays the UI that is used to complete the transaction via the Windows Store.

Note

RequestProductPurchaseAsync(System.String,System.Boolean) may be altered or unavailable for releases after Windows 8.1. Instead, use RequestProductPurchaseAsync(System.String).

Requests the purchase of an in-app product. Additionally, calling this method displays the UI that is used to complete the transaction via the Windows Store.

Requests the purchase of an in-app product. Additionally, calling this method displays the UI that is used to complete the transaction via the Windows Store.The resulting RequestProductPurchaseAsync(System.String,System.Boolean) object includes the parameters required to display details for a specific offer within a large catalog of in-app purchases that is represented by a single product entry in the Store.

Properties

  • AppId
    AppId
    AppId
    AppId

    Gets the GUID generated by the Windows Store when your app has been certified for listing in the Windows Store.

    Note

    Once your app is in the Windows Store, future app updates or changes to the app description will not result in a change to the AppId.

    public static Guid AppId { get; }public static Guid AppId { get; }Public Static ReadOnly Property AppId As Guid

    Property Value

    • System.Guid
      System.Guid
      System.Guid
      System.Guid

      The GUID that identifies the app in the Windows Store.

    Remarks

    To get a link to your app within the Windows Store, which references the same GUID, use LinkUri.

  • LicenseInformation
    LicenseInformation
    LicenseInformation
    LicenseInformation

    Gets the license metadata for the current app.

    public static LicenseInformation LicenseInformation { get; }public static LicenseInformation LicenseInformation { get; }Public Static ReadOnly Property LicenseInformation As LicenseInformation

    Property Value

    Remarks

    This API does not require a network connection.

  • LinkUri
    LinkUri
    LinkUri
    LinkUri

    Gets the Uniform Resource Identifier (URI) of the app's listing page in the web catalog of the Windows Store.

    public static Uri LinkUri { get; }public static Uri LinkUri { get; }Public Static ReadOnly Property LinkUri As Uri

    Property Value

    • The Uniform Resource Identifier (URI) of the app's listing page in the Windows Store.

Methods

  • GetAppPurchaseCampaignIdAsync()
    GetAppPurchaseCampaignIdAsync()
    GetAppPurchaseCampaignIdAsync()
    GetAppPurchaseCampaignIdAsync()

    Retrieves the promotion campaign ID for the current app.

    public static IAsyncOperation<string> GetAppPurchaseCampaignIdAsync()public static IAsyncOperation<string> GetAppPurchaseCampaignIdAsync()Public Static Function GetAppPurchaseCampaignIdAsync() As IAsyncOperation( Of string )

    Returns

    • The advertising campaign ID for your app.

    Remarks

    Starting in Windows 10, you can seed the installation URL for your app with an ID that represents a custom promotion campaign. This enables you to publicize the installation URL in different locations and use the campaign ID to determine which location the customer clicked on the installation URL. Use the GetAppPurchaseCampaignIdAsync() method to retrieve the campaign ID for the current app. For more information about custom app promotion campaigns, see Create a custom app promotion campaign.

  • GetAppReceiptAsync()
    GetAppReceiptAsync()
    GetAppReceiptAsync()
    GetAppReceiptAsync()

    Requests all receipts for the purchase of the app and any in-app products. For examples of how receipt information can be used, see Using receipts to verify product purchases.

    public static IAsyncOperation<string> GetAppReceiptAsync()public static IAsyncOperation<string> GetAppReceiptAsync()Public Static Function GetAppReceiptAsync() As IAsyncOperation( Of string )

    Returns

    • An XML-formatted string that contains all receipt information for the purchase of the app and any in-app products.

    Remarks

    For more information about the contents of the receipt, see Using receipts to verify product purchases.

  • GetCustomerCollectionsIdAsync(System.String,System.String)
    GetCustomerCollectionsIdAsync(System.String,System.String)
    GetCustomerCollectionsIdAsync(System.String,System.String)
    GetCustomerCollectionsIdAsync(System.String,System.String)

    Retrieves a Windows Store collections ID key that can be used to query for product entitlements or to consume product entitlements that are owned by the current user.

    public static IAsyncOperation<string> GetCustomerCollectionsIdAsync(System.String serviceTicket,System.String publisherUserId)public static IAsyncOperation<string> GetCustomerCollectionsIdAsync(System.String serviceTicket,System.String publisherUserId)Public Static Function GetCustomerCollectionsIdAsync(serviceTicket As System.String,publisherUserId As System.String) As IAsyncOperation( Of string )

    Parameters

    • serviceTicket
      System.String
      System.String
      System.String
      System.String

      An Azure Active Directory access token that identifies the publisher of the current app. For more information about generating this token, see Manage product entitlements from a service.

    • publisherUserId
      System.String
      System.String
      System.String
      System.String

      An anonymous ID that identifies the current user in the context of services that are managed by the publisher of the current app. If the publisher maintains anonymous user IDs for use in their services, they can use this parameter to correlate these user IDs with the calls they make to Windows Store services. This parameter is optional.

    Returns

    • The collections ID key for the current user. This key is valid for 90 days.

    Remarks

    Publishers with catalogs of in-app purchases can use the collections ID key in service-to-service calls to the Windows Store collections API to query for product entitlements or to consume product entitlements that are owned by the current user. An entitlement represents the customer's right to use an app or in-app product (IAP) that is published through the Windows Store. For more information, see Manage product entitlements from a service.

  • GetCustomerPurchaseIdAsync(System.String,System.String)
    GetCustomerPurchaseIdAsync(System.String,System.String)
    GetCustomerPurchaseIdAsync(System.String,System.String)
    GetCustomerPurchaseIdAsync(System.String,System.String)

    Retrieves a Windows Store purchase ID key that can be used to grant entitlements for free products on behalf of the current user.

    public static IAsyncOperation<string> GetCustomerPurchaseIdAsync(System.String serviceTicket,System.String publisherUserId)public static IAsyncOperation<string> GetCustomerPurchaseIdAsync(System.String serviceTicket,System.String publisherUserId)Public Static Function GetCustomerPurchaseIdAsync(serviceTicket As System.String,publisherUserId As System.String) As IAsyncOperation( Of string )

    Parameters

    • serviceTicket
      System.String
      System.String
      System.String
      System.String

      An Azure Active Directory access token that identifies the publisher of the current app. For more information about generating this token, see Manage product entitlements from a service.

    • publisherUserId
      System.String
      System.String
      System.String
      System.String

      An anonymous ID that identifies the current user in the context of services that are managed by the publisher of the current app. If the publisher maintains anonymous user IDs for use in their services, they can use this parameter to correlate these user IDs with the calls they make to Windows Store services. This parameter is optional.

    Returns

    • The purchase ID key for the current user. This key is valid for 90 days.

    Remarks

    Publishers with catalogs of in-app purchases can use the collections ID key in service-to-service calls to the Windows Store purchase API to grant entitlements for free products on behalf of the current user. An entitlement represents the customer's right to use an app or in-app product (IAP) that is published through the Windows Store. For more information, see Manage product entitlements from a service.

  • GetProductReceiptAsync(System.String)
    GetProductReceiptAsync(System.String)
    GetProductReceiptAsync(System.String)
    GetProductReceiptAsync(System.String)

    Requests the receipt for the specified product ID. For examples of how receipt information can be used, see Using receipts to verify product purchases.

    public static IAsyncOperation<string> GetProductReceiptAsync(System.String productId)public static IAsyncOperation<string> GetProductReceiptAsync(System.String productId)Public Static Function GetProductReceiptAsync(productId As System.String) As IAsyncOperation( Of string )

    Parameters

    • productId
      System.String
      System.String
      System.String
      System.String

      The unique identifier for the product that you specified this identifier when you submitted the app to the Windows Store

    Returns

    • An XML-formatted string that contains the receipt for the specified productId.

    Remarks

    For more information about the contents of the receipt, see Using receipts to verify product purchases.

  • GetUnfulfilledConsumablesAsync()
    GetUnfulfilledConsumablesAsync()
    GetUnfulfilledConsumablesAsync()
    GetUnfulfilledConsumablesAsync()

    Returns a list of purchased consumable in-app products that have not been reported to the Windows Store as fulfilled.

    public static IAsyncOperation<UnfulfilledConsumable>> GetUnfulfilledConsumablesAsync()public static IAsyncOperation<UnfulfilledConsumable>> GetUnfulfilledConsumablesAsync()Public Static Function GetUnfulfilledConsumablesAsync() As IAsyncOperation( Of UnfulfilledConsumable )

    Returns

    • When the operation completes, a list of consumable in-app products not yet reported as fulfilled is returned (UnfulfilledConsumable objects). Each item of this list provides the product ID, offer ID, and transaction ID associated with a product.

  • LoadListingInformationAsync()
    LoadListingInformationAsync()
    LoadListingInformationAsync()
    LoadListingInformationAsync()

    Loads the app's listing information asynchronously.

    The returned LoadListingInformationAsync() object contains listing information (e.g. name, price, age rating) specific to the market the user currently resides in. Additionally, the listing information for available in-app products is also provided.

    public static IAsyncOperation<ListingInformation> LoadListingInformationAsync()public static IAsyncOperation<ListingInformation> LoadListingInformationAsync()Public Static Function LoadListingInformationAsync() As IAsyncOperation( Of ListingInformation )

    Returns

    • The apps' listing information. If the method fails, it returns an HRESULT error code.

    Remarks

    Calling this method requires an internet connection.

  • LoadListingInformationByKeywordsAsync(Windows.Foundation.Collections.IIterable{System.String})
    LoadListingInformationByKeywordsAsync(Windows.Foundation.Collections.IIterable{System.String})
    LoadListingInformationByKeywordsAsync(Windows.Foundation.Collections.IIterable{System.String})
    LoadListingInformationByKeywordsAsync(Windows.Foundation.Collections.IIterable{System.String})

    Loads the app listing information asynchronously, returning features and products in the ProductListings collection that match all supplied keywords.

    public static IAsyncOperation<ListingInformation> LoadListingInformationByKeywordsAsync(Windows.Foundation.Collections.IIterable{System.String} keywords)public static IAsyncOperation<ListingInformation> LoadListingInformationByKeywordsAsync(Windows.Foundation.Collections.IIterable{System.String} keywords)Public Static Function LoadListingInformationByKeywordsAsync(keywords As Windows.Foundation.Collections.IIterable{System.String}) As IAsyncOperation( Of ListingInformation )

    Parameters

    Returns

    • The app's listing information, with ProductListings collection filtered by keywords. If the method fails, it returns an HRESULT error code. If no products or features are found that match all of the given keywords, the ProductListings collection will be empty.

  • LoadListingInformationByProductIdsAsync(Windows.Foundation.Collections.IIterable{System.String})
    LoadListingInformationByProductIdsAsync(Windows.Foundation.Collections.IIterable{System.String})
    LoadListingInformationByProductIdsAsync(Windows.Foundation.Collections.IIterable{System.String})
    LoadListingInformationByProductIdsAsync(Windows.Foundation.Collections.IIterable{System.String})

    Loads the app listing information asynchronously, returning features and products in the ProductListings collection that match any of the given products IDs.

    public static IAsyncOperation<ListingInformation> LoadListingInformationByProductIdsAsync(Windows.Foundation.Collections.IIterable{System.String} productIds)public static IAsyncOperation<ListingInformation> LoadListingInformationByProductIdsAsync(Windows.Foundation.Collections.IIterable{System.String} productIds)Public Static Function LoadListingInformationByProductIdsAsync(productIds As Windows.Foundation.Collections.IIterable{System.String}) As IAsyncOperation( Of ListingInformation )

    Parameters

    • productIds

      The list of product IDs by which to filter the ProductListings collection.

    Returns

    • The app's listing information, with ProductListings collection filtered by product IDs. If the method fails, it returns an HRESULT error code. If no products or features are found that match the given product IDs, the ProductListings collection will be empty.

  • ReportConsumableFulfillmentAsync(System.String,System.Guid)
    ReportConsumableFulfillmentAsync(System.String,System.Guid)
    ReportConsumableFulfillmentAsync(System.String,System.Guid)
    ReportConsumableFulfillmentAsync(System.String,System.Guid)

    Notifies the Windows Store that the purchase of a consumable is fulfilled and that the user has the right to access the content.

    public static IAsyncOperation<FulfillmentResult> ReportConsumableFulfillmentAsync(System.String productId,System.Guid transactionId)public static IAsyncOperation<FulfillmentResult> ReportConsumableFulfillmentAsync(System.String productId,System.Guid transactionId)Public Static Function ReportConsumableFulfillmentAsync(productId As System.String,transactionId As System.Guid) As IAsyncOperation( Of FulfillmentResult )

    Parameters

    • productId
      System.String
      System.String
      System.String
      System.String

      Identifies the consumable.

    • transactionId
      System.Guid
      System.Guid
      System.Guid
      System.Guid

      Identifies a transaction that includes the purchase of the consumable (productId).

    Returns

    • A value that indicates the status of fulfillment for a consumable in-app product. Possible values are defined by the FulfillmentResult enumeration.

    Remarks

    A unique ID is required for each instance of a consumable product that has been purchased more than once.

  • ReportProductFulfillment(System.String)
    ReportProductFulfillment(System.String)
    ReportProductFulfillment(System.String)
    ReportProductFulfillment(System.String)

    Notifies the Windows Store that the application has fulfilled the in-app product. This product cannot be re-purchased until the app has confirmed fulfillment using this method.

    public static void ReportProductFulfillment(System.String productId)public static void ReportProductFulfillment(System.String productId)Public Static Function ReportProductFulfillment(productId As System.String) As void

    Parameters

    • productId
      System.String
      System.String
      System.String
      System.String

      The ID of the product that has been delivered to the user.

  • RequestAppPurchaseAsync(System.Boolean)
    RequestAppPurchaseAsync(System.Boolean)
    RequestAppPurchaseAsync(System.Boolean)
    RequestAppPurchaseAsync(System.Boolean)

    Requests the purchase of a full app license.

    public static IAsyncOperation<string> RequestAppPurchaseAsync(System.Boolean includeReceipt)public static IAsyncOperation<string> RequestAppPurchaseAsync(System.Boolean includeReceipt)Public Static Function RequestAppPurchaseAsync(includeReceipt As System.Boolean) As IAsyncOperation( Of string )

    Parameters

    • includeReceipt
      System.Boolean
      System.Boolean
      System.Boolean
      System.Boolean

      Determines if this method should return the receipts for this app.

    Returns

    • If the includeReceipt parameter is set to true, this string contains XML that represents all receipts for the app and any in-app purchases. If includeReceipt is set to false, this string is empty.

    Remarks

    This method returns a success value even if:

    • No network connection is available.
    • The user cancels out of the dialog.
    • The user's authentication fails.

    You should treat a success result as indicating the async process completed without errors. To ensure that the transaction itself was successful, check the LicenseInformation element in the returned receipt.

    For information about the contents of the receipt returned by this method, see Using receipts to verify product purchases.

  • RequestProductPurchaseAsync(System.String)
    RequestProductPurchaseAsync(System.String)
    RequestProductPurchaseAsync(System.String)
    RequestProductPurchaseAsync(System.String)

    Requests the purchase of an in-app product. Additionally, calling this method displays the UI that is used to complete the transaction via the Windows Store.

    public static IAsyncOperation<PurchaseResults> RequestProductPurchaseAsync(System.String productId)public static IAsyncOperation<PurchaseResults> RequestProductPurchaseAsync(System.String productId)Public Static Function RequestProductPurchaseAsync(productId As System.String) As IAsyncOperation( Of PurchaseResults )

    Parameters

    • productId
      System.String
      System.String
      System.String
      System.String

      Specifies the id of the in-app product.

    Returns

    • The results of the in-app product purchase request.

    Remarks

    Use the IsActive property to confirm that a product license is active after a successful RequestProductPurchaseAsync(System.String,System.Boolean) call.

    Note

    This method of confirming a successful purchase is only applicable to the RequestProductPurchaseAsync(System.String,System.Boolean) overloads that don't return a PurchaseResults object.

    You can see an example of how to use this method in our code sample.

  • RequestProductPurchaseAsync(System.String,System.Boolean)
    RequestProductPurchaseAsync(System.String,System.Boolean)
    RequestProductPurchaseAsync(System.String,System.Boolean)
    RequestProductPurchaseAsync(System.String,System.Boolean)
    Note

    RequestProductPurchaseAsync(System.String,System.Boolean) may be altered or unavailable for releases after Windows 8.1. Instead, use RequestProductPurchaseAsync(System.String).

    Requests the purchase of an in-app product. Additionally, calling this method displays the UI that is used to complete the transaction via the Windows Store.

    public static IAsyncOperation<string> RequestProductPurchaseAsync(System.String productId,System.Boolean includeReceipt)public static IAsyncOperation<string> RequestProductPurchaseAsync(System.String productId,System.Boolean includeReceipt)Public Static Function RequestProductPurchaseAsync(productId As System.String,includeReceipt As System.Boolean) As IAsyncOperation( Of string )

    Parameters

    • productId
      System.String
      System.String
      System.String
      System.String

      Specifies the id of the in-app product.

    • includeReceipt
      System.Boolean
      System.Boolean
      System.Boolean
      System.Boolean

      Determines if the method should return the receipts for the specified productId.

    Returns

    • A string providing in-app transaction details for the provided productId. If includeReceipt is set true, the returned string will include a full receipt xml.

  • RequestProductPurchaseAsync(System.String,System.String,Windows.ApplicationModel.Store.ProductPurchaseDisplayProperties)
    RequestProductPurchaseAsync(System.String,System.String,Windows.ApplicationModel.Store.ProductPurchaseDisplayProperties)
    RequestProductPurchaseAsync(System.String,System.String,Windows.ApplicationModel.Store.ProductPurchaseDisplayProperties)
    RequestProductPurchaseAsync(System.String,System.String,Windows.ApplicationModel.Store.ProductPurchaseDisplayProperties)

    Requests the purchase of an in-app product. Additionally, calling this method displays the UI that is used to complete the transaction via the Windows Store.The resulting RequestProductPurchaseAsync(System.String,System.Boolean) object includes the parameters required to display details for a specific offer within a large catalog of in-app purchases that is represented by a single product entry in the Store.

    public static IAsyncOperation<PurchaseResults> RequestProductPurchaseAsync(System.String productId,System.String offerId,Windows.ApplicationModel.Store.ProductPurchaseDisplayProperties displayProperties)public static IAsyncOperation<PurchaseResults> RequestProductPurchaseAsync(System.String productId,System.String offerId,Windows.ApplicationModel.Store.ProductPurchaseDisplayProperties displayProperties)Public Static Function RequestProductPurchaseAsync(productId As System.String,offerId As System.String,displayProperties As Windows.ApplicationModel.Store.ProductPurchaseDisplayProperties) As IAsyncOperation( Of PurchaseResults )

    Parameters

    Returns

    • The results of the in-app product purchase request.

    Remarks

    The remarks for RequestProductPurchaseAsync(System.String) also apply to this method.

Attributes

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

Details

Assembly

Windows.ApplicationModel.Store.dll