模拟Windows 8商店应用购买

我正在尝试将模拟购买的代码放在一起,用于Windows 8(商店)应用。

代码非常简单并使用Windows API:

var result = await CurrentAppSimulator.RequestProductPurchaseAsync("product", true); // this is still false... var active = CurrentAppSimulator.LicenseInformation.ProductLicenses["product"].IsActive; 

第一个调用打开对话框,允许我模拟购买的返回代码。

即使我选择S_OK,下一行仍会检查许可证是否处于活动状态并返回false。

这有什么不对?

您是否正在更新WindowsStoreProxy.xml文件? 您必须这样做,否则购买永远不会被设置为活动。 您不需要调用RequestAppPurchaseAsync...只需要requestProductPurchaseAsync. 做这个…

在调试模式下运行应用程序,打破任何地方打开QuickWatch(SHIFT + F9)并输入Windows.Storage.ApplicationData.current.roamingFolder.path并复制值(我的是C:\Users\jerfost\AppData\Local\Packages\{package name}\LocalState浏览到该位置并打开Microsoft \ Windows Store \ ApiData目录在文本编辑器中打开WindowsStoreProxy.xml文件将CurrentApp/LicenseInformation/App/IsTrial更改为false将CurrentApp/ListingInformation/Product/MarketData/Name更改为您的独特的产品名称应该这样做。希望有所帮助。

您不必每次都手动编辑XML,CurrentAppSimulator会自动进行编辑。

只需检查WindowsStoreProxy.xml中的设置,并确保’IsTrial’设置为’false’ –

   true false   false   

请记住 – 应用内购买在应用的试用版中无效。