UWP - How to check if in-app products were bought previously?

时间:2015-06-30 13:41:25

标签: c# windows-runtime windows-phone-8.1

I have a WinRT app that makes use of the Windows Phone Store to create in-app purchases. Once the user bought the durable in-app purchase, a boolean in the app settings will be set to true.

Now if the user uninstall the app, and re-installs it the boolean will be set to false obviously. The user can then go to the in-app purchase and buy it again: however, the Store will indicate that the user already bought this in-app purchase and it can install it again without additional costs.

Now - is it possible to get a list of in-app purchases that the user already bought, so I can enable the features by default (without having the user go to the purchase page again)?

Niels

1 个答案:

答案 0 :(得分:1)

Using the LicenseInformation object you can directly check if an In-App Purchase has been made by that user. See this page for details, specifically the "Code the feature in a conditional block" section. In general, it is:

CurrentAppSimulator.LicenseInformation.ProductLicenses["IAPKey"].IsActive