store.consumePurchase({id}) Transaction Error?

I’m migrating from Google IAP v2 to Google IAP v3, and I’m trying to use store.consumePurchase({id}).

For whatever reason, it’s not working. Yes, I have the plugin in my build.settings, and I have the license key in my config.lua.

When I called store.purchase(id), the confirmation screen popped up, so I know that my transaction listener and product id aren’t the problem. After, I called store.consumePurchase({id}), but got an error when doing so. This is what printed: “Transaction failed, type: -1003 Error refreshing inventory (querying owned items). (response: -1003:Purchase signature verification failed)”

Here’s the code I’m using. http://pastebin.com/Wa9AnKW2

If that above code looks correct, then I have no clue what the issue might be. It’s possible that my config.lua and build.settings are set up incorrectly, but that wouldn’t make much sense seeing how store.purchase(id) works correctly for me. store.consumePurchase({id}), however, does not. :frowning:

Is this happening to anyone else?

I hate to keep replying to my own thread, but I still haven’t solved this issue. I’ve tried the #android-dev IRC room, and they don’t know, either.

I think your doing it wrong, I’ve just started V 3 IAP

but I think you have to do store.consumePurchase({id}) in your store transactionwhen you’ve confirmed your purchase and release the item. I’ve been having rare crashes when I purchase IAP in my app and now I can have items that I purchased but didn’t consume be retrieved.

basically use store.consumePurchase({id})  in transactionListener 

if state == “purchased” then
      print(“Success!”)

     store.consumePurchase({transaction.productIdentifier})

end

Is this happening to anyone else?

I hate to keep replying to my own thread, but I still haven’t solved this issue. I’ve tried the #android-dev IRC room, and they don’t know, either.

I’m getting same error when trying to use store.loadProducts. Worked first couple of times and now I’m just getting:

[lua]errorString = “Error refreshing inventory (querying owned items). (response: -1003:Purchase signature verification failed)”,

name = “productList”,

isError = true,

errorType = -1003,

[/lua]

Any ideas?

I guess its because I test purchased them and now they are not available anymore since I own them. I will try the store.consumePurchase({transaction.productIdentifier}) trick.

I think your doing it wrong, I’ve just started V 3 IAP

but I think you have to do store.consumePurchase({id}) in your store transactionwhen you’ve confirmed your purchase and release the item. I’ve been having rare crashes when I purchase IAP in my app and now I can have items that I purchased but didn’t consume be retrieved.

basically use store.consumePurchase({id})  in transactionListener 

if state == “purchased” then
      print(“Success!”)

     store.consumePurchase({transaction.productIdentifier})

end

I’m getting same error when trying to use store.loadProducts. Worked first couple of times and now I’m just getting:

[lua]errorString = “Error refreshing inventory (querying owned items). (response: -1003:Purchase signature verification failed)”,

name = “productList”,

isError = true,

errorType = -1003,

[/lua]

Any ideas?

I guess its because I test purchased them and now they are not available anymore since I own them. I will try the store.consumePurchase({transaction.productIdentifier}) trick.

We have now got a similar problem. We tried to make a purchase - a real product using a test account, we did not use one of the android test ids. 

The Google Popup box appeared, we both entered our passwords as normal, and got the “this is a test purchase you will not be charged etc” message. When we pressed ok, the application crashed and stopped responding.

We think this crash may have happened because we had the wrong googlePlayGamesAppId in our build.settings. 

However now if we try to call store.loadProducts we get the following error:

error refreshing inventory (querying owned items). (response: -1003:Purchase signature verification failed)

We’ve looked up this error, and every link I see says that someone tried to make a test purchase using android.test.purchased, which we did not do.

I then found this topic, which says that we need to use store.consumePurchase({transaction.productIdentifier}). We’ve been using that for months already in one of our other apps which use exactly the same lua file that we are using now to handle all store functions. However we don’t seem to be able to call consumePurchase any more (since the failed purchase nothing in the store works) so we can’t consume the offending item.

