StoreContext.RequestPurchaseAsync StoreContext.RequestPurchaseAsync StoreContext.RequestPurchaseAsync StoreContext.RequestPurchaseAsync StoreContext.RequestPurchaseAsync Method

Definition

Overloads

RequestPurchaseAsync(String) RequestPurchaseAsync(String) RequestPurchaseAsync(String) RequestPurchaseAsync(String) RequestPurchaseAsync(String)

Requests the purchase for the specified app or add-on and displays the UI that is used to complete the transaction via the Microsoft Store.

Important

This method must be called on the UI thread.

RequestPurchaseAsync(String, StorePurchaseProperties) RequestPurchaseAsync(String, StorePurchaseProperties) RequestPurchaseAsync(String, StorePurchaseProperties) RequestPurchaseAsync(String, StorePurchaseProperties) RequestPurchaseAsync(String, StorePurchaseProperties)

Requests the purchase for the specified app or add-on and displays the UI that is used to complete the transaction via the Microsoft Store. This method provides the option to specify additional details for a specific offer within a large catalog of products that are represented by a single listing in the Microsoft Store, including the product name to display to the user during the purchase.

Important

This method must be called on the UI thread.

RequestPurchaseAsync(String) RequestPurchaseAsync(String) RequestPurchaseAsync(String) RequestPurchaseAsync(String) RequestPurchaseAsync(String)

Requests the purchase for the specified app or add-on and displays the UI that is used to complete the transaction via the Microsoft Store.

Important

This method must be called on the UI thread.

public : IAsyncOperation<StorePurchaseResult> RequestPurchaseAsync(Platform::String storeId)
IAsyncOperation<StorePurchaseResult> RequestPurchaseAsync(winrt::hstring storeId) const;
public IAsyncOperation<StorePurchaseResult> RequestPurchaseAsync(String storeId)
Public Function RequestPurchaseAsync(storeId As String) As IAsyncOperation(Of StorePurchaseResult)
Windows.Services.Store.StoreContext.requestPurchaseAsync(storeId).done( /* Your success and error handlers */ );

Parameters

storeId
String String String

The Store ID of the app or the add-on that you want to purchase for the current user.

Returns

An asynchronous operation that, on successful completion, returns a StorePurchaseResult object that provides status and error info about the purchase.

Exceptions

COMException COMException COMException

If the ErrorCode property of the exception has the value 0x80070578 (ERROR_INVALID_WINDOW_HANDLE), this indicates that the method was not called on the UI thread. If you are calling this method in a desktop application that uses the Desktop Bridge, this can also indicate that you did not configure the StoreContext object to specify which application window is the owner window for modal dialogs shown by this method. For more information, see this article.

Remarks

For more information about using this method, including a code example, see Enable in-app purchases of apps and add-ons.

The Store ID for an app or add-on is available in Partner Center, and it is returned by the StoreId property of the StoreProduct that represents the app or add-on.

See Also

RequestPurchaseAsync(String, StorePurchaseProperties) RequestPurchaseAsync(String, StorePurchaseProperties) RequestPurchaseAsync(String, StorePurchaseProperties) RequestPurchaseAsync(String, StorePurchaseProperties) RequestPurchaseAsync(String, StorePurchaseProperties)

Requests the purchase for the specified app or add-on and displays the UI that is used to complete the transaction via the Microsoft Store. This method provides the option to specify additional details for a specific offer within a large catalog of products that are represented by a single listing in the Microsoft Store, including the product name to display to the user during the purchase.

Important

This method must be called on the UI thread.

public : IAsyncOperation<StorePurchaseResult> RequestPurchaseAsync(Platform::String storeId, StorePurchaseProperties storePurchaseProperties)
IAsyncOperation<StorePurchaseResult> RequestPurchaseAsync(winrt::hstring storeId, StorePurchaseProperties storePurchaseProperties) const;
public IAsyncOperation<StorePurchaseResult> RequestPurchaseAsync(String storeId, StorePurchaseProperties storePurchaseProperties)
Public Function RequestPurchaseAsync(storeId As String, storePurchaseProperties As StorePurchaseProperties) As IAsyncOperation(Of StorePurchaseResult)
Windows.Services.Store.StoreContext.requestPurchaseAsync(storeId, storePurchaseProperties).done( /* Your success and error handlers */ );

Parameters

storeId
String String String

The Store ID of the app or the add-on that you want to purchase for the current user.

storePurchaseProperties
StorePurchaseProperties StorePurchaseProperties StorePurchaseProperties

An object that specifies additional info for the purchase request, including the product name to display to the user during the purchase.

Returns

An asynchronous operation that, on successful completion, returns a StorePurchaseResult object that provides status and error info about the purchase.

Exceptions

COMException COMException COMException

If the ErrorCode property of the exception has the value 0x80070578 (ERROR_INVALID_WINDOW_HANDLE), this indicates that the method was not called on the UI thread. If you are calling this method in a desktop application that uses the Desktop Bridge, this can also indicate that you did not configure the StoreContext object to specify which application window is the owner window for modal dialogs shown by this method. For more information, see this article.

Remarks

The Store ID for an app or add-on is available in Partner Center, and it is returned by the StoreId property of the StoreProduct that represents the app or add-on.

See Also