Share via


CurrentAppSimulator.RequestProductPurchaseAsync 方法

定義

多載

RequestProductPurchaseAsync(String)

建立異步操作,以顯示用來模擬從 Microsoft Store 購買附加元件 (也稱為應用程式內產品或 IAP) 的 UI。

RequestProductPurchaseAsync(String, Boolean)

注意

[RequestProductPurchaseAsync (String, Boolean) 可能會在Windows 8.1之後變更或無法使用。 請改用 RequestProductPurchaseAsync (String)

建立異步操作,以顯示用來模擬從 Microsoft Store 購買附加元件 (也稱為應用程式內產品或 IAP) 的 UI。

RequestProductPurchaseAsync(String, String, ProductPurchaseDisplayProperties)

建立異步操作,以顯示用來模擬從 Microsoft Store 購買附加元件 (也稱為應用程式內產品或 IAP) 的 UI。 此多載包含參數,可用來在市集內單一產品專案所代表的大型應用程式內購買目錄中,顯示特定供應專案的詳細資料。

RequestProductPurchaseAsync(String)

建立異步操作,以顯示用來模擬從 Microsoft Store 購買附加元件 (也稱為應用程式內產品或 IAP) 的 UI。

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)

參數

productId
String

Platform::String

winrt::hstring

產品識別碼 (,如要購買附加元件的模擬) 所定義。

傳回

PurchaseResults,其中包含模擬應用程式內產品購買要求的結果。

屬性

備註

使用 WindowsStoreProxy.xml 檔案中的 CurrentApp/ListingInformation/Product 元素,以及符合 ProductId 做為傳回物件成員之資料來源的 ProductId 屬性。 如果購買成功,授權狀態只會在記憶體中更新。 不會變更 WindowsStoreProxy.xml 的內容。 如需詳細資訊,請參閱 搭配 CurrentAppSimulator 使用 WindowsStoreProxy.xml 檔案

您可以在程式碼範例中看到如何使用此方法 的範例

另請參閱

適用於

RequestProductPurchaseAsync(String, Boolean)

注意

[RequestProductPurchaseAsync (String, Boolean) 可能會在Windows 8.1之後變更或無法使用。 請改用 RequestProductPurchaseAsync (String)

建立異步操作,以顯示用來模擬從 Microsoft Store 購買附加元件 (也稱為應用程式內產品或 IAP) 的 UI。

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)

參數

productId
String

Platform::String

winrt::hstring

產品識別碼 (,如要購買附加元件的模擬) 所定義。

includeReceipt
Boolean

bool

判斷方法是否應該傳回指定productId的收據。

傳回

IAsyncOperation<String>

IAsyncOperation<Platform::String>

IAsyncOperation<winrt::hstring>

字串,提供所提供 productId的應用程式內產品購買詳細資料。 如果 includeReceipt 設定 為 true,則傳回的字串將會包含完整的收據 xml。

屬性

備註

RequestProductPurchaseAsync (String) 的備註也適用于此多載。

若要在成功呼叫此多載之後確認產品授權是否為作用中,請使用 LicenseInformation.IsActive 屬性。

您可以在程式碼範例中看到如何使用此方法 的範例

另請參閱

適用於

RequestProductPurchaseAsync(String, String, ProductPurchaseDisplayProperties)

建立異步操作,以顯示用來模擬從 Microsoft Store 購買附加元件 (也稱為應用程式內產品或 IAP) 的 UI。 此多載包含參數,可用來在市集內單一產品專案所代表的大型應用程式內購買目錄中,顯示特定供應專案的詳細資料。

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)

參數

productId
String

Platform::String

winrt::hstring

產品識別碼 (,如要購買附加元件的模擬) 所定義。

offerId
String

Platform::String

winrt::hstring

productId在 Microsoft Store 上代表的大型購買類別目錄內特定應用程式內產品。此值會與應用程式負責履行的內容相互關聯。 Microsoft Store 只會使用此參數值來將 PurchaseResults專案化。

displayProperties
ProductPurchaseDisplayProperties

在購買時向使用者顯示的應用程式內產品名稱。

傳回

PurchaseResults,其中包含模擬應用程式內產品購買要求的結果。

屬性

備註

RequestProductPurchaseAsync (String) 的備註也適用于此多載。

另請參閱

適用於