Google store.init not firing

Sorry, for a stupid question, but I’m totally stuck at the beginning.

I’ve added IAP products to Google Developer Console. Also I could upload APK for Alpha testing, so keystore, permissions and such should be ok.

I’m using these example codes: https://docs.coronalabs.com/plugin/google-iap-v3/init.html

Problem is that transactionListener function won’t launch. I even tried the following:

local function transactionListener( event ) print(“INIT”)     if not ( event.transaction.state == "failed" ) then  -- Successful transaction … end print(“INITIALIZING”) store.init( transactionListener ) print(“INITIALIZING DONE”)

In debug log there is just:

INITIALIZING INITIALIZING DONE

No error, no nothing.

I’ve tried testing on an Android device. I’m not even sure anymore is it possible to test with the device or should I test using Google Developer Alpha Testing?

Any ideas?

You won’t get an event to the transactionListener until you have a transaction. Unlike many ad plugins, the completion of init doesn’t generate an event.

Rob

As Rob said you won’t get an event to the the transactionListener when you have not purchase anything.
Here’s some sample code, maybe it’ll help:

function iapListener( event ) local transaction = event.transaction if ( transaction.state == "purchased" ) then -- unlock/purchase something end if(store.finishTransaction)then store.finishTransaction( transaction ); end; end store = require( "plugin.google.iap.v3" ) store.init("google", iapListener) --later in your code when you call store.purchase( productIdentifiers ) it'll call iapListener(event)

Thanks Rob & bogomazon,

I managed to get this done but forgot to mark problem solved. Maybe it would be a good idea to point this out in plugin documentation. Or maybe it’s there already and I’m just blind :wink:

You won’t get an event to the transactionListener until you have a transaction. Unlike many ad plugins, the completion of init doesn’t generate an event.

Rob

As Rob said you won’t get an event to the the transactionListener when you have not purchase anything.
Here’s some sample code, maybe it’ll help:

function iapListener( event ) local transaction = event.transaction if ( transaction.state == "purchased" ) then -- unlock/purchase something end if(store.finishTransaction)then store.finishTransaction( transaction ); end; end store = require( "plugin.google.iap.v3" ) store.init("google", iapListener) --later in your code when you call store.purchase( productIdentifiers ) it'll call iapListener(event)

Thanks Rob & bogomazon,

I managed to get this done but forgot to mark problem solved. Maybe it would be a good idea to point this out in plugin documentation. Or maybe it’s there already and I’m just blind :wink: