语言

StoreContext.RequestPurchaseAsync 方法

定义

重载

名称 说明
RequestPurchaseAsync(String, StorePurchaseProperties)

请求购买指定的应用或加载项,并显示用于通过 Microsoft 应用商店完成交易的 UI。 此方法提供了一个选项,用于在Microsoft应用商店中由单个列表表示的大型产品/服务中指定特定产品/服务的其他详细信息,包括在购买过程中向用户显示的产品名称。

重要

必须在 UI 线程上调用此方法。

重要

提升的应用程序不支持应用内购买功能。

RequestPurchaseAsync(String)

请求购买指定的应用或加载项,并显示用于通过 Microsoft 应用商店完成交易的 UI。

重要

必须在 UI 线程上调用此方法。

重要

提升的应用程序不支持应用内购买功能。

RequestPurchaseAsync(String, StorePurchaseProperties)

请求购买指定的应用或加载项,并显示用于通过 Microsoft 应用商店完成交易的 UI。 此方法提供了一个选项,用于在Microsoft应用商店中由单个列表表示的大型产品/服务中指定特定产品/服务的其他详细信息,包括在购买过程中向用户显示的产品名称。

重要

必须在 UI 线程上调用此方法。

重要

提升的应用程序不支持应用内购买功能。

public:
 virtual IAsyncOperation<StorePurchaseResult ^> ^ RequestPurchaseAsync(Platform::String ^ storeId, StorePurchaseProperties ^ storePurchaseProperties) = RequestPurchaseAsync;
/// [Windows.Foundation.Metadata.Overload("RequestPurchaseWithPurchasePropertiesAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<StorePurchaseResult> RequestPurchaseAsync(winrt::hstring const& storeId, StorePurchaseProperties const& storePurchaseProperties);
[Windows.Foundation.Metadata.Overload("RequestPurchaseWithPurchasePropertiesAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<StorePurchaseResult> RequestPurchaseAsync(string storeId, StorePurchaseProperties storePurchaseProperties);
function requestPurchaseAsync(storeId, storePurchaseProperties)
Public Function RequestPurchaseAsync (storeId As String, storePurchaseProperties As StorePurchaseProperties) As IAsyncOperation(Of StorePurchaseResult)

参数

storeId
String

Platform::String

winrt::hstring

要为当前用户购买的应用或加载项的应用商店 ID。

storePurchaseProperties
StorePurchaseProperties

一个对象,指定购买请求的其他信息,包括要显示在购买过程中向用户显示的产品名称。

返回

成功完成后,异步操作将返回 StorePurchaseResult 对象,该对象提供有关购买的状态和错误信息。

属性

例外

如果异常的 ErrorCode 属性具有值0x80070578(ERROR_INVALID_WINDOW_HANDLE),则表示未在 UI 线程上调用该方法。 如果在使用桌面桥的桌面应用程序中调用此方法,则这也表示未配置 <xref href=“Windows。Services.Store.StoreContext?text=StoreContext“ /> 对象,用于指定此方法显示的模式对话框的所有者窗口。 有关详细信息,请参阅本文。

注解

应用或加载项的应用商店 ID 在 合作伙伴中心中提供,它由代表应用或加载项的 StoreProduct 的 StoreId 属性返回。

另请参阅

适用于

RequestPurchaseAsync(String)

请求购买指定的应用或加载项,并显示用于通过 Microsoft 应用商店完成交易的 UI。

重要

必须在 UI 线程上调用此方法。

重要

提升的应用程序不支持应用内购买功能。

public:
 virtual IAsyncOperation<StorePurchaseResult ^> ^ RequestPurchaseAsync(Platform::String ^ storeId) = RequestPurchaseAsync;
/// [Windows.Foundation.Metadata.Overload("RequestPurchaseAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<StorePurchaseResult> RequestPurchaseAsync(winrt::hstring const& storeId);
[Windows.Foundation.Metadata.Overload("RequestPurchaseAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<StorePurchaseResult> RequestPurchaseAsync(string storeId);
function requestPurchaseAsync(storeId)
Public Function RequestPurchaseAsync (storeId As String) As IAsyncOperation(Of StorePurchaseResult)

参数

storeId
String

Platform::String

winrt::hstring

要为当前用户购买的应用或加载项的应用商店 ID。

返回

成功完成后,异步操作将返回 StorePurchaseResult 对象,该对象提供有关购买的状态和错误信息。

属性

例外

如果异常的 ErrorCode 属性具有值0x80070578(ERROR_INVALID_WINDOW_HANDLE),则表示未在 UI 线程上调用该方法。 如果在使用桌面桥的桌面应用程序中调用此方法,则这也表示未配置 <xref href=“Windows。Services.Store.StoreContext?text=StoreContext“ /> 对象,用于指定此方法显示的模式对话框的所有者窗口。 有关详细信息,请参阅本文。

注解

有关使用此方法的详细信息(包括代码示例)请参阅 启用应用内购买和加载项。

应用或加载项的应用商店 ID 在 合作伙伴中心中提供,它由代表应用或加载项的 StoreProduct 的 StoreId 属性返回。

另请参阅

适用于