locked
Problem with in-app purchases modul

    Question

  • Hi,

    I have problem with my metro application which using in-app purchases. Last three times didn't pass certification proccess to Store and now I don't know why and I starting to be helpless, so I need advice. When I tested in-app purchases locally with simulator everything was working right and application too, no crashes. When I packaged app and used Windows App Certification Kit 2.2, application passed all test with 100%. But when I switched in-app purcheses to production mode, I made production package and gave it to certification proccess, didn't pass again.

    In app I have 2 in app purchases and I'm using in code same identification product names as I set in developer account. I put there my function which I used in my app to load store data, where is probably problem why application in production mode didn't pass certification.

     //check application license
        function licenceInitialize() {
    
            console.log('licence init');
    
            var devType = '';
           
            //debug mode
            if (devType == 'debug') {
    
                currentApp = Windows.ApplicationModel.Store.CurrentAppSimulator;
            }
            else { //production mode
    
                currentApp = Windows.ApplicationModel.Store.CurrentApp;
            }
           
    
            //listener for licence changes
            currentApp.licenseInformation.addEventListener("licencechanged", checkLicence);
    
            //save store object for access from all scripts
            Horoscope.currApp = currentApp;
    
            try{
    
                //debug mode
                if (devType == 'debug') {
    
                    //load folder of installation
                    Windows.ApplicationModel.Package.current.installedLocation.getFolderAsync("test").done(function (folder) {
                        console.log('folder:'+folder);
                        //load test store proxy file
                        folder.getFileAsync("WindowsStoreProxy.xml").done(function (file) {
                            console.log('file:'+file);
                            //reload simulator data
                            currentApp.reloadSimulatorAsync(file).done(function () {
                                console.log('reload simulator OK');
                                //load license
                                currentApp.loadListingInformationAsync().done(function (listing) {
                                    console.log('listing OK');
                                    //get price of full horoscope pack 
                                    Horoscope.fullPackPrice = listing.productListings.lookup("appPackFull").formattedPrice;
                                    //check license
                                    checkLicence();
    
                                }, //if lost internet connection
                                function (error) {
                                    console.log('listing ERR:');
                                    var url = scenarios[0].url;
                                    return WinJS.Navigation.navigate(url, { error: 'licence_error' });
                                });
                            });
                        });
                    });
    
    
    
                }
                else {//production mode
    
                    currentApp.loadListingInformationAsync().done(function (listing) {
    
                        //price of full pack license 
                        Horoscope.fullPackPrice = listing.productListings.lookup("horoscopePackFull").formattedPrice;
                        //check license
                        checkLicence();
    
                    }, //if lost internet connection
                    function (error) {
    
                        var url = scenarios[0].url;
                        return WinJS.Navigation.navigate(url, { error: 'licence_error' });
                    });
                }
            } catch (e) {
                var url = scenarios[0].url;
                return WinJS.Navigation.navigate(url, { error: 'licence_error' });
            }
    
        }

    With variable devType I switched between dev nad production mode of in-app purchases. Problem in production mode is probably in loadListingInformationAsync() function, because in review report was shown dialog with warning which I used when during this function is problem get store data.

    If somebody have some advice what I doing wrong or some advice how to solve this problem I will be thankfull.

    Friday, January 4, 2013 7:26 PM