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

Applies to Windows and Windows Phone

[RequestProductPurchaseAsync(productId, includeReceipt) may be altered or unavailable for releases after Windows 8.1. Instead, use RequestProductPurchaseAsync(productId).]

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

Syntax


public static IAsyncOperation<string> RequestProductPurchaseAsync(
  string productId, 
  bool includeReceipt
)

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.

includeReceipt

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

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

Return value

Type: IAsyncOperation<String>

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

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

Minimum supported server

Windows Server 2012

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)

 

 

Show:
© 2014 Microsoft