StoreContext.RequestPurchaseAsync 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| RequestPurchaseAsync(String, StorePurchaseProperties) |
要求購買指定的應用程式或附加元件,並顯示用來透過 Microsoft Store 完成交易的 UI。 這個方法提供選項,可在Microsoft市集中單一清單所代表的大型產品目錄中,指定特定供應專案的其他詳細數據,包括購買期間向用戶顯示的產品名稱。 重要 必須在UI線程上呼叫這個方法。 重要 在提升級應用程式中不支援應用程式內購買功能。 |
| RequestPurchaseAsync(String) |
要求購買指定的應用程式或附加元件,並顯示用來透過 Microsoft Store 完成交易的 UI。 重要 必須在UI線程上呼叫這個方法。 重要 在提升級應用程式中不支援應用程式內購買功能。 |
RequestPurchaseAsync(String, StorePurchaseProperties)
要求購買指定的應用程式或附加元件,並顯示用來透過 Microsoft Store 完成交易的 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
您要為目前使用者購買之應用程式的市集標識碼或附加元件。
- storePurchaseProperties
- StorePurchaseProperties
物件,指定購買要求的其他資訊,包括購買期間向用戶顯示的產品名稱。
傳回
成功完成時,異步操作會傳回 StorePurchaseResult 物件,以提供購買狀態和錯誤資訊。
- 屬性
例外狀況
如果例外狀況的 ErrorCode 屬性具有值 0x80070578 (ERROR_INVALID_WINDOW_HANDLE),這表示 UI 線程上未呼叫方法。 如果你是在使用桌面橋接器的桌面應用程式中呼叫此方法,這也可能表示你沒有設定 <xref href=“Windows。Services.Store.StoreContext?text=StoreContext“ /> 物件用來指定哪個應用程式視窗是模態對話的擁有者視窗。 如需詳細資訊,請參閱本文
備註
應用程式或附加元件市集標識符可在合作夥伴中心
另請參閱
適用於
RequestPurchaseAsync(String)
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
您要為目前使用者購買之應用程式的市集標識碼或附加元件。
傳回
成功完成時,異步操作會傳回 StorePurchaseResult 物件,以提供購買狀態和錯誤資訊。
- 屬性
例外狀況
如果例外狀況的 ErrorCode 屬性具有值 0x80070578 (ERROR_INVALID_WINDOW_HANDLE),這表示 UI 線程上未呼叫方法。 如果你是在使用桌面橋接器的桌面應用程式中呼叫此方法,這也可能表示你沒有設定 <xref href=“Windows。Services.Store.StoreContext?text=StoreContext“ /> 物件用來指定哪個應用程式視窗是模態對話的擁有者視窗。 如需詳細資訊,請參閱本文
備註
如需使用此方法的詳細資訊,包括程式碼範例,請參閱 啟用應用程式內購買和附加元件。
應用程式或附加元件市集標識符可在合作夥伴中心