CurrentApp.RequestProductPurchaseAsync 方法

定義

多載

RequestProductPurchaseAsync(String)

要求購買附加元件 (也稱為應用程式內產品或 IAP) 。 此外,呼叫這個方法會顯示用來透過 Microsoft Store 完成交易的 UI。

RequestProductPurchaseAsync(String, Boolean)

注意

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

要求購買附加元件 (也稱為應用程式內產品或 IAP) 。 此外,呼叫這個方法會顯示用來透過 Microsoft Store 完成交易的 UI。

RequestProductPurchaseAsync(String, String, ProductPurchaseDisplayProperties)

要求購買附加元件 (也稱為應用程式內產品或 IAP) 。 此外,呼叫這個方法會顯示用來透過 Microsoft Store 完成交易的 UI。 此多載包含參數,可用來在市集內單一產品專案所代表的大型應用程式內購買目錄中,顯示特定供應專案的詳細資料。

RequestProductPurchaseAsync(String)

要求購買附加元件 (也稱為應用程式內產品或 IAP) 。 此外,呼叫這個方法會顯示用來透過 Microsoft Store 完成交易的 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,其中包含應用程式內產品購買要求的結果。

屬性

備註

產品識別碼是應用程式用來識別附加元件的字串。 您在合作夥伴中心提交附加元件時輸入產品識別碼,其中它與描述、價格區間和存留期相關聯。 如需詳細資訊,請參閱 如何在程式碼中使用附加元件的產品識別碼。

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

另請參閱

適用於

RequestProductPurchaseAsync(String, Boolean)

注意

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

要求購買附加元件 (也稱為應用程式內產品或 IAP) 。 此外,呼叫這個方法會顯示用來透過 Microsoft Store 完成交易的 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)

要求購買附加元件 (也稱為應用程式內產品或 IAP) 。 此外,呼叫這個方法會顯示用來透過 Microsoft Store 完成交易的 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) 的備註也適用于此多載。

另請參閱

適用於