SDKBOX IAP Android not showing prices

Hi, I have make it work on iOS, same code in Android not work…
I have followed this tutorial:
http://blog.cocos2d-x.org/2015/06/integrate-iap-for-google-play-with-sdkbox/
step by step.
I’m using cocos2d 3.8.1
and SDKBOX v1.0.0.11 (strange thing… I used sdkbox update in command line and seems that had installed 1.0.0.18… however IPA package are up to date 2.3.3.4)

my sdkbox_config.json

    {
        "android": {
            "iap": {
                "items": {
                    "01_Premium": {
                        "id": "it.enigma.jackpot.premium"
                    }, 
                    "02_Premium_plus": {
                        "id": "it.enigma.jackpot.premium_plus"
                    }, 
                    "03_avventura": {
                        "type": "non_consumable", 
                        "id": "it.enigma.jackpot.avventura5"
                    }
                }, 
                "key": "my_key_without_spaces"
            }
        }, 
        "ios": {
            "iap": {
                "items": {
                    "01_Premium": {
                        "type": "non_consumable",
                        "id": "it.enigma.Jackpot.Premium"
                    },
                    "02_Premium_plus": {
                        "type": "non_consumable",
                        "id": "it.enigma.Jackpot.premium_plus"
                    },
                    "03_avventura": {
                        "type": "non_consumable",
                        "id": "it.enigma.Jackpot.avventura5"
                    },
                    "04_sopravvivenza": {
                        "type": "non_consumable",
                        "id": "it.enigma.Jackpot.sopravvivenza5"
                    },
                    "05_controtempo": {
                        "type": "non_consumable",
                        "id": "it.enigma.Jackpot.countertime5"
                    },
                    "06_3_aiuti": {
                        "type": "consumable",
                        "id": "it.enigma.Jackpot.3aiuti"
                    },
                    "07_10_aiuti": {
                        "type": "consumable",
                        "id": "it.enigma.Jackpot.10aiuti"
                    },
                    "08_30_aiuti": {
                        "type": "consumable",
                        "id": "it.enigma.Jackpot.30aiuti"
                    }
                }
            }
        }
    }

and here eclipse log

