I'm trying to enable in-app purchase in my Metro app, but it doesn't seem to be working at all. I'm getting no error, and the return value is an empty string. My code looks like this:
await CurrentAppSimulator.RequestProductPurchaseAsync("bonus", false);
if (!licenseInformation.ProductLicenses["bonus"].IsActive) {
error="purchase didn't work?";
}
And I get the error. I made sure to have the WindowsStoreProxy.xml file. It looks something like this.
<Product ProductId="bonus" LicenseDuration="10">
<MarketData xml:lang="en-us">
<Name>Bonus pretend feature</Name>
<Price>1.00</Price>
<CurrencySymbol>$</CurrencySymbol>
<CurrencyCode>USD</CurrencyCode>
</MarketData>
</Product>
...
<LicenseInformation>
<App>
<IsActive>true</IsActive>
<IsTrial>true</IsTrial>
</App>
<Product ProductId="bonus">
<IsActive>false</IsActive>
</Product>
</LicenseInformation>
I think this file's read because if I put "true" under , then my app sees this particular product as purchased. I checked the documentation and it looks like I'm doing everything there.
When the code calls RequestProductPurchaseAsync, I get a dialog asking me to choose a return value. I pick S_OK, then click on Continue. I get an empty string as return value. The thing is, I'm getting the same outcome regardless of the string I put in as the first argument.
I must be missing something. What am I doing wrong? How do I diagnose this thing?
EDIT: Apparently the trick to make this work is to make sure your app isn't in trial mode - which is the default.
But how do diagnose this thing? How do I get error messages when things are going wrong, how do I get this API to tell me helpful errors like "purchase failed because app is in trial mode"?