-api-id | -api-type |
---|---|
M:Windows.Services.Store.StoreProduct.RequestPurchaseAsync(Windows.Services.Store.StorePurchaseProperties) |
winrt method |
Requests the purchase of the default SKU and availability for the product 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.
An object that specifies additional info for the purchase request, including the product name to display to the user during the purchase.
An asynchronous operation that, on successful completion, returns a StorePurchaseResult object that provides status and error info about the purchase.
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.
RequestPurchaseAsync, Enable in-app purchases of apps and add-ons