10-20 19:17:52.445: D/IAP(6668): creating Products list:
10-20 19:17:52.445: I/IAP(6668): init Google store again, skip
10-20 19:17:52.445: I/IAP(6668): init Google IAP 
10-20 19:17:52.445: I/IAP(6668): IAB helper created.
10-20 19:17:52.445: D/IAP(6668): Starting setup.
10-20 19:17:52.445: D/IAP(6668): Starting in-app billing setup.
10-20 19:17:52.450: I/IAP(6668): Billing service connected.
10-20 19:17:52.450: D/IAP(6668): Checking for in-app billing 3 support.
10-20 19:17:52.455: I/Finsky(3844): [7] com.google.android.finsky.billing.iab.m.a(158): it.enigma.Jackpot: Account from first account - [0LUwmiVDsHAVgk_eB2_Q8g7FD8g]
10-20 19:17:52.455: D/IAP(6668): In-app billing version 3 supported for it.enigma.Jackpot
10-20 19:17:52.460: I/Finsky(3844): [28] com.google.android.finsky.billing.iab.m.a(158): it.enigma.Jackpot: Account from first account - [0LUwmiVDsHAVgk_eB2_Q8g7FD8g]
10-20 19:17:52.460: D/IAP(6668): Subscriptions AVAILABLE.
10-20 19:17:52.460: D/IAP(6668): Setup finished.
10-20 19:17:52.460: D/IAP(6668): Setup successful. Querying inventory.
10-20 19:17:52.460: D/IAP(6668): Requesting Products: 'it.enigma.jackpot.premium,it.enigma.jackpot.premium_plus,it.enigma.jackpot.avventura5'
10-20 19:17:52.460: D/IAP(6668): NetWork reachable : true
10-20 19:17:52.460: D/IAP(6668): Starting async operation: refresh inventory
10-20 19:17:52.460: D/IAP(6668): Refreshing products: 'it.enigma.jackpot.premium,it.enigma.jackpot.premium_plus,it.enigma.jackpot.avventura5'
10-20 19:17:52.460: D/IAP(6668): Requesting Products: 'it.enigma.jackpot.premium,it.enigma.jackpot.premium_plus,it.enigma.jackpot.avventura5'
10-20 19:17:52.460: D/IAP(6668): NetWork reachable : true
10-20 19:17:52.460: D/IAP(6668): Refreshing products: 'it.enigma.jackpot.premium,it.enigma.jackpot.premium_plus,it.enigma.jackpot.avventura5'
10-20 19:17:52.460: D/IAP(6668): Requesting Products: 'it.enigma.jackpot.premium,it.enigma.jackpot.premium_plus,it.enigma.jackpot.avventura5'
10-20 19:17:52.460: D/IAP(6668): NetWork reachable : true
10-20 19:17:52.460: E/IAP(6668): Query inventory state exception. Please retry in a few seconds.
10-20 19:17:52.460: D/IAP(6668): Ending async operation: refresh inventory
10-20 19:17:52.460: D/IAP(6668): Querying owned items, item type: inapp
10-20 19:17:52.460: D/IAP(6668): Package name: it.enigma.Jackpot
10-20 19:17:52.460: D/IAP(6668): Calling getPurchases with continuation token: null 
10-20 19:17:52.460: D/IAP(6668): Starting async operation: refresh inventory
10-20 19:17:52.470: I/Finsky(3844): [8] com.google.android.finsky.billing.iab.m.a(158): it.enigma.Jackpot: Account from first account - [0LUwmiVDsHAVgk_eB2_Q8g7FD8g]
10-20 19:17:52.470: D/IAP(6668): Owned items response: 0
10-20 19:17:52.470: D/IAP(6668): Continuation token: null
10-20 19:17:52.470: D/IAP(6668): Querying SKU details.
10-20 19:17:52.470: D/IAP(6668): Querying owned items, item type: inapp
10-20 19:17:52.470: D/IAP(6668): Package name: it.enigma.Jackpot
10-20 19:17:52.470: D/IAP(6668): Calling getPurchases with continuation token: null 
10-20 19:17:52.475: I/Finsky(3844): [7] com.google.android.finsky.billing.iab.m.a(158): it.enigma.Jackpot: Account from first account - [0LUwmiVDsHAVgk_eB2_Q8g7FD8g]
10-20 19:17:52.480: I/Finsky(3844): [28] com.google.android.finsky.billing.iab.m.a(158): it.enigma.Jackpot: Account from first account - [0LUwmiVDsHAVgk_eB2_Q8g7FD8g]
10-20 19:17:52.480: D/IAP(6668): Owned items response: 0
10-20 19:17:52.480: D/IAP(6668): Continuation token: null
10-20 19:17:52.480: D/IAP(6668): Querying SKU details.
10-20 19:17:52.485: I/Finsky(3844): [8] com.google.android.finsky.billing.iab.m.a(158): it.enigma.Jackpot: Account from first account - [0LUwmiVDsHAVgk_eB2_Q8g7FD8g]
10-20 19:17:52.485: D/IAP(6668): Querying owned items, item type: subs
10-20 19:17:52.485: D/IAP(6668): Package name: it.enigma.Jackpot
10-20 19:17:52.485: D/IAP(6668): Calling getPurchases with continuation token: null 
10-20 19:17:52.490: I/Finsky(3844): [28] com.google.android.finsky.billing.iab.m.a(158): it.enigma.Jackpot: Account from first account - [0LUwmiVDsHAVgk_eB2_Q8g7FD8g]
10-20 19:17:52.490: D/IAP(6668): Owned items response: 0
10-20 19:17:52.495: D/IAP(6668): Continuation token: null
10-20 19:17:52.495: D/IAP(6668): Querying SKU details.
10-20 19:17:52.500: I/Finsky(3844): [7] com.google.android.finsky.billing.iab.m.a(158): it.enigma.Jackpot: Account from first account - [0LUwmiVDsHAVgk_eB2_Q8g7FD8g]
10-20 19:17:52.500: D/IAP(6668): Querying owned items, item type: subs
10-20 19:17:52.500: D/IAP(6668): Package name: it.enigma.Jackpot
10-20 19:17:52.500: D/IAP(6668): Calling getPurchases with continuation token: null 
10-20 19:17:52.505: I/Finsky(3844): [28] com.google.android.finsky.billing.iab.m.a(158): it.enigma.Jackpot: Account from first account - [0LUwmiVDsHAVgk_eB2_Q8g7FD8g]
10-20 19:17:52.505: D/IAP(6668): Owned items response: 0
10-20 19:17:52.505: D/IAP(6668): Continuation token: null
10-20 19:17:52.505: D/IAP(6668): Querying SKU details.
10-20 19:17:52.510: I/Finsky(3844): [8] com.google.android.finsky.billing.iab.m.a(158): it.enigma.Jackpot: Account from first account - [0LUwmiVDsHAVgk_eB2_Q8g7FD8g]
10-20 19:17:52.510: D/IAP(6668): Ending async operation: refresh inventory
10-20 19:17:52.515: D/IAP(6668): Ending async operation: 
10-20 19:17:52.525: D/IAP(6668): Query inventory finished.
10-20 19:17:52.525: D/IAP(6668): Query inventory was successful.
10-20 19:17:52.525: D/IAP(6668): GooglePlay Request result : 0 msg : Product request successful. data :[]
10-20 19:17:52.525: D/IAP(6668): Query inventory finished.
10-20 19:17:52.525: D/IAP(6668): Query inventory was successful.
10-20 19:17:52.525: D/IAP(6668): GooglePlay Request result : 0 msg : Product request successful. data :[]

