plugin.google.iap.v3 issues - Listener is never called

This is the third time I am trying to implement google in-app purchase with Corona into my app. My fist two IAP projects had to be cancelled because of this strange issue with the Corona Google IAP plugin. I decided to wait for a fixed version. Now, a couple of months later, I gave it another try and… this issue still exists!

ISSUES:

  • The google purchase dialog window only appears the first time the app is launched on the device. Then it never appears again until the device was rebooted.

  • The transaction callback listener is NEVER called.

  • It does not matter if real products are used or “android.test.purchased” - when calling store.purchase(), the callback listener is never called (even when the Google purchase dialog window appears and tells that the purchase was completed, the callback listener is not called).

  • I tried this with real products and spend real money to test this a couple of times. Although Google charged me for this, the app’s purchase callback listener was never called.

I am not sure if this is an issue related to the Android version on my device, a general issue or my own fault. But I’m pretty sure that I tried everything possible.

TESTING DEVICE

ASUS Memo Pad HD7

Testing device Android OS version: 4.2.2. (Kernel Version: 3.4.5)

Installed Google Play Store: 6.3.16.B-all [0] 2697688

Installed Google Play Services: 8.7.03 (2645110-030)

Sample code to demonstrate this issue:

[(http://www51.zippyshare.com/v/d9X2GoNW/file.html)

This simple sample project calls store.purchase when the app is launched. Therefore, the callback listener should called at least once - but it is never called on my device. As always, the Google purchase dialog window appears, but only the first time the app is launched on the device. It never appears again then until the device was rebootet. In all cases, the callback listener is never called.

Any help is appreciated. I tried dozens of different daily builds, spent literally hundreds of hours to find out what’s causing this bug but never found a solution :frowning:

Google IAP v3 works fine for me. IIRC you need to slightly delay store initialization, otherwise it might not work. Snippet from my code

store_my = require( “plugin.google.iap.v3” )
timer.performWithDelay( 1000,
function()
    store_my.init( “google”, sw.transactionCallback );
end )

If you’re having trouble, you might want to check out IAP Badger, which is a plugin that simplifies the process:

https://forums.coronalabs.com/topic/59137-iap-badger-a-unified-approach-to-in-app-purchases/

I modified my project to use IAP Badger now -which works *perfectly* in debug mode, also on the device.

When switching to “production mode”, however, very strange things happen:

The app crashes as soon as a purchase is initiated. A Google Play dialog window then appears, saying “This product cannot be purchased” while the app crashes or, even more weird, restarts itself automatically.

Am I the only one experiencing such strange issues with Corona’s Google IAP plugin on Android?

Using Corona version 3.0.0. Build 2016.2863 on Android 4.2.2

Got it to work now! :slight_smile:

The problem was that IAP Badger was still requiring the deprecated “store” plugin for the Google store.

After changing 

local store = require("store")

to

local store=require("plugin.google.iap.v3")

everything seems to work nice on the device, even in production mode.

Hi MauMau,

I haven’t come across this error before.

Which version of IAP Badger are you using?  If it’s the version on Github, inside the init function on line 1465, the store library should be reset to the correct version for Google Play (“plugin.google.iap.v3”) automatically.

Do you get any other errors in the error log (ie. using adb logcat?)

Simon

Is this really helping? I don’t want to use the plugin and looking to make it work without.

I have the same problem with “plugin.google.iap.v3” lately. Some users can buy the game, but because there is no transaction callback the full game is never unlocked. I now wonder why the purchase window then even appears? Shouldn’t the store.init automatically also start the transaction listener?

I downloaded it from the Github repository (version 2).

If I am running the original version of IAP Badger  with local store = require (“store”) on top of the code (line 6) on the device, a message pops up that says:

“store.* library removed from Android. Due to Google removing In-App Billing Version 2 in January 2015, the Corona store.* library on Android is no longer active. Please migrate to the Google IAP v3 plugin.”

So, as written above, I had to replace

local store = require ("store")

on top of the IAP Badge code (line 6) with

local store=require("plugin.google.iap.v3")

and now it seems to work. Luckily, I am targetting for Google Store only. So it seems that you HAVE to do this modification in IAP Badger if you’re building for Android :frowning:

Hi there,

I’ve updated the code so now it doesn’t load the standard store library as default.  It may be best to use the latest code off Github as it avoids forcing the library to load the Google Play Store by default - this way, if you want to use the library on iOS or Amazon in the future, you’ll be able to do so without rewrites.

Simon

Hey guys,

I’m using enterprise and IAP Badger is poorly documented on that matter, so I returned to google IAP, but the listener problem persists. Did anyone managed to use google IAP on Corona?

I tried what coronasdk771 suggested, delaying the init, but unfortunately this did not work and I can’t find other suggestions to solve this problem. Does anybody have an idea on that?

Thanks

Google IAP v3 works fine for me. IIRC you need to slightly delay store initialization, otherwise it might not work. Snippet from my code

store_my = require( “plugin.google.iap.v3” )
timer.performWithDelay( 1000,
function()
    store_my.init( “google”, sw.transactionCallback );
end )

If you’re having trouble, you might want to check out IAP Badger, which is a plugin that simplifies the process:

https://forums.coronalabs.com/topic/59137-iap-badger-a-unified-approach-to-in-app-purchases/

I modified my project to use IAP Badger now -which works *perfectly* in debug mode, also on the device.

When switching to “production mode”, however, very strange things happen:

The app crashes as soon as a purchase is initiated. A Google Play dialog window then appears, saying “This product cannot be purchased” while the app crashes or, even more weird, restarts itself automatically.

Am I the only one experiencing such strange issues with Corona’s Google IAP plugin on Android?

Using Corona version 3.0.0. Build 2016.2863 on Android 4.2.2

Got it to work now! :slight_smile:

The problem was that IAP Badger was still requiring the deprecated “store” plugin for the Google store.

After changing 

local store = require("store")

to

local store=require("plugin.google.iap.v3")

everything seems to work nice on the device, even in production mode.

Hi MauMau,

I haven’t come across this error before.

Which version of IAP Badger are you using?  If it’s the version on Github, inside the init function on line 1465, the store library should be reset to the correct version for Google Play (“plugin.google.iap.v3”) automatically.

Do you get any other errors in the error log (ie. using adb logcat?)

Simon

Is this really helping? I don’t want to use the plugin and looking to make it work without.

I have the same problem with “plugin.google.iap.v3” lately. Some users can buy the game, but because there is no transaction callback the full game is never unlocked. I now wonder why the purchase window then even appears? Shouldn’t the store.init automatically also start the transaction listener?

I downloaded it from the Github repository (version 2).

If I am running the original version of IAP Badger  with local store = require (“store”) on top of the code (line 6) on the device, a message pops up that says:

“store.* library removed from Android. Due to Google removing In-App Billing Version 2 in January 2015, the Corona store.* library on Android is no longer active. Please migrate to the Google IAP v3 plugin.”

So, as written above, I had to replace

local store = require ("store")

on top of the IAP Badge code (line 6) with

local store=require("plugin.google.iap.v3")

and now it seems to work. Luckily, I am targetting for Google Store only. So it seems that you HAVE to do this modification in IAP Badger if you’re building for Android :frowning:

Hi there,

I’ve updated the code so now it doesn’t load the standard store library as default.  It may be best to use the latest code off Github as it avoids forcing the library to load the Google Play Store by default - this way, if you want to use the library on iOS or Amazon in the future, you’ll be able to do so without rewrites.

Simon

Hey guys,

I’m using enterprise and IAP Badger is poorly documented on that matter, so I returned to google IAP, but the listener problem persists. Did anyone managed to use google IAP on Corona?

I tried what coronasdk771 suggested, delaying the init, but unfortunately this did not work and I can’t find other suggestions to solve this problem. Does anybody have an idea on that?

Thanks