Unity 4.2 Android In-App Billing: Signature verification failed

2.2k views Asked by At

I am testing an App in Unity using a prime[31] plugin in which the user is able to purchase sounds. If a sound button is clicked, a .cs file PurchasableSound is called which determines if the sound has been purchased or not. (FYI it tries to do so using PlayerPrefs.GetInt, however, I haven't managed to get it to work). If the sound has not yet been purchased, I call another .cs file, PurchaseSounds, which activates a panel in unity in which the user can choose to buy either 4 or 10 of all purchasable sounds. In that piece of code, GoogleIAB.init(key) and GoogleIAB.queryInventory(skus) are executed and the one of the two products mentioned above can be purchased.

However, during execution of the entire scene on my Android device, the Signature verification fails:

    09-06 18:10:08.998: I/Unity(10536):  
09-06 18:10:08.998: I/Unity(10536): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54)
09-06 18:10:09.008: E/Prime31-SEC(10536): Signature verification failed.
09-06 18:10:09.008: W/Prime31-SEC(10536): signature does not match data.
09-06 18:10:09.008: W/Prime31-IABH(10536): In-app billing warning: Purchase signature verification **FAILED**. Not adding item.
09-06 18:10:09.028: I/Unity(10536): PurchasableSound has been called.
09-06 18:10:09.028: I/Unity(10536):  
09-06 18:10:09.028: I/Unity(10536): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54)
09-06 18:10:09.028: I/Unity(10536): PurchasableSound has been called.
09-06 18:10:09.028: I/Unity(10536):  
09-06 18:10:09.028: I/Unity(10536): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54)
09-06 18:10:09.028: I/Unity(10536): PurchasableSound has been called.
09-06 18:10:09.028: I/Unity(10536):  
09-06 18:10:09.028: I/Unity(10536): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54)
09-06 18:10:09.339: I/Unity(10536): billingSupportedEvent
09-06 18:10:09.339: I/Unity(10536):  
09-06 18:10:09.339: I/Unity(10536): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54)
09-06 18:10:09.359: I/Unity(10536): queryInventoryFailedEvent: Error refreshing inventory (querying owned items). (response: -1003:Purchase signature verification failed)
09-06 18:10:09.359: I/Unity(10536):  
09-06 18:10:09.359: I/Unity(10536): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54)
09-06 18:10:11.181: D/dalvikvm(6337): GC_EXPLICIT freed 25K, 46% free 3096K/5639K, external 0K/0K, paused 54ms
09-06 18:10:11.881: E/NativeActivity(10536): channel '4068a288 com.gumasd.beta/com.unity3d.player.UnityPlayerNativeActivity (client)' ~ Failed to receive dispatch signal.  status=-11
09-06 18:10:12.212: E/NativeActivity(10536): channel '4068a288 com.gumasd.beta/com.unity3d.player.UnityPlayerNativeActivity (client)' ~ Failed to receive dispatch signal.  status=-11
09-06 18:10:12.222: E/NativeActivity(10536): channel '4068a288 com.gumasd.beta/com.unity3d.player.UnityPlayerNativeActivity (client)' ~ Failed to receive dispatch signal.  status=-11
09-06 18:10:12.232: I/Unity(10536): PurchasableSound: Click
09-06 18:10:12.232: I/Unity(10536):  
09-06 18:10:12.232: I/Unity(10536): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54)
09-06 18:10:12.232: I/Unity(10536): PurchasableSound: Sound has not yet been purchased.
09-06 18:10:12.232: I/Unity(10536):  
09-06 18:10:12.232: I/Unity(10536): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54)
09-06 18:10:12.282: I/Unity(10536): PurchaseSounds has been called.
09-06 18:10:12.282: I/Unity(10536):  
09-06 18:10:12.282: I/Unity(10536): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54)
09-06 18:10:12.282: I/keystore(1255): uid: 1000 action: e -> 7 state: 3 -> 3 retry: 4
09-06 18:10:12.292: D/Finsky(3418): [32] InAppBillingUtils.getPreferredAccount: com.gumasd.beta: Account from first account - [1sBSp5jt9jfvUfoG2wXSTiotEok]
09-06 18:10:12.292: I/Unity(10536): GoogleIAB: init was called.
09-06 18:10:12.292: I/Unity(10536):  
09-06 18:10:12.292: I/Unity(10536): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54)
09-06 18:10:12.292: I/Unity(10536): GoogleIAB: queryInventory was called.
09-06 18:10:12.292: I/Unity(10536):  
09-06 18:10:12.292: I/Unity(10536): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54)
09-06 18:10:12.302: D/Finsky(3418): [36] InAppBillingUtils.getPreferredAccount: com.gumasd.beta: Account from first account - [1sBSp5jt9jfvUfoG2wXSTiotEok]
09-06 18:10:12.312: D/Finsky(3418): [37] InAppBillingUtils.getPreferredAccount: com.gumasd.beta: Account from first account - [1sBSp5jt9jfvUfoG2wXSTiotEok]
09-06 18:10:12.322: D/Finsky(3418): [37] InAppBillingUtils.getPreferredAccount: com.gumasd.beta: Account from first account - [1sBSp5jt9jfvUfoG2wXSTiotEok]
09-06 18:10:12.332: I/Unity(10536): billingSupportedEvent
09-06 18:10:12.332: I/Unity(10536):  
09-06 18:10:12.332: I/Unity(10536): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54)
09-06 18:10:12.352: E/Prime31-SEC(10536): Signature verification failed.
09-06 18:10:12.352: W/Prime31-SEC(10536): signature does not match data.
09-06 18:10:12.352: W/Prime31-IABH(10536): In-app billing warning: Purchase signature verification **FAILED**. Not adding item.
09-06 18:10:12.372: E/Prime31-SEC(10536): Signature verification failed.
09-06 18:10:12.372: W/Prime31-SEC(10536): signature does not match data.
09-06 18:10:12.372: W/Prime31-IABH(10536): In-app billing warning: Purchase signature verification **FAILED**. Not adding item.
09-06 18:10:12.382: E/Prime31-SEC(10536): Signature verification failed.
09-06 18:10:12.382: W/Prime31-SEC(10536): signature does not match data.
09-06 18:10:12.382: W/Prime31-IABH(10536): In-app billing warning: Purchase signature verification **FAILED**. Not adding item.
09-06 18:10:12.412: E/Prime31-SEC(10536): Signature verification failed.
09-06 18:10:12.412: W/Prime31-SEC(10536): signature does not match data.
09-06 18:10:12.412: W/Prime31-IABH(10536): In-app billing warning: Purchase signature verification **FAILED**. Not adding item.
09-06 18:10:12.432: D/dalvikvm(10536): GC_CONCURRENT freed 262K, 46% free 3072K/5639K, external 2K/514K, paused 3ms+4ms
09-06 18:10:12.432: E/Prime31-SEC(10536): Signature verification failed.
09-06 18:10:12.432: W/Prime31-SEC(10536): signature does not match data.
09-06 18:10:12.432: W/Prime31-IABH(10536): In-app billing warning: Purchase signature verification **FAILED**. Not adding item.
09-06 18:10:12.442: E/Prime31-SEC(10536): Signature verification failed.
09-06 18:10:12.442: W/Prime31-SEC(10536): signature does not match data.
09-06 18:10:12.442: W/Prime31-IABH(10536): In-app billing warning: Purchase signature verification **FAILED**. Not adding item.
09-06 18:10:12.452: E/Prime31-SEC(10536): Signature verification failed.
09-06 18:10:12.452: W/Prime31-SEC(10536): signature does not match data.
09-06 18:10:12.452: W/Prime31-IABH(10536): In-app billing warning: Purchase signature verification **FAILED**. Not adding item.
09-06 18:10:12.452: E/Prime31-SEC(10536): Signature verification failed.
09-06 18:10:12.452: W/Prime31-SEC(10536): signature does not match data.
09-06 18:10:12.452: W/Prime31-IABH(10536): In-app billing warning: Purchase signature verification **FAILED**. Not adding item.
09-06 18:10:12.462: I/Unity(10536): queryInventoryFailedEvent: Error refreshing inventory (querying owned items). (response: -1003:Purchase signature verification failed)

I don't understand why this happens. I'm pretty sure there's nothing wrong with the Base64 License Key I added. Based on 09-06 18:10:12.332: I/Unity(10536): billingSupportedEvent, GoogleIAB initializes, but from queryInventoryFailedEvent: Error refreshing inventory (querying owned items). (response: -1003:Purchase signature verification failed) it's clear that my skus can't be fetched. What's going wrong and why? Does this have to do with keystore or key settings in Unity that were filled erroneously?

1

There are 1 answers

0
SongYang On

1 . I noticed

09-06 18:10:09.008: E/Prime31-SEC(10536): Signature verification failed.
09-06 18:10:09.008: W/Prime31-SEC(10536): signature does not match data.

So,I guess your public key is wrong, try to check your public Key. You can add some log in android code. I didn't use prime[31] before, but I guess there's a

mHelper = new IabHelper(this, GoogleBase64PublicKey);

code which is offered by google should be called. You can logout the key before it.

2 . make sure your sku spells right .Moreover, You should make the items be published

3 . You can find a open source project here which I wrote several days before, maybe it can be of some help.