AndroidManifest

<?xml version='1.0' encoding='UTF-8'?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="it.enigma.Jackpot" android:installLocation="auto" android:versionCode="1" android:versionName="1.0">
    <uses-sdk android:minSdkVersion="9" />
    <uses-feature android:glEsVersion="0x00020000" />
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <meta-data android:name="android.app.lib_name" android:value="cocos2dcpp" />
        <activity android:configChanges="orientation" android:label="@string/app_name" android:name="org.cocos2dx.cpp.AppActivity" android:screenOrientation="landscape" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
    </application>
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="com.android.vending.BILLING" />
</manifest>


I have tested in 2 devices, exporting signed apk, uploaded and installed the same apk using adb install
I’m stuck here for many days…
Where should I point my attention?
thanks

Your log looks correct, however I didn’t see anything with purchase.

Owned item: 0

This log just to remind you, that you haven’t brought anything yet.

What happens when you click purchase?

Sorry, I have correct the title, the problem is that is not showing prices. I thought to see the list of product like I saw in iOS
If I click on purchase it ask me to sign in to my account. I’m already sign in play store app, and my account is in the Account Gmail with access to test
If I’m right I should retrive the list of product with this (like I see in iOS but in Android I not see any product):

void PopUp_table::onProductRequestSuccess(const std::vector<Product> &products)
{
       _products = products;
    
    for (int i=0; i < _products.size(); i++)
    {
        CCLOG("IAP: ========= IAP Item =========");
        CCLOG("IAP: Name: %s", _products[i].name.c_str());
        CCLOG("IAP: ID: %s", _products[i].id.c_str());
        CCLOG("IAP: Title: %s", _products[i].title.c_str());
        CCLOG("IAP: Desc: %s", _products[i].description.c_str());
        CCLOG("IAP: Price: %s", _products[i].price.c_str());
        CCLOG("IAP: Price Value: %f", _products[i].priceValue);
    }
}

I have substitute my AndroidManifest and sdkbox_config.json with the one in PluginTest downloaded from github and works perfectly…so the problem resides in developer consolle…
what could it be?
should I set something in alphatest?
thanks

Ok, if that’s the case, double check following in your AndroidManifest.xml
package
android:versionCode
android:versionName

Especially android:versionCode

I have posted photos and Android manifest, I’m not able to see errors… do you notice something wrong?
Thanks

Did you setListener?

Hi, thanks you for response.
I found the problem (sorry because is is a stupid newbie problem as I have not published anything on Android)
The problem was that I had uploaded the app on googleplay, clicked published and tested inapp.
I thought that inapp could be tested as soon as the app was uploaded, but it takes a few days to pass the status from draft to published.

Can I suggest to change step 9 of the tutorial saying that:
After you upload to googleplay the app click on Publish. The status of the app will be in draft. You MUST wait until the status change to Published before you can test inapp.

So a beginner like me will not bother you :wink:
Thanks for your kindness

2 Likes

Just wanted to add to this thread that despite my disbelief, the app does indeed need to be published for the IAP to work with SDKBOX.

It is fine to just complete all metadata, upload an alpha build, then publish (making the app not world visible).
I doubted this for a long time since other IAP libraries worked while the app was unpublished, but this did make SDKBOX work…

As a side-note, when testing you might need to restart your device for product data to work too once the app changes to ‘Published’ status (possibly Google Play Services caching)