If Google Play doesn't use store.loadProducts() how do you get the item prices?

Yeah, I now see that an array of products is used in the regular store.purchase api , but in the Google V3 IAP plugin version it demonstrably fails if the product string is in an array. I bet you’re right about iOS needing it in an array.  That’s one gotcha they really should call out in the documentation (along with a link to the Google V3 plugin docs from the regular IAP docs).

I’m getting the following error while trying to perform a loadProducts operation with Google billing v3:

java.lang.IllegalStateException: Can’t start async operation (refresh inventory) because another async operation(refresh inventory) is in progress.

There’s a thread on stackoverflow suggesting that this is a bug in Google’s APIs. 

Anyone else experienced this error and know a possible workaround?

Cheers!

For iOS, it is a table.  I guess this is a feature for V3 that’s different than V2.  Amazon also does not use a table, just individual items.

@matrix2000 can you do loadProducts on Android? Its not returning anything for me and as far as the doc goes they still only mention that its possible on iOS. 

@jonjonsson is a plugin, Google IAP V3. 

Ahh great, found it, thanks for the help. 

I added comment to docs about this, it is not mentioned in http://docs.coronalabs.com/daily/guide/monetization/IAP/index.html

@zutgames - did you ever find a way around this problem?

We have it occasionally happen us when using loadProducts, but we have our own bool to prevent us calling loadProducts if it has already been called (the bool is then set to false in the loadProducts callback). 

@AlanPlantPot - I’m just calling it once per session, on application start. Originally I was calling loadProducts immediately after initing the store, which was producing the error. Now I’m waiting for a couple of seconds before the call which seems to have fixed the issue, but haven’t tested this extensively. 

Thanks for pointing me to the plugin.  I remembered a daily build note about Google IAP V3 but didn’t realize it was now a plugin and as jonjonsson pointed out the docs don’t mention it.

Has anyone here got the Google V3 IAP working correctly in their app yet?  I’m implementing now and having some issues.  Most likely it’s something I’m doing wrong, but it would help my sanity to know it’s me and not a broken plugin!

-Stephen

It kind of works but sometimes I can’t load the products. I get this error: “Error refreshing inventory (querying owned items). (response: -1003:Purchase signature verification failed)”,

Also you will have to comment out the plugin in build.settings when you build for iOS. I reported that bug, todays daily has something about a compiler bug there, dont know if related.

What kind of problems are you having?

Hi jonjonsson,

I’m not able to actually purchase items.  When I load my IAP items on entrance to my store scene the correct items are found as I see a “Got sku details:…” line via logcat that has all the correct info. for each item, including price, description, etc.  So I know the products are set up correctly on Google dashboard and I’m querying the correct itemIDs.  But when I try to purchase an item it fails and I see this in logcat:

D/IabHelper(21200): Starting async operation: launchPurchaseFlow

 

D/IabHelper(21200): Constructing buy intent for , item type: inapp

 

W/Finsky  (14334): [520] Stub.getBuyIntent: Input Error: Non empty/null argument expected for sku.

 

E/IabHelper(21200): In-app billing error: Unable to buy item, Error response: 5:Developer Error

 

D/IabHelper(21200): Ending async operation: launchPurchaseFlow

 

D/dchan   (21200): Unable to buy item (response: 5:Developer Error)

 

W/System.err(21200): com.naef.jnlua.LuaRuntimeException: ?:0: attempt to concatenate a nil value

 

W/System.err(21200):     at com.naef.jnlua.LuaState.lua_pcall(Native Method)

 

W/System.err(21200):     at com.naef.jnlua.LuaState.call(Unknown Source)

 

W/System.err(21200):     at com.ansca.corona.CoronaLua.dispatchEvent(CoronaLua.java:100)

 

W/System.err(21200):     at plugin.google.iap.v3.StoreTransactionRuntimeTask.executeUsing(StoreTransactionRuntimeTask.java:114)

 

 

Other than the super informative “Developer Error” message, the above seems to indicate my purchase attempt is using an empty string for the sku, even though I just successfully used the same itemID strings when opening the store.  The Corona code I’m using to call store purchase is simply

store.purchase({key})  

Where key is the itemID string (I’ve checked to make sure “key” is actually loaded with an item ID).  

Thanks for any insight!

Try not having the product ID in a table, have some recolection of that being a problem:

[lua]store.purchase(key)[/lua]

Holy frijoles, that was it.  Jonjonsson, you have saved me I don’t know how many hours of frustration.  I’m not even sure why I had the key in a table in the first place, but that’s the kind of thing I would never see even though it’s right there.  I owe you, man!

-Stephen

No problem! The table thing is in the documentation actually, I was having problems and decided to try it without the table. 

I havn’t implemented iOS yet, so it might be required there.

Yeah, I now see that an array of products is used in the regular store.purchase api , but in the Google V3 IAP plugin version it demonstrably fails if the product string is in an array. I bet you’re right about iOS needing it in an array.  That’s one gotcha they really should call out in the documentation (along with a link to the Google V3 plugin docs from the regular IAP docs).

I’m getting the following error while trying to perform a loadProducts operation with Google billing v3:

java.lang.IllegalStateException: Can’t start async operation (refresh inventory) because another async operation(refresh inventory) is in progress.

There’s a thread on stackoverflow suggesting that this is a bug in Google’s APIs. 

Anyone else experienced this error and know a possible workaround?

Cheers!

For iOS, it is a table.  I guess this is a feature for V3 that’s different than V2.  Amazon also does not use a table, just individual items.

Hi im using the plugin v3 etc but when I try to get the tittle of the item

print( event.products[i].title )

I recibe the title but with a (name of the app) anyone know why is that? I just want the

tittle of the product not

“tittle (name of the app)”

@zutgames - did you ever find a way around this problem?

We have it occasionally happen us when using loadProducts, but we have our own bool to prevent us calling loadProducts if it has already been called (the bool is then set to false in the loadProducts callback). 

@AlanPlantPot - I’m just calling it once per session, on application start. Originally I was calling loadProducts immediately after initing the store, which was producing the error. Now I’m waiting for a couple of seconds before the call which seems to have fixed the issue, but haven’t tested this extensively.