Windows 8 Store App, how do I test in-app purchase?
Asked Answered
C

1

3

My app is created with Javascript. I need it to support in-app purchase for feature unlocking.

From the documentation, it looks really simple. However, when I tries to implement it. I noticed that after returning S_OK from CurrentAppSimulator.requestProductPurchaseAsync, CurrentAppSimulator.licenseInformation.productLicenses.lookup(main.licenseName).isActive won't be changed to true.

Then I discovered this answer CurrentAppSimulator.RequestProductPurchaseAsync purchasing simulation , mentioning something about calling RequestAppPurchaseAsync once before requestProductPurchaseAsync. I did, and this way, I saw the Store popup twice. And after choosing S_OK twice, isActive is set to true. However, this status is not persistent. Running this app (by pressing F5 to debug) the second time will clear this flag and the entire purchase procedure has to be run again.

The answer also mentioned only about "correct simulation" but said nothing about whether this procedure is correct for live store app. I currently have a Windows Store developer account configured for in-app purchase, but binaries are not uploaded yet. When I try purchase with CurrentApp I got the message that the product is no longer available from Windows Store.

I'd like some viable options to make sure that my in-app purchase is correctly implemented.

Colliery answered 14/4, 2013 at 13:28 Comment(1)
I am working with phonegap (javascript) and am looking for javascript code / native bridge so I can complete in app purchases in windows 8. Can you post some example code? Thanks.Vieva
G
3

Are you updating the WindowsStoreProxy.xml file? You have to do that otherwise the purchase will never be set to active. You don't need to call RequestAppPurchaseAsync... only the requestProductPurchaseAsync. Do this...

  • Run your app in debug mode breaking anywhere
  • Open QuickWatch (SHIFT + F9) and enter Windows.Storage.ApplicationData.current.roamingFolder.path and copy the value (mine was C:\Users\jerfost\AppData\Local\Packages\{package name}\LocalState
  • Browse to that location and open the Microsoft\Windows Store\ApiData directory
  • Open the WindowsStoreProxy.xml file in a text editor
  • Change CurrentApp/LicenseInformation/App/IsTrial to false
  • Change CurrentApp/ListingInformation/Product/MarketData/Name to your unique product name

That should do it. Hope that helps.

Grosmark answered 15/4, 2013 at 14:21 Comment(3)
I'm sorry but where did you get this info? This is not mentioned in msdn.microsoft.com/en-us/library/windows/apps/hh694067.aspx .Colliery
Am I supposed to update this WindowsStoreProxy.xml programmatically myself? Like plain file reading and writing? There's no API for that? Or will the real CurrentApp do this by itself?Colliery
Okay, according to the information I got from the Microsoft Forum, the whole thing about WindowsStoreProxy.xml is related to the simulator only, and the simulator do not persist license data. CurrentApp class will take care of everything. Source: social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/…Colliery

© 2022 - 2024 — McMap. All rights reserved.