问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/15999604/windows-8-store-app-how-do-i-test-in-app-purchase