Can anyone help us out with this at all? We’re pulling our hair out trying to solve this before submitting.

Edit: this is the returned data we get when making the first purchase

 D/IabHelper(20893): Starting async operation: refresh inventory D/dchan (20893): Inventory refresh successful. (response: 0:OK) D/IabHelper(20893): Querying owned items, item type: inapp D/IabHelper(20893): Package name: com.my.game D/IabHelper(20893): Calling getPurchases with continuation token: null D/Finsky (17292): [798] InAppBillingUtils.getPreferredAccount: com.my.game: Account from first account - [hz0AOjMW0S\_KNSX3z-B9OZxAwkE] D/Finsky (17292): [798] InAppBillingUtils.getPreferredAccount: com.my.game: Account from first account - [hz0AOjMW0S\_KNSX3z-B9OZxAwkE] D/IabHelper(20893): Owned items response: 0 E/IABUtil/Security(20893): Signature verification failed. W/IabHelper(20893): In-app billing warning: Purchase signature verification \*\*FAILED\*\*. Not adding item. D/IabHelper(20893): Purchase data: {"orderId":"12999763169054705758.1399594758502571","packageName":"com.my.game","productId":"my.game.consumableone","purchaseTime":1401295204051,"purchaseState":0,"purchaseToken":"lotsOfCharacters"} D/IabHelper(20893): Signature: aLongSignatureStringLikeWeWouldNormallySee== D/IabHelper(20893): Continuation token: null D/dchan (20893): Error refreshing inventory (querying owned items). (response: -1003:Purchase signature verification failed) D/IabHelper(20893): Ending async operation: refresh inventory W/dalvikvm(20893): threadid=18: thread exiting with uncaught exception (group=0x41d02e18) I/Corona (20893): [IAP] event.transaction.state: failed I/Corona (20893): [IAP] event.transaction.date: nil I/Corona (20893): [IAP] event.transaction.identifier: nil I/Corona (20893): [IAP] event.transaction.productIdentifier: nil I/Corona (20893): [IAP] in failed I/Corona (20893): [IAP] event.transaction.errorType: -1003 I/Corona (20893): [IAP] event.transaction.errorString: Error refreshing inventory (querying owned items). 

E/ActivityManager(  917): App crashed! Process: com.my.game E/AndroidRuntime(20893): FATAL EXCEPTION: Thread-1035 E/AndroidRuntime(20893): Process: com.my.game, PID: 20893 E/AndroidRuntime(20893): java.lang.NullPointerException E/AndroidRuntime(20893): at plugin.google.iap.v3.LuaLoader$6.onQueryInventoryFinished(LuaLoader.java:360) E/AndroidRuntime(20893): at plugin.google.iap.v3.util.IabHelper$2.run(IabHelper.java:633) E/AndroidRuntime(20893): at java.lang.Thread.run(Thread.java:864) W/ActivityManager(  917):   Force finishing activity com.my.game/com.ansca.corona.CoronaActivity

As I say, after the first attempt + crash, the next time you open the app the store will not load.

E/IABUtil/Security(20893): Signature verification failed.

That line suggests that the key you put in your build.settings file is wrong.

Sigh. That was exactly the problem, although the key is actually in config.lua and not build.settings.

The keys for all of our apps look similar at a quick glance (chars at beginning and end of string are more or less the same), so I presume we looked and thought it was the correct key.

Thanks dcan.

We have now got a similar problem. We tried to make a purchase - a real product using a test account, we did not use one of the android test ids. 

The Google Popup box appeared, we both entered our passwords as normal, and got the “this is a test purchase you will not be charged etc” message. When we pressed ok, the application crashed and stopped responding.

We think this crash may have happened because we had the wrong googlePlayGamesAppId in our build.settings. 

However now if we try to call store.loadProducts we get the following error:

