CurrentAppSimulator.RequestProductPurchaseAsync(String) | requestProductPurchaseAsync(String) method

Applies to Windows and Windows Phone

Creates the async operation that displays the UI that is used to simulate an in-app purchase of content or a feature from the Windows Store.

Syntax


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

Parameters

productId

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

Specifies the id, as defined by the simulation, of the product or feature to buy.

Return value

Type: IAsyncOperation<PurchaseResults>

A PurchaseResults object containing in-app 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 transaction succeeds, the license state is updated only in memory. The contents of WindowsStoreProxy.xml are not changed.For more info, see the code examples in 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

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)

 

 

Show:
© 2014 Microsoft