Home Ask Login Register

Developers Planet

Your answer is one click away!

serpaulius February 2016

Purchase simulation dialog does not show up (CurrentAppSimulator.RequestProductPurchaseAsync)

I was developing an app for Windows 8. After a while I updated the project to Windows 8.1 and I got a warning, that the method CurrentAppSimulator.RequestProductPurchaseAsync(String, Boolean) from the CurrentAppSimulator class is deprecated. So I started using CurrentAppSimulator.RequestProductPurchaseAsync(String) version of it, and for some reason the purchase simulation dialog does not show up at all. Here is a dialog I was getting using deprecated version of the method.

I never needed the WindowsStoreProxy.xml before, but just in case I checked it and set the IsTrial property to false - however, the dialog does not show up, and the answer of the new method CurrentAppSimulator.RequestProductPurchaseAsync(String) always returns ProductPurchaseStatus::NotPurchased.

Maybe someone knows where is the problem?


serpaulius February 2016

The NotPurchased is returned, because the file WindowsStoreProxy.xml that is used by CurrentAppSimulator does not contain the requested product. You need to fill WindowsStoreProxy.xml with all the products you are providing to the app user. Here are some examples, written by Microsoft.

WindowsStoreProxy.xml is created on the first launch of the app in this location:

C:\Users\<username>\AppData\Local\Packages\<app package folder>\LocalState\Microsoft\Windows Store\ApiData\WindowsStoreProxy.xml

Also, after every CurrentAppSimulator.RequestProductPurchaseAsync(String) call, when result is ProductPurchaseStatus.Succeeded you need to do two things:

  1. Grant user the product (e.g. purchased item)
  2. Inform Store, that the product fulfillment is completed successfuly - using method CurrentApp.ReportConsumableFulfillmentAsync(String, Guid). Make sure, that the FulfillmentResult that is returned afterwards is FulfillmentResult::Succeeded

After these steps your item should be successfully purchased and fulfilled.

Check out detailed explanation: Enable consumable in-app product purchases.

And if you need more clarification of what each FulfillmentResult means for the purchase, you can look up a really good explanation in the book "Universal Windows Apps with XAML and C# Unleashed" by Adam Nathan, that I found while googling these things.

Post Status

Asked in February 2016
Viewed 1,698 times
Voted 8
Answered 1 times


Leave an answer

Quote of the day: live life