{"action":"created","issue":{"url":"https://api.github.com/repos/j3k0/cordova-plugin-purchase/issues/346","labels_url":"https://api.github.com/repos/j3k0/cordova-plugin-purchase/issues/346/labels{/name}","comments_url":"https://api.github.com/repos/j3k0/cordova-plugin-purchase/issues/346/comments","events_url":"https://api.github.com/repos/j3k0/cordova-plugin-purchase/issues/346/events","html_url":"https://github.com/j3k0/cordova-plugin-purchase/issues/346","id":118055460,"number":346,"title":"plugin not working","user":{"login":"nnylip","id":15943434,"avatar_url":"https://avatars.githubusercontent.com/u/15943434?v=3","gravatar_id":"","url":"https://api.github.com/users/nnylip","html_url":"https://github.com/nnylip","followers_url":"https://api.github.com/users/nnylip/followers","following_url":"https://api.github.com/users/nnylip/following{/other_user}","gists_url":"https://api.github.com/users/nnylip/gists{/gist_id}","starred_url":"https://api.github.com/users/nnylip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nnylip/subscriptions","organizations_url":"https://api.github.com/users/nnylip/orgs","repos_url":"https://api.github.com/users/nnylip/repos","events_url":"https://api.github.com/users/nnylip/events{/privacy}","received_events_url":"https://api.github.com/users/nnylip/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-20T14:46:14Z","updated_at":"2015-11-20T19:20:05Z","closed_at":null,"body":"I'm attempting to use the cc.fovea.cordova.purchase plugin with cordova.\r\nPlugin installed using: cordova plugin add cc.fovea.cordova.purchase\r\ncordova version: 5.3.3\r\nplugin version: cc.fovea.cordova.purchase 4.0.0 \"Purchase\"\r\nUsing a slimmed down version of the example, code:\r\n$(document).ready(function() {\r\n\tdocument.addEventListener(\"deviceready\", onDeviceReady, false);\r\n\r\n   function onDeviceReady()\r\n   {\r\n\t\tinitStore();\r\n\t}\r\n\r\n});\r\n\r\n// cordova plugin add cc.fovea.cordova.purchase\r\ninitStore = function() {\r\n\r\n    if (!window.store) {\r\n        log('Store not available');\r\n        return;\r\n    }\r\n  else console.log('store is running')\r\n    var platform = device.platform.toLowerCase();\r\n    document.getElementsByTagName('body')[0].className = platform;\r\n\r\n    // Enable maximum logging level\r\n    store.verbosity = store.DEBUG;\r\n\r\n    // Enable remote receipt validation\r\n    //store.validator = \"https://api.fovea.cc:1982/check-purchase\";\r\n\r\n    // Inform the store of your products\r\n    //console.log('registerProducts');\r\n\r\nlog('registering')\r\n    store.register({\r\n        id:    'lplcoins', // id without package name! com.lpl.lplcoins\r\n        alias: 'lplcoins',\r\n        type:  store.PAID_SUBSCRIPTION\r\n    });\r\nlog('done registering')\r\n\r\n    // When any product gets updated, refresh the HTML.\r\n    store.when(\"lplcoins\").updated(function (p) {\r\n        app.renderIAP(p);\r\n    });\r\n\r\n    store.when(\"lplcoins\").approved(function(p) {\r\n        log(\"verify subscription\");\r\n        p.verify();\r\n    });\r\n    store.when(\"lplcoins\").verified(function(p) {\r\n        log(\"subscription verified\");\r\n        p.finish();\r\n    });\r\n    store.when(\"lplcoins\").unverified(function(p) {\r\n        log(\"subscription unverified\");\r\n    });\r\n    store.when(\"lplcoins\").updated(function(p) {\r\n\t\t//if (true) {\r\n        if (p.owned) {\r\n            document.getElementById('subscriber-info').innerHTML = 'You are a lucky subscriber!';\r\n        }\r\n        else {\r\n            document.getElementById('subscriber-info').innerHTML = 'You are not subscribed';\r\n        }\r\n    });\r\n\r\n    // Log all errors\r\n    store.error(function(error) {\r\n        log('ERROR ' + error.code + ': ' + error.message);\r\n    });\r\n\r\n    // When purchase of an extra life is approved,\r\n    // deliver it... by displaying logs in the console.\r\n    store.when(\"lplcoins\").approved(function (order) {\r\n        log(\"You got an EXTRA LIFE!\");\r\n        order.finish();\r\n    });\r\n\r\n    // When purchase of the full version is approved,\r\n    // show some logs and finish the transaction.\r\n    store.when(\"lplcoins\").approved(function (order) {\r\n        log('You just unlocked the FULL VERSION!');\r\n        order.finish();\r\n    });\r\n\r\n    // The play button can only be accessed when the user\r\n    // owns the full version.\r\n    store.when(\"lplcoins\").updated(function (product) {\r\n        document.getElementById(\"access-full-version-button\").style.display =\r\n            product.owned ? \"block\" : \"none\";\r\n    });\r\n\r\n    // When the store is ready (i.e. all products are loaded and in their \"final\"\r\n    // state), we hide the \"loading\" indicator.\r\n    //\r\n    // Note that the \"ready\" function will be called immediately if the store\r\n    // is already ready.\r\n    store.ready(function() {\r\n        var el = document.getElementById(\"loading-indicator\");\r\n        if (el) el.style.display = 'none';\r\n    });\r\n\r\n    // When store is ready, activate the \"refresh\" button;\r\n    store.ready(function() {\r\n\t\t\tlog('store is ready')\r\n        var el = document.getElementById('refresh-button');\r\n        if (el) {\r\n            el.style.display = 'block';\r\n            el.onclick = function(ev) {\r\n\t\t\t\t\tlog('register pressed')\r\n\t                store.refresh();\r\n            };\r\n        }\r\n    });\r\n    console.log('refresh');\r\n    store.refresh();\r\n};\r\nlog = function(arg) {\r\n    try {\r\n        if (typeof arg !== 'string') arg = JSON.stringify(arg);\r\n        console.log('<div>' + arg + '</div>');\r\n\r\n        $(\"#talog\").append( arg+'\\n' );\r\n        $(\"#talog\").each(function () {\r\n        this.style.height = (this.scrollHeight+10)+'px';\r\n    });\r\n        //document.getElementById('log').innerHTML += '<div>' + arg + '</div>';\r\n    } catch (e) {}\r\n};\r\n\r\nI'm getting this output in xcode:\r\n2015-11-20 09:31:48.179 lplcoins[5535:1825275] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///private/var/mobile/Containers/Data/Application/74E27E88-3756-424A-BB5B-D888C474FE3F/Library/Cookies/Cookies.binarycookies\r\n2015-11-20 09:31:48.463 lplcoins[5535:1825275] Apache Cordova native platform version 3.9.2 is starting.\r\n2015-11-20 09:31:48.466 lplcoins[5535:1825275] Multi-tasking -> Device: YES, App: YES\r\n2015-11-20 09:31:48.475 lplcoins[5535:1825275] Unlimited access to network resources\r\n2015-11-20 09:31:48.483 lplcoins[5535:1825275] \r\n\r\nStarted backup to iCloud! Please be careful.\r\nYour application might be rejected by Apple if you store too much data.\r\nFor more information please read \"iOS Data Storage Guidelines\" at:\r\nhttps://developer.apple.com/icloud/documentation/data-storage/\r\nTo disable web storage backup to iCloud, set the BackupWebStorage preference to \"local\" in the Cordova config.xml file\r\n\r\n2015-11-20 09:31:48.685 lplcoins[5535:1825275] [CDVTimer][file] 64.508021ms\r\n2015-11-20 09:31:48.685 lplcoins[5535:1825275] [CDVTimer][TotalPluginStartup] 65.097988ms\r\n2015-11-20 09:31:49.143 lplcoins[5535:1825275] Resetting plugins due to page load.\r\n2015-11-20 09:31:49.697 lplcoins[5535:1825275] Finished load of: file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/index.html\r\n2015-11-20 09:31:49.961 lplcoins[5535:1825275] THREAD WARNING: ['InAppPurchase'] took '17.277832' ms. Plugin should use a background thread.\r\n2015-11-20 09:31:49.963 lplcoins[5535:1825275] store is running\r\n2015-11-20 09:31:49.963 lplcoins[5535:1825275] <div>registering</div>\r\n2015-11-20 09:31:49.964 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'lplcoins registered'\r\n2015-11-20 09:31:49.964 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'paid subscription registered'\r\n2015-11-20 09:31:49.964 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'subscription registered'\r\n2015-11-20 09:31:49.965 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'registered'\r\n2015-11-20 09:31:49.965 lplcoins[5535:1825275] [store.js] DEBUG: ios -> product lplcoins registered\r\n2015-11-20 09:31:49.966 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'lplcoins updated'\r\n2015-11-20 09:31:49.966 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'paid subscription updated'\r\n2015-11-20 09:31:49.967 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'subscription updated'\r\n2015-11-20 09:31:49.967 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'updated'\r\n2015-11-20 09:31:49.968 lplcoins[5535:1825275] <div>done registering</div>\r\n2015-11-20 09:31:49.968 lplcoins[5535:1825275] [store.js] DEBUG: queries ++ 'lplcoins updated'\r\n2015-11-20 09:31:49.969 lplcoins[5535:1825275] [store.js] DEBUG: queries ++ 'lplcoins approved'\r\n2015-11-20 09:31:49.969 lplcoins[5535:1825275] [store.js] DEBUG: queries ++ 'lplcoins verified'\r\n2015-11-20 09:31:49.970 lplcoins[5535:1825275] [store.js] DEBUG: queries ++ 'lplcoins unverified'\r\n2015-11-20 09:31:49.970 lplcoins[5535:1825275] [store.js] DEBUG: queries ++ 'lplcoins updated'\r\n2015-11-20 09:31:49.970 lplcoins[5535:1825275] [store.js] DEBUG: queries ++ 'lplcoins approved'\r\n2015-11-20 09:31:49.971 lplcoins[5535:1825275] [store.js] DEBUG: queries ++ 'lplcoins approved'\r\n2015-11-20 09:31:49.971 lplcoins[5535:1825275] [store.js] DEBUG: queries ++ 'lplcoins updated'\r\n2015-11-20 09:31:49.972 lplcoins[5535:1825275] refresh\r\n2015-11-20 09:31:49.972 lplcoins[5535:1825275] [store.js] DEBUG: store.trigger -> triggering action refreshed\r\n2015-11-20 09:31:49.973 lplcoins[5535:1825275] [store.js] DEBUG: queries !! 'refreshed'\r\n2015-11-20 09:31:49.973 lplcoins[5535:1825275] [store.js] DEBUG: ios -> initializing storekit\r\n2015-11-20 09:31:49.974 lplcoins[5535:1825275] InAppPurchase[js]: setup ok\r\n2015-11-20 09:31:49.975 lplcoins[5535:1825275] [store.js] INFO: ios -> storekit ready\r\n2015-11-20 09:31:49.975 lplcoins[5535:1825275] [store.js] DEBUG: ios -> loading products\r\n2015-11-20 09:31:49.977 lplcoins[5535:1825275] InAppPurchase[js]: load [\"lplcoins\"]\r\n2015-11-20 09:31:49.978 lplcoins[5535:1825275] InAppPurchase[objc]: Getting products data\r\n2015-11-20 09:31:49.979 lplcoins[5535:1825275] InAppPurchase[objc]: Set has 1 elements\r\n2015-11-20 09:31:49.979 lplcoins[5535:1825275] InAppPurchase[objc]:  - lplcoins\r\n2015-11-20 09:31:49.980 lplcoins[5535:1825275] InAppPurchase[objc]: Starting product request...\r\n2015-11-20 09:31:49.980 lplcoins[5535:1825275] InAppPurchase[objc]: Product request started\r\n2015-11-20 09:31:50.945 lplcoins[5535:1825275] InAppPurchase[objc]: productsRequest: didReceiveResponse:\r\n2015-11-20 09:31:50.945 lplcoins[5535:1825275] InAppPurchase[objc]: Has 0 validProducts\r\n2015-11-20 09:31:50.946 lplcoins[5535:1825275] InAppPurchase[objc]: productsRequest: didReceiveResponse: sendPluginResult: (\r\n        (\r\n    ),\r\n        (\r\n        lplcoins\r\n    )\r\n)\r\n2015-11-20 09:31:50.954 lplcoins[5535:1825275] InAppPurchase[js]: load ok: { valid:[] invalid:[\"lplcoins\"] }\r\n2015-11-20 09:31:50.954 lplcoins[5535:1825275] [store.js] DEBUG: ios -> products loaded\r\n2015-11-20 09:31:50.955 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'lplcoins invalid'\r\n2015-11-20 09:31:50.955 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'paid subscription invalid'\r\n2015-11-20 09:31:50.956 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'subscription invalid'\r\n2015-11-20 09:31:50.956 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'invalid invalid'\r\n2015-11-20 09:31:50.957 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'invalid'\r\n2015-11-20 09:31:50.958 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'lplcoins updated'\r\n2015-11-20 09:31:50.958 lplcoins[5535:1825275] [store.js] WARNING: A callback in 'lplcoins updated' failed with an exception.\r\n2015-11-20 09:31:50.959 lplcoins[5535:1825275] [store.js] WARNING:            Can't find variable: app\r\n2015-11-20 09:31:50.959 lplcoins[5535:1825275] [store.js] WARNING:            file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/js/index.js:41:12\r\ntriggerWhenProduct@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/plugins/cc.fovea.cordova.purchase/www/store-ios.js:600:44\r\ntriggerWhenProduct@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/plugins/cc.fovea.cordova.purchase/www/store-ios.js:609:84\r\ntrigger@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/plugins/cc.fovea.cordova.purchase/www/store-ios.js:640:42\r\ntrigger@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/plugins/cc.fovea.cordova.purchase/www/store-ios.js:529:22\r\nstateChanged@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/plugins/cc.fovea.cordova.purchase/www/store-ios.js:517:37\r\nset@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/plugins/cc.fovea.cordova.purchase/www/store-ios.js:500:51\r\nstorekitLoaded@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/plugins/cc.fovea.cordova.purchase/www/store-ios.js:1253:18\r\nprotectCall@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/plugins/cc.fovea.cordova.purchase/www/store-ios.js:743:27\r\nloadOk@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/plugins/cc.fovea.cordova.purchase/www/store-ios.js:919:28\r\ncallbackFromNative@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/cordova.js:293:63\r\nfile:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/cordova.js:1109:35\r\nnativeEvalAndFetch@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/cordova.js:1117:13\r\nnativeCallback@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/cordova.js:1106:38\r\nglobal code@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/index.html:1:47\r\n2015-11-20 09:31:50.963 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'paid subscription updated'\r\n2015-11-20 09:31:50.964 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'subscription updated'\r\n2015-11-20 09:31:50.964 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'invalid updated'\r\n2015-11-20 09:31:50.965 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'updated'\r\n2015-11-20 09:31:50.965 lplcoins[5535:1825275] [store.js] WARNING: ios -> product lplcoins is NOT valid (lplcoins)\r\n2015-11-20 09:31:50.966 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'lplcoins loaded'\r\n2015-11-20 09:31:50.966 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'paid subscription loaded'\r\n2015-11-20 09:31:50.967 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'subscription loaded'\r\n2015-11-20 09:31:50.968 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'invalid loaded'\r\n2015-11-20 09:31:50.969 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'loaded'\r\n2015-11-20 09:31:50.972 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'lplcoins updated'\r\n2015-11-20 09:31:50.973 lplcoins[5535:1825275] [store.js] WARNING: A callback in 'lplcoins updated' failed with an exception.\r\n2015-11-20 09:31:50.973 lplcoins[5535:1825275] [store.js] WARNING:            Can't find variable: app\r\n2015-11-20 09:31:50.974 lplcoins[5535:1825275] [store.js] WARNING:            file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/js/index.js:41:12\r\ntriggerWhenProduct@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/plugins/cc.fovea.cordova.purchase/www/store-ios.js:600:44\r\ntriggerWhenProduct@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/plugins/cc.fovea.cordova.purchase/www/store-ios.js:609:84\r\ntrigger@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/plugins/cc.fovea.cordova.purchase/www/store-ios.js:640:42\r\ntrigger@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/plugins/cc.fovea.cordova.purchase/www/store-ios.js:529:22\r\nstorekitLoaded@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/plugins/cc.fovea.cordova.purchase/www/store-ios.js:1255:22\r\nprotectCall@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/plugins/cc.fovea.cordova.purchase/www/store-ios.js:743:27\r\nloadOk@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/plugins/cc.fovea.cordova.purchase/www/store-ios.js:919:28\r\ncallbackFromNative@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/cordova.js:293:63\r\nfile:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/cordova.js:1109:35\r\nnativeEvalAndFetch@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/cordova.js:1117:13\r\nnativeCallback@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/cordova.js:1106:38\r\nglobal code@file:///private/var/mobile/Containers/Bundle/Application/25116158-BB61-4E20-BB5F-D97783C53A42/lplcoins.app/www/index.html:1:47\r\n2015-11-20 09:31:50.977 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'paid subscription updated'\r\n2015-11-20 09:31:50.978 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'subscription updated'\r\n2015-11-20 09:31:50.979 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'invalid updated'\r\n2015-11-20 09:31:50.979 lplcoins[5535:1825275] [store.js] DEBUG: store.queries !! 'updated'\r\n2015-11-20 09:31:51.009 lplcoins[5535:1825275] <div>store is ready</div>\r\n\r\nAny and all help appreciated, (been working on this for days!)"},"comment":{"url":"https://api.github.com/repos/j3k0/cordova-plugin-purchase/issues/comments/158499680","html_url":"https://github.com/j3k0/cordova-plugin-purchase/issues/346#issuecomment-158499680","issue_url":"https://api.github.com/repos/j3k0/cordova-plugin-purchase/issues/346","id":158499680,"user":{"login":"nnylip","id":15943434,"avatar_url":"https://avatars.githubusercontent.com/u/15943434?v=3","gravatar_id":"","url":"https://api.github.com/users/nnylip","html_url":"https://github.com/nnylip","followers_url":"https://api.github.com/users/nnylip/followers","following_url":"https://api.github.com/users/nnylip/following{/other_user}","gists_url":"https://api.github.com/users/nnylip/gists{/gist_id}","starred_url":"https://api.github.com/users/nnylip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nnylip/subscriptions","organizations_url":"https://api.github.com/users/nnylip/orgs","repos_url":"https://api.github.com/users/nnylip/repos","events_url":"https://api.github.com/users/nnylip/events{/privacy}","received_events_url":"https://api.github.com/users/nnylip/received_events","type":"User","site_admin":false},"created_at":"2015-11-20T19:20:05Z","updated_at":"2015-11-20T19:20:05Z","body":"I found an issue with my code, here is revised:\r\n$(document).ready(function() {\r\n\tdocument.addEventListener(\"deviceready\", onDeviceReady, false);\r\n\r\n   function onDeviceReady()\r\n   {\r\n\t\tinitStore();\r\n\t}\r\n\r\n});\r\n\r\n// cordova plugin add cc.fovea.cordova.purchase\r\ninitStore = function() {\r\n\r\n    if (!window.store) {\r\n        log('Store not available');\r\n        return;\r\n    }\r\n  else console.log('store is running')\r\n    var platform = device.platform.toLowerCase();\r\n    document.getElementsByTagName('body')[0].className = platform;\r\n\r\n    // Enable maximum logging level\r\n    store.verbosity = store.DEBUG;\r\n\r\n    // Enable remote receipt validation\r\n    //store.validator = \"https://api.fovea.cc:1982/check-purchase\";\r\n\r\n    // Inform the store of your products\r\n    //console.log('registerProducts');\r\n\r\nlog('registering')\r\n    store.register({\r\n        id:    'lplcoins', // id without package name! com.lpl.lplcoins\r\n        alias: 'lplcoins',\r\n        type:  store.PAID_SUBSCRIPTION\r\n    });\r\nlog('done registering')\r\n\r\n    // When any product gets updated, refresh the HTML.\r\n    store.when(\"lplcoins\").updated(function (p) {\r\n\t\t\tlog(\"updated subscription\"+p.id);\t\t\r\n\t\t\tlog('updated: ' + p.price);\r\n        //app.renderIAP(p);\r\n    });\r\n\r\n    store.when(\"lplcoins\").approved(function(p) {\r\n        log(\"approved subscription\");\r\n        p.verify();\r\n    });\r\n    store.when(\"lplcoins\").verified(function(p) {\r\n        log(\"subscription verified\"+p.id);\r\n        p.finish();\r\n    });\r\n    store.when(\"lplcoins\").unverified(function(p) {\r\n        log(\"subscription unverified\"+p.id);\r\n    });\r\n    store.when(\"lplcoins\").updated(function(p) {\r\n\t\t//if (true) {\r\n        if (p.owned) {\r\n            document.getElementById('subscriber-info').innerHTML = 'You are a lucky subscriber!';\r\n        }\r\n        else {\r\n            document.getElementById('subscriber-info').innerHTML = 'You are not subscribed';\r\n        }\r\n    });\r\n\r\n    // Log all errors\r\n    store.error(function(error) {\r\n        log('ERROR ' + error.code + ': ' + error.message);\r\n    });\r\n\r\n    // When purchase of an extra life is approved,\r\n    // deliver it... by displaying logs in the console.\r\n    store.when(\"lplcoins\").approved(function (order) {\r\n        log(\"You got an EXTRA LIFE!\");\r\n        order.finish();\r\n    });\r\n\r\n    // When purchase of the full version is approved,\r\n    // show some logs and finish the transaction.\r\n    store.when(\"lplcoins\").approved(function (order) {\r\n        log('You just unlocked the FULL VERSION!');\r\n        order.finish();\r\n    });\r\n\r\n    // The play button can only be accessed when the user\r\n    // owns the full version.\r\n    store.when(\"lplcoins\").updated(function (product) {\r\n        document.getElementById(\"access-full-version-button\").style.display =\r\n            product.owned ? \"block\" : \"none\";\r\n    });\r\n\r\n    // When the store is ready (i.e. all products are loaded and in their \"final\"\r\n    // state), we hide the \"loading\" indicator.\r\n    //\r\n    // Note that the \"ready\" function will be called immediately if the store\r\n    // is already ready.\r\n    store.ready(function() {\r\n        var el = document.getElementById(\"loading-indicator\");\r\n        if (el) el.style.display = 'none';\r\n    });\r\n\r\n    // When store is ready, activate the \"refresh\" button;\r\n    store.ready(function() {\r\n\t\t\tlog('store is ready')\r\n        var el = document.getElementById('refresh-button');\r\n        if (el) {\r\n            el.style.display = 'block';\r\n            el.onclick = function(ev) {\r\n\t\t\t\t\tlog('register pressed')\r\n\t             store.refresh();\r\n            };\r\n        }\r\n    });\r\n    console.log('refresh');\r\n    store.refresh();\r\n};\r\nlog = function(arg) {\r\n    try {\r\n        if (typeof arg !== 'string') arg = JSON.stringify(arg);\r\n        console.log('<div>' + arg + '</div>');\r\n\r\n        $(\"#talog\").append( arg+'\\n' );\r\n        $(\"#talog\").each(function () {\r\n        this.style.height = (this.scrollHeight+10)+'px';\r\n    });\r\n        //document.getElementById('log').innerHTML += '<div>' + arg + '</div>';\r\n    } catch (e) {}\r\n};\r\n\r\nNow getting this output in xcode:\r\n2015-11-20 13:11:00.383 lplcoins[5679:1858727] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///private/var/mobile/Containers/Data/Application/FA8F504F-8688-45A8-8E10-CF058258EA5C/Library/Cookies/Cookies.binarycookies\r\n2015-11-20 13:11:00.669 lplcoins[5679:1858727] Apache Cordova native platform version 3.9.2 is starting.\r\n2015-11-20 13:11:00.672 lplcoins[5679:1858727] Multi-tasking -> Device: YES, App: YES\r\n2015-11-20 13:11:00.680 lplcoins[5679:1858727] Unlimited access to network resources\r\n2015-11-20 13:11:00.689 lplcoins[5679:1858727] \r\n\r\nStarted backup to iCloud! Please be careful.\r\nYour application might be rejected by Apple if you store too much data.\r\nFor more information please read \"iOS Data Storage Guidelines\" at:\r\nhttps://developer.apple.com/icloud/documentation/data-storage/\r\nTo disable web storage backup to iCloud, set the BackupWebStorage preference to \"local\" in the Cordova config.xml file\r\n\r\n2015-11-20 13:11:00.895 lplcoins[5679:1858727] [CDVTimer][file] 66.745996ms\r\n2015-11-20 13:11:00.896 lplcoins[5679:1858727] [CDVTimer][TotalPluginStartup] 67.312002ms\r\n2015-11-20 13:11:01.340 lplcoins[5679:1858727] Resetting plugins due to page load.\r\n2015-11-20 13:11:01.897 lplcoins[5679:1858727] Finished load of: file:///private/var/mobile/Containers/Bundle/Application/6B3A71E9-AC0A-40FC-86F1-78C8548606A4/lplcoins.app/www/index.html\r\n2015-11-20 13:11:02.141 lplcoins[5679:1858727] THREAD WARNING: ['InAppPurchase'] took '15.644287' ms. Plugin should use a background thread.\r\n2015-11-20 13:11:02.143 lplcoins[5679:1858727] store is running\r\n2015-11-20 13:11:02.143 lplcoins[5679:1858727] <div>registering</div>\r\n2015-11-20 13:11:02.143 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'lplcoins registered'\r\n2015-11-20 13:11:02.144 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'paid subscription registered'\r\n2015-11-20 13:11:02.144 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'subscription registered'\r\n2015-11-20 13:11:02.145 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'registered'\r\n2015-11-20 13:11:02.145 lplcoins[5679:1858727] [store.js] DEBUG: ios -> product lplcoins registered\r\n2015-11-20 13:11:02.146 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'lplcoins updated'\r\n2015-11-20 13:11:02.146 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'paid subscription updated'\r\n2015-11-20 13:11:02.147 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'subscription updated'\r\n2015-11-20 13:11:02.147 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'updated'\r\n2015-11-20 13:11:02.147 lplcoins[5679:1858727] <div>done registering</div>\r\n2015-11-20 13:11:02.148 lplcoins[5679:1858727] [store.js] DEBUG: queries ++ 'lplcoins updated'\r\n2015-11-20 13:11:02.148 lplcoins[5679:1858727] [store.js] DEBUG: queries ++ 'lplcoins approved'\r\n2015-11-20 13:11:02.149 lplcoins[5679:1858727] [store.js] DEBUG: queries ++ 'lplcoins verified'\r\n2015-11-20 13:11:02.150 lplcoins[5679:1858727] [store.js] DEBUG: queries ++ 'lplcoins unverified'\r\n2015-11-20 13:11:02.151 lplcoins[5679:1858727] [store.js] DEBUG: queries ++ 'lplcoins updated'\r\n2015-11-20 13:11:02.152 lplcoins[5679:1858727] [store.js] DEBUG: queries ++ 'lplcoins approved'\r\n2015-11-20 13:11:02.153 lplcoins[5679:1858727] [store.js] DEBUG: queries ++ 'lplcoins approved'\r\n2015-11-20 13:11:02.153 lplcoins[5679:1858727] [store.js] DEBUG: queries ++ 'lplcoins updated'\r\n2015-11-20 13:11:02.154 lplcoins[5679:1858727] refresh\r\n2015-11-20 13:11:02.154 lplcoins[5679:1858727] [store.js] DEBUG: store.trigger -> triggering action refreshed\r\n2015-11-20 13:11:02.155 lplcoins[5679:1858727] [store.js] DEBUG: queries !! 'refreshed'\r\n2015-11-20 13:11:02.155 lplcoins[5679:1858727] [store.js] DEBUG: ios -> initializing storekit\r\n2015-11-20 13:11:02.156 lplcoins[5679:1858727] InAppPurchase[js]: setup ok\r\n2015-11-20 13:11:02.156 lplcoins[5679:1858727] [store.js] INFO: ios -> storekit ready\r\n2015-11-20 13:11:02.157 lplcoins[5679:1858727] [store.js] DEBUG: ios -> loading products\r\n2015-11-20 13:11:02.157 lplcoins[5679:1858727] InAppPurchase[js]: load [\"lplcoins\"]\r\n2015-11-20 13:11:02.158 lplcoins[5679:1858727] InAppPurchase[objc]: Getting products data\r\n2015-11-20 13:11:02.158 lplcoins[5679:1858727] InAppPurchase[objc]: Set has 1 elements\r\n2015-11-20 13:11:02.161 lplcoins[5679:1858727] InAppPurchase[objc]:  - lplcoins\r\n2015-11-20 13:11:02.162 lplcoins[5679:1858727] InAppPurchase[objc]: Starting product request...\r\n2015-11-20 13:11:02.162 lplcoins[5679:1858727] InAppPurchase[objc]: Product request started\r\n2015-11-20 13:11:02.865 lplcoins[5679:1858727] InAppPurchase[objc]: productsRequest: didReceiveResponse:\r\n2015-11-20 13:11:02.865 lplcoins[5679:1858727] InAppPurchase[objc]: Has 0 validProducts\r\n2015-11-20 13:11:02.866 lplcoins[5679:1858727] InAppPurchase[objc]: productsRequest: didReceiveResponse: sendPluginResult: (\r\n        (\r\n    ),\r\n        (\r\n        lplcoins\r\n    )\r\n)\r\n2015-11-20 13:11:02.880 lplcoins[5679:1858727] InAppPurchase[js]: load ok: { valid:[] invalid:[\"lplcoins\"] }\r\n2015-11-20 13:11:02.880 lplcoins[5679:1858727] [store.js] DEBUG: ios -> products loaded\r\n2015-11-20 13:11:02.881 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'lplcoins invalid'\r\n2015-11-20 13:11:02.881 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'paid subscription invalid'\r\n2015-11-20 13:11:02.882 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'subscription invalid'\r\n2015-11-20 13:11:02.882 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'invalid invalid'\r\n2015-11-20 13:11:02.883 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'invalid'\r\n2015-11-20 13:11:02.883 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'lplcoins updated'\r\n2015-11-20 13:11:02.884 lplcoins[5679:1858727] <div>updated subscriptionlplcoins</div>\r\n2015-11-20 13:11:02.884 lplcoins[5679:1858727] <div>updated: null</div>\r\n2015-11-20 13:11:02.885 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'paid subscription updated'\r\n2015-11-20 13:11:02.885 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'subscription updated'\r\n2015-11-20 13:11:02.886 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'invalid updated'\r\n2015-11-20 13:11:02.886 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'updated'\r\n2015-11-20 13:11:02.887 lplcoins[5679:1858727] [store.js] WARNING: ios -> product lplcoins is NOT valid (lplcoins)\r\n2015-11-20 13:11:02.887 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'lplcoins loaded'\r\n2015-11-20 13:11:02.911 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'paid subscription loaded'\r\n2015-11-20 13:11:02.912 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'subscription loaded'\r\n2015-11-20 13:11:02.913 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'invalid loaded'\r\n2015-11-20 13:11:02.914 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'loaded'\r\n2015-11-20 13:11:02.914 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'lplcoins updated'\r\n2015-11-20 13:11:02.915 lplcoins[5679:1858727] <div>updated subscriptionlplcoins</div>\r\n2015-11-20 13:11:02.916 lplcoins[5679:1858727] <div>updated: null</div>\r\n2015-11-20 13:11:02.916 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'paid subscription updated'\r\n2015-11-20 13:11:02.919 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'subscription updated'\r\n2015-11-20 13:11:02.920 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'invalid updated'\r\n2015-11-20 13:11:02.921 lplcoins[5679:1858727] [store.js] DEBUG: store.queries !! 'updated'\r\n2015-11-20 13:11:02.951 lplcoins[5679:1858727] <div>store is ready</div>\r\n\r\nOutput is saying the product is invalid.\r\nQUESTION: is a completed contract required to be able to test the in-app purchase (to query a valid product)?"}}