Share via


CurrentApp.RequestProductPurchaseAsync Method

Definition

Overloads

RequestProductPurchaseAsync(String)

Requests the purchase of an add-on (also called an in-app product or IAP). Additionally, calling this method displays the UI that is used to complete the transaction via the Microsoft Store.

RequestProductPurchaseAsync(String, Boolean)

Note

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

Requests the purchase of an add-on (also called an in-app product or IAP). Additionally, calling this method displays the UI that is used to complete the transaction via the Microsoft Store.

RequestProductPurchaseAsync(String, String, ProductPurchaseDisplayProperties)

Requests the purchase of an add-on (also called an in-app product or IAP). Additionally, calling this method displays the UI that is used to complete the transaction via the Microsoft Store. This overload includes parameters you can use 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.

RequestProductPurchaseAsync(String)

Requests the purchase of an add-on (also called an in-app product or IAP). Additionally, calling this method displays the UI that is used to complete the transaction via the Microsoft Store.

public:
 static IAsyncOperation<PurchaseResults ^> ^ RequestProductPurchaseAsync(Platform::String ^ productId);
/// [Windows.Foundation.Metadata.Overload("RequestProductPurchaseWithResultsAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<PurchaseResults> RequestProductPurchaseAsync(winrt::hstring const& productId);
[Windows.Foundation.Metadata.Overload("RequestProductPurchaseWithResultsAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<PurchaseResults> RequestProductPurchaseAsync(string productId);
function requestProductPurchaseAsync(productId)
Public Shared Function RequestProductPurchaseAsync (productId As String) As IAsyncOperation(Of PurchaseResults)

Parameters

productId
String

Platform::String

winrt::hstring

The product ID of the add-on to purchase.

Returns

A PurchaseResults that contains the results of the in-app product purchase request.

Attributes

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 Partner Center, where it is associated with the description, price tier and lifetime. For more information, see How to use product IDs for add-ons in your code.

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

See also

Applies to

RequestProductPurchaseAsync(String, Boolean)

Note

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

Requests the purchase of an add-on (also called an in-app product or IAP). Additionally, calling this method displays the UI that is used to complete the transaction via the Microsoft Store.

public:
 static IAsyncOperation<Platform::String ^> ^ RequestProductPurchaseAsync(Platform::String ^ productId, bool includeReceipt);
/// [Windows.Foundation.Metadata.Deprecated("RequestProductPurchaseAsync(productId, includeReceipt) may be altered or unavailable for releases after Windows 8.1. Instead, use RequestProductPurchaseAsync(productId).", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.Overload("RequestProductPurchaseAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<winrt::hstring> RequestProductPurchaseAsync(winrt::hstring const& productId, bool const& includeReceipt);
/// [Windows.Foundation.Metadata.Overload("RequestProductPurchaseAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
/// [Windows.Foundation.Metadata.Deprecated("RequestProductPurchaseAsync(productId, includeReceipt) may be altered or unavailable for releases after Windows 8.1. Instead, use RequestProductPurchaseAsync(productId).", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
 static IAsyncOperation<winrt::hstring> RequestProductPurchaseAsync(winrt::hstring const& productId, bool const& includeReceipt);
[Windows.Foundation.Metadata.Deprecated("RequestProductPurchaseAsync(productId, includeReceipt) may be altered or unavailable for releases after Windows 8.1. Instead, use RequestProductPurchaseAsync(productId).", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.Overload("RequestProductPurchaseAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<string> RequestProductPurchaseAsync(string productId, bool includeReceipt);
[Windows.Foundation.Metadata.Overload("RequestProductPurchaseAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
[Windows.Foundation.Metadata.Deprecated("RequestProductPurchaseAsync(productId, includeReceipt) may be altered or unavailable for releases after Windows 8.1. Instead, use RequestProductPurchaseAsync(productId).", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
public static IAsyncOperation<string> RequestProductPurchaseAsync(string productId, bool includeReceipt);
function requestProductPurchaseAsync(productId, includeReceipt)
Public Shared Function RequestProductPurchaseAsync (productId As String, includeReceipt As Boolean) As IAsyncOperation(Of String)

Parameters

productId
String

Platform::String

winrt::hstring

The product ID of the add-on to purchase.

includeReceipt
Boolean

bool

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

Returns

IAsyncOperation<String>

IAsyncOperation<Platform::String>

IAsyncOperation<winrt::hstring>

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.

Attributes

Remarks

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

To confirm whether the product license is active after a successful call to this overload, use the LicenseInformation.IsActive property.

See also

Applies to

RequestProductPurchaseAsync(String, String, ProductPurchaseDisplayProperties)

Requests the purchase of an add-on (also called an in-app product or IAP). Additionally, calling this method displays the UI that is used to complete the transaction via the Microsoft Store. This overload includes parameters you can use 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(Platform::String ^ productId, Platform::String ^ offerId, ProductPurchaseDisplayProperties ^ displayProperties);
/// [Windows.Foundation.Metadata.Overload("RequestProductPurchaseWithDisplayPropertiesAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<PurchaseResults> RequestProductPurchaseAsync(winrt::hstring const& productId, winrt::hstring const& offerId, ProductPurchaseDisplayProperties const& displayProperties);
[Windows.Foundation.Metadata.Overload("RequestProductPurchaseWithDisplayPropertiesAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<PurchaseResults> RequestProductPurchaseAsync(string productId, string offerId, ProductPurchaseDisplayProperties displayProperties);
function requestProductPurchaseAsync(productId, offerId, displayProperties)
Public Shared Function RequestProductPurchaseAsync (productId As String, offerId As String, displayProperties As ProductPurchaseDisplayProperties) As IAsyncOperation(Of PurchaseResults)

Parameters

productId
String

Platform::String

winrt::hstring

The product ID of the add-on to purchase.

offerId
String

Platform::String

winrt::hstring

The specific in-app feature or content within the large purchase catalog represented on the Microsoft Store by the productId. This value correlates with the content your app is responsible for fulfilling. The Microsoft Store only uses this value to itemize the PurchaseResults.

displayProperties
ProductPurchaseDisplayProperties

The name of the app feature or content offer that is displayed to the user at time of purchase.

Returns

A PurchaseResults that contains the results of the in-app product purchase request.

Attributes

Remarks

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

See also

Applies to