I am trying to put together code that simulates purchases for a Windows 8 (Store) app.
The code is pretty simple and uses the Windows API:
var result = await CurrentAppSimulator.RequestProductPurchaseAsync("product", true);
// this is still false...
var active = CurrentAppSimulator.LicenseInformation.ProductLicenses["product"].IsActive;
The first call opens up the dialog that allows me to simulate the return code from the purchase.
Even when i select S_OK, the next line still checks to see if the license is active and returns false.
What is wrong here?
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.
You don't have to manually edit the XML everytime, CurrentAppSimulator does it automatically.
Just check your setting in the WindowsStoreProxy.xml and ensure that 'IsTrial' is set 'false'-
<LicenseInformation>
<App>
<IsActive>true</IsActive>
<IsTrial>false</IsTrial>
</App>
<Product ProductId="1">
<IsActive>false</IsActive>
</Product>
</LicenseInformation>
Remember - In-app purchases does not work in Trial version of the app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With