Google IAP v3 "FATAL EXCEPTION" from store.init

My first venture into IAPv3 isn’t going so well. I’ve got an apk with release key in draft, several IAP’s active, the base64 RSA key in config.lua, the v3 plugin and all necessary permissions in build.settings, etc… at least I think everything is “built”/“setup” right.

Early on I was having some trouble with “product not available” errors, (probably just propogation delay), so did a test against android.test.purchased - which sort of worked, but I think it has somehow “gunked up” the system.

Per table 1 here: http://developer.android.com/google/play/billing/billing_testing.html
I think being myself (the developer) should have given me a signed response
for a draft, but appears not (from logcat).

Seems like a ghost of that test transaction is coming back to haunt me each time I run now. :smiley:

Wondering if this issue is related?
https://code.google.com/p/marketbilling/issues/detail?id=150

Anyway, here’s the logcat immediately following store.init(), any ideas??
(the I/Corona stuff near end starting with a “@@@” is from a “print_r(event)” in my listener, the rest is all internal stuff)

D/IabHelper(22963): Starting in-app billing setup. D/IabHelper(22963): Billing service connected. D/IabHelper(22963): Checking for in-app billing 3 support. D/Finsky (21711): [1306] InAppBillingUtils.getPreferredAccount: org.davebolling er.eggheadzbounce: Account from first account - [bIRQyjloG5QEKXVsmC0XD0y8ERo] D/IabHelper(22963): In-app billing version 3 supported for org.davebollinger.egg headzbounce D/Finsky (21711): [1281] InAppBillingUtils.getPreferredAccount: org.davebolling er.eggheadzbounce: Account from first account - [bIRQyjloG5QEKXVsmC0XD0y8ERo] D/IabHelper(22963): Subscriptions AVAILABLE. D/dchan (22963): Setup successful. (response: 0:OK) D/IabHelper(22963): Starting async operation: refresh inventory D/dchan (22963): Inventory refresh successful. (response: 0:OK) D/IabHelper(22963): Querying owned items, item type: inapp D/IabHelper(22963): Package name: org.davebollinger.eggheadzbounce D/IabHelper(22963): Calling getPurchases with continuation token: null D/Finsky (21711): [1282] InAppBillingUtils.getPreferredAccount: org.davebolling er.eggheadzbounce: Account from first account - [bIRQyjloG5QEKXVsmC0XD0y8ERo] D/Finsky (21711): [1282] InAppBillingUtils.getPreferredAccount: org.davebolling er.eggheadzbounce: Account from first account - [bIRQyjloG5QEKXVsmC0XD0y8ERo] D/IabHelper(22963): Owned items response: 0 E/IABUtil/Security(22963): Purchase verification failed: missing data. W/IabHelper(22963): In-app billing warning: Purchase signature verification \*\*FA ILED\*\*. Not adding item. D/IabHelper(22963): Purchase data: {"packageName":"org.davebollinger.eggheadz bounce","orderId":"transactionId.android.test.purchased","productId":"android.te st.purchased","developerPayload":"","purchaseTime":0,"purchaseState":0,"purchase Token":"inapp:org.davebollinger.eggheadzbounce:android.test.purchased"} D/IabHelper(22963): Signature: D/IabHelper(22963): Continuation token: null D/dchan (22963): Error refreshing inventory (querying owned items). (response: -1003:Purchase signature verification failed) D/IabHelper(22963): Ending async operation: refresh inventory W/dalvikvm(22963): threadid=14: thread exiting with uncaught exception (group=0x 418b0ba8) E/AndroidRuntime(22963): FATAL EXCEPTION: Thread-1359 E/AndroidRuntime(22963): Process: org.davebollinger.eggheadzbounce, PID: 22963 E/AndroidRuntime(22963): java.lang.NullPointerException E/AndroidRuntime(22963): at plugin.google.iap.v3.LuaLoader$6.onQueryInven toryFinished(LuaLoader.java:360) E/AndroidRuntime(22963): at plugin.google.iap.v3.util.IabHelper$2.run(Iab Helper.java:633) E/AndroidRuntime(22963): at java.lang.Thread.run(Thread.java:841) I/Corona (22963): @@@ onStoreTransaction, event= I/Corona (22963): table: 0x68b73370 { I/Corona (22963): [name] =\> "storeTransaction" I/Corona (22963): [transaction] =\> table: 0x68b73370 { I/Corona (22963): [state] =\> "failed" I/Corona (22963): [errorString] =\> "Error refreshing inven tory (querying owned items). (response: -1003:Purchase signature verification fa iled)" I/Corona (22963): [isError] =\> true I/Corona (22963): [errorType] =\> -1003 I/Corona (22963): } I/Corona (22963): } I/Corona (22963): Transaction failed, type: -1003 Error refreshing invento ry (querying owned items). (response: -1003:Purchase signature verification fail ed) W/ActivityManager( 517): Force finishing activity org.davebollinger.eggheadzb ounce/com.ansca.corona.CoronaActivity

