Skip to main content
CurrentAppSimulator.RequestProductPurchaseAsync(String) | requestProductPurchaseAsync(String) method

Creates the async operation that displays the UI that is used to simulate the purchase of in-app product from the Windows Store.

Syntax


Windows.ApplicationModel.Store.CurrentAppSimulator.requestProductPurchaseAsync(productId).done( /* Your success and error handlers */ );

public static IAsyncOperation<PurchaseResults> RequestProductPurchaseAsync(
  string productId
)

Public Shared Function RequestProductPurchaseAsync(
  productId As String 
) As IAsyncOperation(Of PurchaseResults)

public:
static IAsyncOperation<PurchaseResults>^ RequestProductPurchaseAsync(
  String^ productId
)

Parameters

productId

Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

Specifies the id, as defined by the simulation, of the in-app product to buy.

Return value

Type: IAsyncOperation<PurchaseResults>

A PurchaseResults object containing transaction details for the provided productId.

Remarks

Uses the CurrentApp/ListingInformation/Product element in the WindowsStoreProxy.xml file with the ProductId attribute that matches ProductId as the data source for the members of the returned object. If the purchase succeeds, the license state is updated only in memory. The contents of WindowsStoreProxy.xml are not changed. For more information, see Using the WindowsStoreProxy.xml file with CurrentAppSimulator.

Use the LicenseInformation.IsActive property to confirm that a product license is active after a successful RequestProductPurchaseAsync call.

Note  This method of confirming a successful purchase is only applicable to the RequestProductPurchaseAsync overloads that don't return a PurchaseResults object.
 

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

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.ApplicationModel.Store
Windows::ApplicationModel::Store [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.ApplicationModel.Store
Windows::ApplicationModel::Store [C++]

Metadata

Windows.winmd

See also

CurrentAppSimulator
RequestProductPurchaseAsync(String, Boolean)