CurrentApp.RequestProductPurchaseAsync | requestProductPurchaseAsync method
Creates the async operation that will display the UI that is used to make an in-app purchase from the Windows Store.
Syntax
Windows.ApplicationModel.Store.CurrentApp.requestProductPurchaseAsync(productId, includeReceipt).done( /* Your success and error handlers */ );
Parameters
- productId
-
Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]
Specifies the id of the product or feature to purchase.
- includeReceipt
-
Type: Boolean [JavaScript] | System.Boolean [.NET] | Platform::Boolean [C++]
Determines if the method should return the receipts for the specified productId.
Return value
Type: IAsyncOperation<String>
If the includeReceipt parameter is set to true, this string contains XML that represents all receipts for specified productId. If includeReceipt is set to false, this string is empty.
Remarks
This method returns a success value even if:
- there's no network connection available
- the user cancels out of the dialog
- the user's authentication fails
The XML-formatted string that this method returns uses these elements:
| Element Name | Description | Child Elements | Attributes |
|---|---|---|---|
| Receipt | Contains information about app and in-app purchases |
AppReceipt ProductReceipt Signature |
Version: The version number of the receipt. CertificateId: The certificate thumbprint used to sign the receipt. ReceiptDate: Date the receipt was signed and downloaded. ReceiptDeviceId: Identifies the device used to request this receipt. |
| AppReceipt | Contains information about an app purchase. | None. |
Id: Identifies the purchase. AppId: The Package Family Name value that the OS uses for the app. LicenseType: Full, if the user purchased the full version of the app. Trial, if the user downloaded a trial version of the app. PurchaseDate: Date when the app was acquired. |
| ProductReceipt | Contains information about in-app purchases. | None. |
Id: Identifies the purchase. AppId: Identifies the app through which the user made the purchase. ProductId: Identifies the product purchased. ProductType: Determines the product type. Currently only supports a value of PurchaseDate: Date when the purchase occurred. |
| Signature | Contains the signature for the receipt and information on how the receipt was digitally signed. |
SignedInfo SignatureValue | This element is a standard XML-DSIG construct. It contains a SignatureValue element, which contains the signature you can use to validate the receipt. |
To verify a receipt's authenticity, you can check the receipt's signature using the public certificate. To get this certificate, use the following URL:
https://go.microsoft.com/fwlink/p/?linkid=246509&cid=<CertificateId>
where <CertificateId> is the CertificateId of the receipt.
Requirements
|
Minimum supported client | Windows 8 |
|---|---|
|
Minimum supported server | Windows Server 2012 |
|
Minimum supported phone | Windows Phone 8 |
|
Namespace |
|
|
Metadata |
|
See also
Build date: 2/25/2013
