Testing application development in applications using CurrentAppSimulator

I installed an in-app purchase using CurrentAppSimulator and installed the in-app purchase functionality. I also (possibly) set up my WindowsStoreProxy.xml file to handle this.

However, when I buy the addon and give it the return value of S_OK , it still says that the IAP is inactive. The only way I can activate it is to manually edit the WindowsStoreProxy.xml file and set the Active property to Active. This looks pretty weird as the sample store from Microsoft works just fine. I could not see anything else on their part, although they still use the CurrentAppSimulator.RequestProductPurchaseAsync() method. Where am I wrong here ...?

+4
source share
1 answer

First I use my own class CurrentAppProxy, which uses CurrentAppSimulator in Debug mode and CurrentApp in Release. Then I use this code to purchase an InApp purchase, it works fine:

 try { await CurrentAppProxy.RequestProductPurchaseAsync(PremiumName, false); // after closing the inApp purchase dialog, test, if it was bought if (licenseInformation.ProductLicenses[PremiumName].IsActive) { // set the local flag IsPremium = true; dialog = new MessageDialog(resourceLoader.GetString("ThanksForPremium")); await dialog.ShowAsync(); } // else do not show anything } catch (Exception) { // failed buying the premium dialog = new MessageDialog(resourceLoader.GetString("ErrorBuyingPremium")); dialog.ShowAsync(); } 

edit: before accessing these properties, I initialize CurrentAppSimulator in debug mode using this:

 StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("Assets"); StorageFile proxyFile = await proxyDataFolder.GetFileAsync("test-purchase.xml"); await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile); 

and below test-purchase.xml I got:

 <LicenseInformation> <App> <IsActive>true</IsActive> <IsTrial>false</IsTrial> </App> <Product ProductId="premium"> <IsActive>false</IsActive> </Product> </LicenseInformation> 
+6
source

Source: https://habr.com/ru/post/1445962/


All Articles