found a bit more…

googling for “android.test.purchased signature verification failed” turns up a ton of results, seems this is a well-known bug in G’s IabHelper (namely in Security:verifyPurchase() where TextUtils.isEmpty() versus transactions w/o sigs)

Also seems that table in G’s docs is no longer correct (perhaps since they started per-app keys?), as the developer-on-draft scenario does NOT return a signed response any more. So that’s what “creates” the problem, then the IabHelper manifests it.

This guy has a nice “collection” of issues/fixes:
http://www.gmtdev.com/blog/2014/03/28/google-billing-problems-to-be-aware-of/

Also here:
http://stackoverflow.com/questions/14600664/android-in-app-purchase-signature-verification-failed/22088718#22088718

(and elsewhere)

And there’s (apparently) no way to fix it from where I’m sitting – that transaction is “permanently” gunking up store.init(), reliably crashing every time, so never even have an opportunity to try (for example) store.consumePurchase() to see if I can purge it.

It needs to be patched in Corona for sure. But until then, seems like using android.test.purchased should be avoided – do your tests with a registered test user using “real” iap’s (where you’ll get sigs back, so avoid the crash scenario) instead of this test one. fwiw, hth

I just updated one of my games to IAP v3.

I haven’t any problem with store.init, but I am using real IAPs.

The only thing that I noticed is that the receipt (returned on event.transaction.receipt) is coming nil and its value it’s being returned as event.transaction.originalJson

Ive just tried to update one of my games to IAP v3 because IAP v2 was painfully slow (takes a number of minutes to complete a purchase) and i was hoping v3 was better, however I has been a dismal failure for me. As soon as i call store.init the app just freezes and gets an ANR from google.

I am just doing

local store = require( “store” )

if store.target == “google” then

    store = require(“plugin.google.iap.v3”)

end

store.init( transactionIAPCallback )

I have also tried store.init( “google”, transactionIAPCallback ) but same result. The ANR occurs as soon as .init is called.

Can anyone help? or does anyone have any suggestions? I am using latest public release 2014.2189 and yes i have my build.settings and config.lua setup correctly as per the doco.

