Has anyone gotten In App Billing on Android to work?

Hey All,

I’m having problems with Ionic and the In App Billing library for Cordova (https://github.com/poiuytrez/AndroidInAppBilling/tree/master/v3). Every time after a purchase, my app will crash instantly. I’ve attached trace logs.

I am wondering if anyone has gotten In App Purchases to work with their Ionic project, and if so, how so?

I have tried using this tutorial: http://blog.nraboy.com/2014/08/making-android-app-purchases-ionicframework/ without luck.

Any suggestions?

D/CORDOVA_BILLING(27986): Purchase successful.
D/AndroidRuntime(27986): Shutting down VM
W/dalvikvm(27986): threadid=1: thread exiting with uncaught exception (group=0x415fbd40)
E/AndroidRuntime(27986): FATAL EXCEPTION: main
E/AndroidRuntime(27986): Process: com.bostes.hscmchoice, PID: 27986
E/AndroidRuntime(27986): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=10001, result=-1, data=Intent { (has extras) }} to activity {com.bostes.hscmchoice/com.bostes.hscmchoice.HSCMultipleChoice}: java.lang.NullPointerException
E/AndroidRuntime(27986): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:3351)
E/AndroidRuntime(27986): 	at android.app.ActivityThread.handleSendResult(ActivityThread.java:3394)
E/AndroidRuntime(27986): 	at android.app.ActivityThread.access$1300(ActivityThread.java:135)
E/AndroidRuntime(27986): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
E/AndroidRuntime(27986): 	at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(27986): 	at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime(27986): 	at android.app.ActivityThread.main(ActivityThread.java:5001)
E/AndroidRuntime(27986): 	at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(27986): 	at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(27986): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
E/AndroidRuntime(27986): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
E/AndroidRuntime(27986): 	at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
E/AndroidRuntime(27986): 	at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(27986): Caused by: java.lang.NullPointerException
E/AndroidRuntime(27986): 	at com.smartmobilesoftware.inappbilling.InAppBillingPlugin$4.onIabPurchaseFinished(InAppBillingPlugin.java:357)
E/AndroidRuntime(27986): 	at com.smartmobilesoftware.util.IabHelper.handleActivityResult(IabHelper.java:496)
E/AndroidRuntime(27986): 	at com.smartmobilesoftware.inappbilling.InAppBillingPlugin.onActivityResult(InAppBillingPlugin.java:399)
E/AndroidRuntime(27986): 	at org.apache.cordova.CordovaActivity.onActivityResult(CordovaActivity.java:897)
E/AndroidRuntime(27986): 	at android.app.Activity.dispatchActivityResult(Activity.java:5423)
E/AndroidRuntime(27986): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:3347)
E/AndroidRuntime(27986): 	... 12 more
W/ActivityManager(  694):   Force finishing activity com.bostes.hscmchoice/.HSCMultipleChoice

Hi @shubs,

Are you by chance trying to test your in-app purchases using your developer account? Google does not allow testing of IAB using the developers account. You must create a separate account for this.

Let me know if this was the reason. If not, let’s continue to troubleshoot.