error refreshing inventory (querying owned items). (response: -1003:Purchase signature verification failed)

We’ve looked up this error, and every link I see says that someone tried to make a test purchase using android.test.purchased, which we did not do.

I then found this topic, which says that we need to use store.consumePurchase({transaction.productIdentifier}). We’ve been using that for months already in one of our other apps which use exactly the same lua file that we are using now to handle all store functions. However we don’t seem to be able to call consumePurchase any more (since the failed purchase nothing in the store works) so we can’t consume the offending item.

Can anyone help us out with this at all? We’re pulling our hair out trying to solve this before submitting.

Edit: this is the returned data we get when making the first purchase

 D/IabHelper(20893): Starting async operation: refresh inventory D/dchan (20893): Inventory refresh successful. (response: 0:OK) D/IabHelper(20893): Querying owned items, item type: inapp D/IabHelper(20893): Package name: com.my.game D/IabHelper(20893): Calling getPurchases with continuation token: null D/Finsky (17292): [798] InAppBillingUtils.getPreferredAccount: com.my.game: Account from first account - [hz0AOjMW0S\_KNSX3z-B9OZxAwkE] D/Finsky (17292): [798] InAppBillingUtils.getPreferredAccount: com.my.game: Account from first account - [hz0AOjMW0S\_KNSX3z-B9OZxAwkE] D/IabHelper(20893): Owned items response: 0 E/IABUtil/Security(20893): Signature verification failed. W/IabHelper(20893): In-app billing warning: Purchase signature verification \*\*FAILED\*\*. Not adding item. D/IabHelper(20893): Purchase data: {"orderId":"12999763169054705758.1399594758502571","packageName":"com.my.game","productId":"my.game.consumableone","purchaseTime":1401295204051,"purchaseState":0,"purchaseToken":"lotsOfCharacters"} D/IabHelper(20893): Signature: aLongSignatureStringLikeWeWouldNormallySee== D/IabHelper(20893): Continuation token: null D/dchan (20893): Error refreshing inventory (querying owned items). (response: -1003:Purchase signature verification failed) D/IabHelper(20893): Ending async operation: refresh inventory W/dalvikvm(20893): threadid=18: thread exiting with uncaught exception (group=0x41d02e18) I/Corona (20893): [IAP] event.transaction.state: failed I/Corona (20893): [IAP] event.transaction.date: nil I/Corona (20893): [IAP] event.transaction.identifier: nil I/Corona (20893): [IAP] event.transaction.productIdentifier: nil I/Corona (20893): [IAP] in failed I/Corona (20893): [IAP] event.transaction.errorType: -1003 I/Corona (20893): [IAP] event.transaction.errorString: Error refreshing inventory (querying owned items). 

E/ActivityManager(  917): App crashed! Process: com.my.game E/AndroidRuntime(20893): FATAL EXCEPTION: Thread-1035 E/AndroidRuntime(20893): Process: com.my.game, PID: 20893 E/AndroidRuntime(20893): java.lang.NullPointerException E/AndroidRuntime(20893): at plugin.google.iap.v3.LuaLoader$6.onQueryInventoryFinished(LuaLoader.java:360) E/AndroidRuntime(20893): at plugin.google.iap.v3.util.IabHelper$2.run(IabHelper.java:633) E/AndroidRuntime(20893): at java.lang.Thread.run(Thread.java:864) W/ActivityManager(  917):   Force finishing activity com.my.game/com.ansca.corona.CoronaActivity

As I say, after the first attempt + crash, the next time you open the app the store will not load.

E/IABUtil/Security(20893): Signature verification failed.

That line suggests that the key you put in your build.settings file is wrong.

Sigh. That was exactly the problem, although the key is actually in config.lua and not build.settings.

The keys for all of our apps look similar at a quick glance (chars at beginning and end of string are more or less the same), so I presume we looked and thought it was the correct key.

Thanks dcan.