An available store has not been loaded by store.init()

When I call 

store.purchase("com.mydomain.myandroidapp.myandoridappnon-consumableproduct") 

I got the following error in output:

I/Corona  (21219): Error: an available store has not been loaded by store.init()

 

 

I don’t now why is this happen, because store.isActive and store.canLoadProducts return true and store.LoadProducts receive my valid products ok.

Thanking in advance for your help.

RR

Hi @ignacio acuna,

Where do you call “store.init()”? Can you also post the exact code for that init call?

Thanks,

Brent

Sure, 

local googleIAP = false if ( system.getInfo( "platformName" ) == "Android" ) then     store = require( "plugin.google.iap.v3" )     googleIAP = true elseif ( system.getInfo( "platformName" ) == "iPhone OS" ) then     store = require( "store" ) else     native.showAlert( "Notice", "In-app purchases are not supported in the Corona Simulator.", { "OK" } ) end . . . . if googleIAP then      currentProductList = googleProductList      store.init("google", transactionCallback)      print("Using Google's Android In-App Billing system.") else      if store.availableStores.apple then           currentProductList = appleProductList           store.init("apple", transactionCallback)           print("Using Apple's in-app purchase system.")      else           print("In-app purchases is not supported on this system/device.")           showStoreNotAvailableWarning()      end end

“Using Google’s Android In-App Billing system.” printed as expected, and how I said before store.isActive and store.canLoadProducts return true value after init and with store.loadProducts() I get my products info. So I think the store were initialized correctly.

Thanks for your help

Someone else with the same problem?

I double-checked the license key , also checked the plug-in table in build.settings , the IAP defined in google play development console, this same code works fine on iOS using the array of products in store.purchase() instead the single value as in Android.

But I still keep getting the same behavior, I retrieve the products info correctly in event.products. But when I try store.purchase(“com.mydomain.etc”) I always get **ERROR: An available store has not been loaded by store.init() **in output

Thanks

Solved!

In other file I had redefined the global variable store = require(“store”) this mistake was alway a harmless error, until now. So I erase that line of code and everything its ok.

Regards,

Hi @ignacio acuna,

Where do you call “store.init()”? Can you also post the exact code for that init call?

Thanks,

Brent

Sure, 

local googleIAP = false if ( system.getInfo( "platformName" ) == "Android" ) then     store = require( "plugin.google.iap.v3" )     googleIAP = true elseif ( system.getInfo( "platformName" ) == "iPhone OS" ) then     store = require( "store" ) else     native.showAlert( "Notice", "In-app purchases are not supported in the Corona Simulator.", { "OK" } ) end . . . . if googleIAP then      currentProductList = googleProductList      store.init("google", transactionCallback)      print("Using Google's Android In-App Billing system.") else      if store.availableStores.apple then           currentProductList = appleProductList           store.init("apple", transactionCallback)           print("Using Apple's in-app purchase system.")      else           print("In-app purchases is not supported on this system/device.")           showStoreNotAvailableWarning()      end end

“Using Google’s Android In-App Billing system.” printed as expected, and how I said before store.isActive and store.canLoadProducts return true value after init and with store.loadProducts() I get my products info. So I think the store were initialized correctly.

Thanks for your help

Someone else with the same problem?

I double-checked the license key , also checked the plug-in table in build.settings , the IAP defined in google play development console, this same code works fine on iOS using the array of products in store.purchase() instead the single value as in Android.

But I still keep getting the same behavior, I retrieve the products info correctly in event.products. But when I try store.purchase(“com.mydomain.etc”) I always get **ERROR: An available store has not been loaded by store.init() **in output

Thanks

Solved!

In other file I had redefined the global variable store = require(“store”) this mistake was alway a harmless error, until now. So I erase that line of code and everything its ok.

Regards,