locked
requestProductPurchaseAsync doesn't change isActive

    Question

  • I've read pretty much all related threads in this forum but I can't find an answer. Here's my scenario:

    I am trying to add an in-app purchase to my app (to remove advertiesements permanently). From what I understand, I have to call requestProductPurchaseAsync to trigger a purchase - be it on Windows.ApplicationModel.Store.CurrentAppSimulator or CurrentApp (latter is theoretically possible because the app is already in the store and the in-app purchase exists - I just haven't added a "purchase" button yet).

    But I already struggle at getting the simulated purchase to work. When I click the purchase button, I get this window:

    Fair enough, if I select an error code my error handler will execute. If i select S_OK (I guess that means purchase) then the success handler will run. However, the documentation states that the success handler will also run if the user cancels the purchase and I verified that this is true. But what do I do then? How can I distinguish between an actual purchase and someone who changed his mind and clicked "Cancel" instead? The documentation also tells me to verify the reciept which is not only quite complex (since the only sample code I found is in a different language) but also how am I supposed to ever test that? The CurrentAppSimularo's requestProductPurchaseAsync method does only return blank reciepts as far as I can tell.

    I tried to check some variables in the success handler but to no avail:

    The part that confuses me the most is that, according to the documentation, "the license state is updated only in memory". But why is the isActive property still set to false? If at least it was true, I might just forget about the reciept verification and move on.

    Can someone please explain this?

    Saturday, March 16, 2013 11:45 PM

Answers

  • All right, I did some further research and figured out what was causing the problem.

    I stumbled over this page: http://stackoverflow.com/questions/12435356/currentappsimulator-requestproductpurchaseasync-purchasing-simulation. Basically they say that you cannot make in-app purchases if the app is trial. While my app does not have a trial mode, I noticed that they also mentioned a file called WindowsStoreProxy.xml which I also read in the docs. However, there was no information about what that file is, where it is and why I should care about it.

    Doing some further googling about the file name revealed another forum thread from which I figured out where to find that file. After editing the product name and isActive state in the file several times, I recalled what I had read on stackoverflow before and the file did actually claim that my app was in trial mode. After disabling the trial mode - the in-app purchase finally works as intended.

    Still I'm wondering wher that XML file came from and why the trial mode was set to true. Is there no documention about that? Searching for "WindowsStoreProxy.xml" in this forum/documentations does not bring up any useful results for me.

    • Marked as answer by Akinzekeel Monday, March 18, 2013 6:32 PM
    Monday, March 18, 2013 6:29 PM