does anything show up in a logcat *:V?
had you done any test purchases (android.test.purchase.* productids)? or just real iap’s?
had you tested with a draft production? (no longer supported) or beta? (how you must do it now)
(see very bottom of: http://developer.android.com/google/play/billing/billing_testing.html#draft_apps))
with your dev acct or a registered beta test acct?

if logcat suggests you have a “bad” test transaction gunking up your system (as i did), then how you fix it might depend on how you created it. if you had everything set up “right” (beta, test acct, real iap’s) then you might find the transaction in your wallet merchant acct and can cancel it there (will take a few hours to actually clear). if not, you may just have to wait it out until the test transaction clears itself. (may take several days)

$.02, fwiw, hth

nothing in logcat. Had done real iap purchases previously with it in v2 (which went through fine), couldnt get past the store.init when i tried to convert it to v3. I hadnt yet uploaded the v3 app to alpha/beta, was just checking that other things like loadproducts was workign first before going to the extra effort required to test purchases.

Google’s is now requiring you set up an alpha or beta test in order to test your IAP.  Check this thread for more info:

http://forums.coronalabs.com/topic/48254-google-iap-heads-up/ 

Not sure what would cause init to choke, but it could prevent you from loading your products.

found a bit more…

googling for “android.test.purchased signature verification failed” turns up a ton of results, seems this is a well-known bug in G’s IabHelper (namely in Security:verifyPurchase() where TextUtils.isEmpty() versus transactions w/o sigs)

Also seems that table in G’s docs is no longer correct (perhaps since they started per-app keys?), as the developer-on-draft scenario does NOT return a signed response any more. So that’s what “creates” the problem, then the IabHelper manifests it.

This guy has a nice “collection” of issues/fixes:
http://www.gmtdev.com/blog/2014/03/28/google-billing-problems-to-be-aware-of/

Also here:
http://stackoverflow.com/questions/14600664/android-in-app-purchase-signature-verification-failed/22088718#22088718

(and elsewhere)

And there’s (apparently) no way to fix it from where I’m sitting – that transaction is “permanently” gunking up store.init(), reliably crashing every time, so never even have an opportunity to try (for example) store.consumePurchase() to see if I can purge it.

It needs to be patched in Corona for sure. But until then, seems like using android.test.purchased should be avoided – do your tests with a registered test user using “real” iap’s (where you’ll get sigs back, so avoid the crash scenario) instead of this test one. fwiw, hth

I just updated one of my games to IAP v3.

I haven’t any problem with store.init, but I am using real IAPs.

The only thing that I noticed is that the receipt (returned on event.transaction.receipt) is coming nil and its value it’s being returned as event.transaction.originalJson

Ive just tried to update one of my games to IAP v3 because IAP v2 was painfully slow (takes a number of minutes to complete a purchase) and i was hoping v3 was better, however I has been a dismal failure for me. As soon as i call store.init the app just freezes and gets an ANR from google.

I am just doing

local store = require( “store” )

if store.target == “google” then

    store = require(“plugin.google.iap.v3”)

end

store.init( transactionIAPCallback )

I have also tried store.init( “google”, transactionIAPCallback ) but same result. The ANR occurs as soon as .init is called.

Can anyone help? or does anyone have any suggestions? I am using latest public release 2014.2189 and yes i have my build.settings and config.lua setup correctly as per the doco.

does anything show up in a logcat *:V?
had you done any test purchases (android.test.purchase.* productids)? or just real iap’s?
had you tested with a draft production? (no longer supported) or beta? (how you must do it now)
(see very bottom of: http://developer.android.com/google/play/billing/billing_testing.html#draft_apps))
with your dev acct or a registered beta test acct?

if logcat suggests you have a “bad” test transaction gunking up your system (as i did), then how you fix it might depend on how you created it. if you had everything set up “right” (beta, test acct, real iap’s) then you might find the transaction in your wallet merchant acct and can cancel it there (will take a few hours to actually clear). if not, you may just have to wait it out until the test transaction clears itself. (may take several days)

$.02, fwiw, hth

nothing in logcat. Had done real iap purchases previously with it in v2 (which went through fine), couldnt get past the store.init when i tried to convert it to v3. I hadnt yet uploaded the v3 app to alpha/beta, was just checking that other things like loadproducts was workign first before going to the extra effort required to test purchases.

Google’s is now requiring you set up an alpha or beta test in order to test your IAP.  Check this thread for more info:

http://forums.coronalabs.com/topic/48254-google-iap-heads-up/ 

Not sure what would cause init to choke, but it could prevent you from loading your products.

I am having the same freeze issue for store init on google, what I found out is that if I use a wifi connection, things work as intended, but as soon as I turn off wifi, and use my cellphone connection (which is 4G verizon wireless), I am having the freeze issue, I put a print before and after the store.init call, and it obviously hangs over the init call and never comes back. This is quite annoying, and I am not sure what I can do to debug it, since wifi works just fine, so my code supposedly does what it intends to do. I hope corona can spill out a bit more info for me to look at.

I think I found a work around this issue, it appears that store.init() takes sometime to finish, so if I move the call at the beginning of the application, then when I come to actually use the store functionality, it already completes the init, and it no longer freezes when I tries to purchase something.

I am having the same freeze issue for store init on google, what I found out is that if I use a wifi connection, things work as intended, but as soon as I turn off wifi, and use my cellphone connection (which is 4G verizon wireless), I am having the freeze issue, I put a print before and after the store.init call, and it obviously hangs over the init call and never comes back. This is quite annoying, and I am not sure what I can do to debug it, since wifi works just fine, so my code supposedly does what it intends to do. I hope corona can spill out a bit more info for me to look at.

I think I found a work around this issue, it appears that store.init() takes sometime to finish, so if I move the call at the beginning of the application, then when I come to actually use the store functionality, it already completes the init, and it no longer freezes when I tries to purchase something.