Question

I'm struggling to find anyone who has an example project from which I can follow all the instructions. And Im seriously getting frustrated with the processes on Apple's side. I think I have everything set up correctly, but the app is not recognising the productid's that im supplying to it.

I am using Telerik (previously icenium), using jQueryMobile 1.3.1, Cordova 3.2.0 and the PhoneGap InAppPurchase iOS plugin

I have created a public bitbucket repo so that you can see all the code here.

A. Apple side

  1. In iTunesConnect my app details are: enter image description here and is at the status Waiting For Upload

  2. My InAppPurchases section looks like this: enter image description here i had heard that perhaps the reason the products werent being found was because they didnt have the sku prepending them. so i have some products with it and others without it just to be safe. Issue here.

  3. I have created a sandbox itunes account in readiness for the ability to test purchases. (not that it is reaching a point i can test this yet)


B. Telerik side

  1. I have basically followed the 3 Steps Tutorial for PhoneGap In-App Purchase on iOS with some minor changes so that the initialize function happens on deviceready. I have removed code not that is not reached as all the products return invalid, the code looks like this:

index.html

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="UTF-8" />
        <title>Hello, World</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link href="jquery-mobile/styles/jquery.mobile-1.3.1.min.css" rel="stylesheet" />
        <link href="styles/main.css" rel="stylesheet" />

        <script src="cordova.js" type="text/javascript"></script>
        <script src="jquery-mobile/js/jquery-1.9.1.min.js" type="text/javascript"></script>
        <script src="jquery-mobile/js/jquery.mobile-1.3.1.min.js" type="text/javascript"></script>
    </head>
    <body>

        <!--Home-->
        <div id="home" data-role="page">

        </div>
        <script type="text/javascript">
            document.addEventListener('deviceready', function () {
                navigator.splashscreen.hide();
                IAP.initialize();
            }, false);
        </script>
        <script src="scripts/login.js" type="text/javascript"></script>
    </body>
    </html>

login.js

    var IAP = {
        list: [ 'dummyinapp11', 'dummyinapp12', 'com.gaandder.inapptutorial.dummyinapp11', 'com.gaandder.inapptutorial.dummyinapp12', 'com.gaandder.inapptutorial.dummyinapp1', 'com.gaandder.inapptutorial.dummyinapp2', 'dummyinapp1', 'dummyinapp2' ],
        products: {}
    };

    IAP.initialize = function () {
        // Check availability of the storekit plugin
        if (!window.storekit) {
            logg('In-App Purchases not available');
            return;
        }

        // Initialize
        storekit.init({
            ready:    IAP.onReady,
            purchase: IAP.onPurchase,
            restore:  IAP.onRestore,
            error:    IAP.onError
        });
    };

    IAP.onReady = function () {
        // Once setup is done, load all product data.
        storekit.load(IAP.list, function (products, invalidIds) {
            logg('IAPs loading done:');
            for (var j = 0; j < products.length; ++j) {
                var p = products[j];
                logg('Loaded IAP(' + j + '). title:' + p.title +
                            ' description:' + p.description +
                            ' price:' + p.price +
                            ' id:' + p.id);
                IAP.products[p.id] = p;
            }
            IAP.loaded = true;
            for (var i = 0; i < invalidIds.length; ++i) {
                logg('Error: could not load ' + invalidIds[i]);
            }
        });
    };

    logg = function (data) {
        document.getElementById('home').innerHTML += data + '<br />';
        // console.log(data);
    };

As you can see I have added all of the permutations of the product id's that i can think of, see A.2. for reasoning


C. Device side

  1. I have logged out of iTunes on my ipad.
  2. As you can see, each item is returned as invalid. enter image description here

D. Other

I have seen that perhaps I need to wait 24 hours after submitting the products for them to work: here. However, this issue was with regards to a production ready app, not during testing. This second link suggests that it again might just be a case of waiting longer.

Has anyone encountered this issue before? What am I doing wrong?

Was it helpful?

Solution

So it looks like this was just a case of waiting for the products to propagate onto all the Apple servers. Upon checking again today this is the result:

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top