poiuytrez / androidinappbilling Goto Github PK
View Code? Open in Web Editor NEWAndroid App Billing plugin for Cordova
Android App Billing plugin for Cordova
Please provide a way to get a receipt for purchased product
Hi everyone,
I am new to phonegap and just started on my first app. I am wondering which link of v3 should I pull if I am using cordova plugin add command?
When I install the plugin manually, I encountered "module is not defined" error after I run the app in the inappbilling.js line 101 "module.exports = new InAppBilling();"
I followed all the steps in the readme file, but I still cannot figure out where I am wrong.
Thanks!
Hi,
how to retrieve the nonce in the JS, to send it to the backend server using ajax ?
it would be nice to retrieve the data needed to check if the used has really purchased. from backend server to google API.
need nonce and signature
Is there a possibility to get the SKU from a purchase?
Thanks!
I'm testing the static responses with this plugin.
The android.test.purchased is working fine.
However, android.test.item_unavailable returns an notification about cancellation, and an already owned "android.test.purchased" is doing the same
so I've added these lines in IabHelper.java:
else if (resultCode == Activity.RESULT_CANCELED) {
result = new IabResult(IABHELPER_USER_CANCELLED, "User canceled.");
if( responseCode == BILLING_RESPONSE_RESULT_ITEM_UNAVAILABLE )
result = new IabResult(BILLING_RESPONSE_RESULT_ITEM_UNAVAILABLE, "Item not available.");
if (responseCode == BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED)
result = new IabResult(BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED, "Item already owned");
This seems to be working, but perhaps does anyone have an idea if this is any good?
Further more:
"android.test.canceled" ends up in IabHelper.java at this line:
if (resultCode == Activity.RESULT_OK && responseCode == BILLING_RESPONSE_RESULT_OK) {
which seems odd to me. "Manually" cancelling a purchase ends up at the correct place (see above, where item_unavailable also ends up)
"android.test.refund" results in an error purchasing, -1008:Unknown error.
Does anyone know how to implement this static test?
I purchase a managed item from my app. It goes to google play. I make the purchase. it completes. Then returns to the app. A android notification appears that says the "purchase failed" even though I see it went through and money was paid to my account. The purchase success callback also gets called in my app. I can't figure out why I get the "purchase failed". I stays in the android notification tray until I cancel it.
Any ideas? Awesome plugin btw. Thanks!
I really can't get this to work. I get signature verification fail every time I attempt to do an in app billing purchase. I have of course entered the License key from Google play, but however I try it, I can't get it to work. I have tried with multiple Google accounts and with both a 2.3-unit and a 4.3-unit. I always get "Error purchasing: IabResult: Signature verification failed for sku se.fjellandermedia.kyrkoaret.bible (response: -1003:Purchase signature verification failed) at file:///android_asset/www/functions.js:13"
And weirdly enough, I don't get it at the same time as in #43, I get it only when trying to purchase an item. In the app, everything looks fine and the Google Play box says everything worked, but in the console I get the error. After this the plugin won't init because of the same error over and over again.
Does this work for you other guys? This is getting really frustrating here … Is there a way to circumvent the verification? I know it wouldn't be safe, but I'm starting to get desperate.
I've noticed other people with the same issue because they have somehow forgot the base64 key.
I did not. I was testing as usual and suddenly it stopped working. Clean installs, clear caches and new builds with previous cleans seem to have no effect.
The only thing I did was loading a new alpha version to Google Play, but the Base64-encoded RSA public key doesn't change.
Thanks for any clue.
I have tried to instal this plugin with the CLI in a ton of ways, with cordova and phonegap instructions. All my PATH variables are correct, and I have tried on phonegap 3.3.0 and 3.0.0.
It does not seem to work. The errors range from 'cannot find "ini"' to fetching plugin... "cannot fetch..."
Please could the manual instructions be updated to a working version?
I think what needs to happen is that the InAppBilling.js needs to be defined. This was the error with the iOS in app billing plugin for phonegap and it is now working.
Do I need to add Product ID in place of [productId] in inappbilling.js? please help asap. TIA
Upon consuming a purchase, the signature is not returned to the JS to do server side validation.
The signature is returned by getBuyIntent as INAPP_DATA_SIGNATURE, however this value is not made accessible to the JS.
developer.android.com/google/play/billing/billing_reference.html#getBuyIntent
After checking several time all the steps to make sure my configuration is Ok, My item is still not found.
My item to purchase is deps.item.test ( Unmanaged product )
I am not sure if it is related but i have this error
-CarrierParamsAction.createCarrierBillingParameters: Carrier billing config is null. Device is not targeted for DCB 2.
Is there anything obvious that you spot ? Many thanks !
D/CordovaLog(18815): file:///android_asset/www/plugins/com.smartmobilesoftware.inappbilling/www/inappbilling.js: Line 6 : InAppBilling[js]: setup ok
I/Web Console(18815): InAppBilling[js]: setup ok:6
D/CORDOVA_BILLING(18815): init start
D/CORDOVA_BILLING(18815): Creating IAB helper.
D/CORDOVA_BILLING(18815): Starting setup.
D/IabHelper(18815): Starting in-app billing setup.
W/PluginManager(18815): THREAD WARNING: exec() call to InAppBillingPlugin.init blocked the main thread for 76ms. Plugin should use CordovaInterface.getThreadPool().
D/IabHelper(18815): Billing service connected.
D/IabHelper(18815): Checking for in-app billing 3 support.
D/Finsky (16706): [1607] InAppBillingUtils.getPreferredAccount: com.montreal.deps: Account from first account - [sdkNy9OtgBRMmwDfMof3YGfedjA]
D/IabHelper(18815): In-app billing version 3 supported for com.montreal.deps
D/Finsky (16706): [1608] InAppBillingUtils.getPreferredAccount: com.montreal.deps: Account from first account - [sdkNy9OtgBRMmwDfMof3YGfedjA]
D/IabHelper(18815): Subscriptions AVAILABLE.
D/CORDOVA_BILLING(18815): Setup finished.
D/CORDOVA_BILLING(18815): Setup successful. Querying inventory.
D/IabHelper(18815): Starting async operation: refresh inventory
D/IabHelper(18815): Querying owned items, item type: inapp
D/IabHelper(18815): Package name: com.montreal.deps
D/IabHelper(18815): Calling getPurchases with continuation token: null
D/Finsky (16706): [1631] InAppBillingUtils.getPreferredAccount: com.montreal.deps: Account from first account - [sdkNy9OtgBRMmwDfMof3YGfedjA]
D/Finsky (16706): [1631] InAppBillingUtils.getPreferredAccount: com.montreal.deps: Account from first account - [sdkNy9OtgBRMmwDfMof3YGfedjA]
D/IabHelper(18815): Owned items response: 0
D/IabHelper(18815): Continuation token: null
D/IabHelper(18815): Querying SKU details.
D/IabHelper(18815): queryPrices: nothing to do because there are no SKUs.
D/IabHelper(18815): Querying owned items, item type: subs
D/IabHelper(18815): Package name: com.montreal.deps
D/IabHelper(18815): Calling getPurchases with continuation token: null
D/Finsky (16706): [1607] InAppBillingUtils.getPreferredAccount: com.montreal.deps: Account from first account - [sdkNy9OtgBRMmwDfMof3YGfedjA]
D/Finsky (16706): [1607] InAppBillingUtils.getPreferredAccount: com.montreal.deps: Account from first account - [sdkNy9OtgBRMmwDfMof3YGfedjA]
D/IabHelper(18815): Owned items response: 0
D/IabHelper(18815): Continuation token: null
I/ClipboardServiceEx( 2116): Send intent for dismiss clipboard dialog inside hideCurrentInputLocked() !
D/IabHelper(18815): Querying SKU details.
D/IabHelper(18815): queryPrices: nothing to do because there are no SKUs.
D/IabHelper(18815): Ending async operation: refresh inventory
D/CORDOVA_BILLING(18815): Inside mGotInventoryListener
D/CORDOVA_BILLING(18815): Query inventory was successful.
D/CordovaLog(18815): file:///android_asset/www/plugins/com.smartmobilesoftware.inappbilling/www/inappbilling.js: Line 6 : InAppBilling[js]: buy called!
I/Web Console(18815): InAppBilling[js]: buy called!:6
D/IabHelper(18815): Starting async operation: launchPurchaseFlow
D/IabHelper(18815): Constructing buy intent for deps.item.test, item type: inapp
D/Finsky (16706): [1608] InAppBillingUtils.getPreferredAccount: com.montreal.deps: Account from first account - [sdkNy9OtgBRMmwDfMof3YGfedjA]
D/Finsky (16706): [1608] InAppBillingUtils.getPreferredAccount: com.montreal.deps: Account from first account - [sdkNy9OtgBRMmwDfMof3YGfedjA]
D/Finsky (16706): [1608] InAppBillingUtils.getPreferredAccount: com.montreal.deps: Account from first account - [sdkNy9OtgBRMmwDfMof3YGfedjA]
D/IabHelper(18815): Launching buy intent for deps.item.test. Request code: 10001
W/PluginManager(18815): THREAD WARNING: exec() call to InAppBillingPlugin.buy blocked the main thread for 44ms. Plugin should use CordovaInterface.getThreadPool().
D/Finsky (16706): [1] CarrierParamsAction.createCarrierBillingParameters: Carrier billing config is null. Device is not targeted for DCB 2.
D/CordovaLog(18815): file:///android_asset/www/app/js/controllers/payment.js: Line 12 : response then payment
I/Web Console(18815): response then payment:12
D/CordovaLog(18815): file:///android_asset/www/app/js/controllers/payment.js: Line 13 : OK
I/Web Console(18815): OK:13
E/Finsky (16706): [1629] FileBasedKeyValueStore.delete: Attempt to delete 'paramsopT-pzzx02i69KNTNDgLqg' failed!
When the plugin is initialized, there's no internet connection and getProductDetails() is called, the app crashes. Steps to reproduce:
I've tried it a few times, with and without the internet connection at #3. Every time it crashed the app when connection was not present and was successful when the device was connected.
A log from ddms (I hope I got all the relevant parts):
04-22 17:02:11.728: D/CordovaLog(5729): file:///android_asset/www/plugins/com.smartmobilesoftware.inappbilling/www/inappbilling.js: Line 6 : InAppBilling[js]: getProductDetails called!
04-22 17:02:11.728: I/chromium(5729): [INFO:CONSOLE(6)] "InAppBilling[js]: getProductDetails called!", source: file:///android_asset/www/plugins/com.smartmobilesoftware.inappbilling/www/inappbilling.js (6)
04-22 17:02:11.728: D/CordovaLog(5729): file:///android_asset/www/plugins/com.smartmobilesoftware.inappbilling/www/inappbilling.js: Line 6 : InAppBilling[js]: load ["test_9"]
04-22 17:02:11.728: I/chromium(5729): [INFO:CONSOLE(6)] "InAppBilling[js]: load ["test_9"]", source: file:///android_asset/www/plugins/com.smartmobilesoftware.inappbilling/www/inappbilling.js (6)
04-22 17:02:11.728: D/CORDOVA_BILLING(5729): Num SKUs Found: 1
04-22 17:02:11.728: D/CORDOVA_BILLING(5729): Product SKU Added: test_9
04-22 17:02:11.728: D/CORDOVA_BILLING(5729): Beginning Sku(s) Query!
04-22 17:02:11.728: D/IabHelper(5729): Starting async operation: refresh inventory
04-22 17:02:11.738: D/IabHelper(5729): Querying owned items, item type: inapp
04-22 17:02:11.738: D/IabHelper(5729): Package name: info.percentagecalculator.billingTest
04-22 17:02:11.738: D/IabHelper(5729): Calling getPurchases with continuation token: null
04-22 17:02:11.738: D/Finsky(2714): [1680] InAppBillingUtils.getPreferredAccount: info.percentagecalculator.billingTest: Account from first account - [UmQOtrmjdJbOnWsGnn6iIZtCqv4]
04-22 17:02:11.748: D/Finsky(2714): [1680] InAppBillingUtils.getPreferredAccount: info.percentagecalculator.billingTest: Account from first account - [UmQOtrmjdJbOnWsGnn6iIZtCqv4]
04-22 17:02:11.748: D/IabHelper(5729): Owned items response: 0
04-22 17:02:11.748: D/IabHelper(5729): Sku is owned: test_1
04-22 17:02:11.758: D/IabHelper(5729): Sku is owned: test_2
04-22 17:02:11.758: D/IabHelper(5729): Continuation token: null
04-22 17:02:11.758: D/IabHelper(5729): Querying SKU details.
04-22 17:02:11.758: D/IabHelper(5729): moreSkus: Building SKUs List
04-22 17:02:11.758: D/IabHelper(5729): moreSkus: test_9
04-22 17:02:11.758: D/Finsky(2714): [1681] InAppBillingUtils.getPreferredAccount: info.percentagecalculator.billingTest: Account from first account - [UmQOtrmjdJbOnWsGnn6iIZtCqv4]
04-22 17:02:11.758: D/Finsky(2714): [1681] InAppBillingUtils.getPreferredAccount: info.percentagecalculator.billingTest: Account from first account - [UmQOtrmjdJbOnWsGnn6iIZtCqv4]
04-22 17:02:11.808: W/GLSUser(12641): GoogleAccountDataService.getToken()
04-22 17:02:11.868: D/IabHelper(5729): getSkuDetails() failed: 6:Error
04-22 17:02:11.868: D/IabHelper(5729): Ending async operation: refresh inventory
04-22 17:02:11.868: D/CORDOVA_BILLING(5729): Inside mGotDetailsListener
04-22 17:02:11.868: D/CORDOVA_BILLING(5729): Query details was successful.
04-22 17:02:11.868: W/dalvikvm(5729): threadid=15: thread exiting with uncaught exception (group=0x41a67ba8)
04-22 17:02:11.878: D/dalvikvm(12641): GC_CONCURRENT freed 442K, 8% free 8723K/9408K, paused 4ms+2ms, total 45ms
04-22 17:02:11.878: E/AndroidRuntime(5729): FATAL EXCEPTION: JavaBridge
04-22 17:02:11.878: E/AndroidRuntime(5729): Process: info.percentagecalculator.billingTest, PID: 5729
04-22 17:02:11.878: E/AndroidRuntime(5729): java.lang.NullPointerException
04-22 17:02:11.878: E/AndroidRuntime(5729): at com.smartmobilesoftware.inappbilling.InAppBillingPlugin$3.onQueryInventoryFinished(InAppBillingPlugin.java:313)
04-22 17:02:11.878: E/AndroidRuntime(5729): at com.smartmobilesoftware.util.IabHelper$2$1.run(IabHelper.java:630)
04-22 17:02:11.878: E/AndroidRuntime(5729): at android.os.Handler.handleCallback(Handler.java:733)
04-22 17:02:11.878: E/AndroidRuntime(5729): at android.os.Handler.dispatchMessage(Handler.java:95)
04-22 17:02:11.878: E/AndroidRuntime(5729): at android.os.Looper.loop(Looper.java:136)
04-22 17:02:11.878: E/AndroidRuntime(5729): at android.os.HandlerThread.run(HandlerThread.java:61)
04-22 17:02:11.878: W/ActivityManager(501): Force finishing activity info.percentagecalculator.billingTest/.PercentageCalculator
04-22 17:02:11.898: D/CordovaActivity(5729): Paused the application!
04-22 17:02:11.898: D/CordovaWebView(5729): Handle the pause
04-22 17:02:11.948: E/memtrack(6215): Couldn't load memtrack module (No such file or directory)
04-22 17:02:11.948: E/android.os.Debug(6215): failed to load memtrack module: -2
04-22 17:02:12.038: D/AndroidRuntime(6215): Calling main entry com.android.commands.pm.Pm
04-22 17:02:12.098: D/AndroidRuntime(6215): Shutting down VM
04-22 17:02:12.098: D/jdwp(6215): Got wake-up signal, bailing out of select
04-22 17:02:12.098: D/dalvikvm(6215): Debugger has detached; object registry had 1 entries
04-22 17:02:12.388: I/ActivityManager(501): Killing 20610:com.facebook.katana:dash/u0a124 (adj 15): empty #17
04-22 17:02:12.398: W/SurfaceFlinger(122): couldn't log to binary event log: overflow.
04-22 17:02:12.408: D/CordovaActivity(5729): CordovaActivity.onDestroy()
04-22 17:02:12.408: D/CordovaWebView(5729): >>> loadUrlNow()
04-22 17:02:12.408: D/CORDOVA_BILLING(5729): Destroying helper.
04-22 17:02:12.408: D/IabHelper(5729): Disposing.
04-22 17:02:12.408: D/IabHelper(5729): Unbinding from service.
Hi Poluytrez,
I got a problem with the file locations. Same error as wytzeschouten got.
#20
"When I open the Android project in Eclipse, it throws an error at line 8 in InAppBillingPlugin.java, which reads
package com.smartmobilesoftware.inappbilling;
The actual location of the package is android.com.smartmobilesoftware.inappbilling. But if I change this line to make Eclipse happy, the plugin fails."
Regards
Nik
Hi, thanks for the plugin. This may be a stupid question, but i would like come clarification on validating purchase. Does the plugin do any validation on its own? The buy() not returning signature confuses me.
calling inappbilling.buy() returns the json object, but not the signature. I would need the signature to validate server side. Am i looking in the wrong place?
looking at the InApBillingPlugin.java in the mPurchaseFinishedListener it makes a call to verifyDeveloperPayload(purchase) function which returns true without really doing anything. The readme does not indicate that i would have to change the .java code.
So main question is how to get the signature and how is verification meant to work with this plugin?
In the answer in issue #44 the best solution?
As far as I can see, there is no way to get the purchaseToken for an item after it has been purchased. I need the token (and developer payload) in order to check for subscription expirations at my backend server.
The logical place to get the token would be getPurchases() to mirror Google's IAB v3 which returns this information in INAPP_PURCHASE_DATA. Unfortunately this would break the current getPurchases() which only returns a list of item ids.
I will probably go ahead and implement this for my own use anyway, and submit a pull request even if it breaks the API.
Hello what is the data json that i get from google play when i purchase a product with suscription?
thanks!
Greetings,
We've modified that library to pass the signed data as well as the signature to the onPurchaseStateChanged callback. Developing it on test mode went well, purchases being done, callback successful. Using the live public key live non-managed items, everything still is working well.
After we published our app, there's no callback on the onPurchaseStateChanged, no errors or anything, the purchase is still being done properly, the only callback we receive is from onRequestPurchaseResponse and it was originally passing the productId, we've tested on a couple devices we get the same outcome.
Looking on internet, we have the rights keys, items, apk versioning properly managed on the developer console, no aLogcat errors. Any advice ?
Good day! Thanks for the great plugin!
Version 3
I purchase: android.test.purchased
Is it possible to get the signature after consumePurchase? ( for server side verification)
Code on server side, like
openssl_verify ($data, $signature, $key)
Thanks for the answer.
Hi!
Does getPurchases still return purchased subscriptions after they have expired? Or does it not return them at all? In the first case, in order to check for a purchased subscription, we need to check its purchaseTime to know whether it is still valid or not. In the second case, if the subscription simply exists, then it is valid already. I am asking so I don't have to wait at least a month for a subscription to expire to find out.
Thanks for the great work!
I am able to init in app billing, everything works fine except the successHandler function does not seem to fire.
function onDeviceReady()
{
// Now safe to use the PhoneGap API
//alert('onDeviceReady');
// Initialize the billing plugin
inappbilling.init(successInit, errorHandler);
}
function successInit (result)
{
alert('test');
}
the alert never fires. I am able to use in app billing though so the plugin is successfully initialized.
First, thank you so much for the work you have done in developing this plugin!
It seems like the new v3 release does not match the documentation. I opened up the inappbilling.js file and removed the "prototype." and at least got the init function to fire. Also, the case has changed in the new .js file and my program had to be changed accordingly (the sample documentation is still all lower case).
Aside from the alert I placed in the .js file firing. I am not getting any success or error responses from the function. I have checked the setup a million times and cannot see anything that I could have missed.
I'm so close.....
So, I'm confused... I've followed the example, and traced through the code, and the IabHelper is being successfully set up... then when it tries to query the inventory, I get an error saying "In-app billing error: Illegal state for operation (queryInventoryAsync): IAB helper is not set up."
The logs indicate that the setup is being completed successfully, however the queryInventoryAsync call fails every time.
I have no idea where to go from here, any help would be appreciated. I tried removing the "setup" check, but that didn't help...
Here's my logs:
05-26 09:35:22.999: I/chromium(11581): [INFO:CONSOLE(6)] "InAppBilling[js]: setup ok", source: file:///android_asset/www/plugins/com.smartmobilesoftware.inappbilling/www/inappbilling.js (6)
05-26 09:35:22.999: D/CORDOVA_BILLING(11581): init start
05-26 09:35:22.999: D/CORDOVA_BILLING(11581): Creating IAB helper.
05-26 09:35:22.999: D/CORDOVA_BILLING(11581): Starting setup.
05-26 09:35:22.999: D/IabHelper(11581): Starting in-app billing setup.
05-26 09:35:23.049: D/IabHelper(11581): Billing service connected.
05-26 09:35:23.049: D/IabHelper(11581): Checking for in-app billing 3 support.
05-26 09:35:23.110: D/Finsky(16254): [21643] InAppBillingUtils.pickAccount: com.weever.streetsmarts: Account determined from installer data - [u2B8B-eCVRdcCYh9DaSZlzqpMcA]
05-26 09:35:23.110: D/IabHelper(11581): In-app billing version 3 supported for com.weever.streetsmarts
05-26 09:35:23.110: D/Finsky(16254): [21610] InAppBillingUtils.pickAccount: com.weever.streetsmarts: Account determined from installer data - [u2B8B-eCVRdcCYh9DaSZlzqpMcA]
05-26 09:35:23.110: D/IabHelper(11581): Subscriptions AVAILABLE.
05-26 09:35:23.110: D/IabHelper(11581): Everything set up sucessfully!
05-26 09:35:23.110: D/CORDOVA_BILLING(11581): Setup finished.
05-26 09:35:23.110: D/CORDOVA_BILLING(11581): Setup successful. Querying inventory.
05-26 09:35:23.110: E/IabHelper(11581): In-app billing error: Illegal state for operation (queryInventoryAsync): IAB helper is not set up.
05-26 09:35:23.120: D/AndroidRuntime(11581): Shutting down VM
05-26 09:35:23.120: W/dalvikvm(11581): threadid=1: thread exiting with uncaught exception (group=0x418abda0)
05-26 09:35:23.120: E/AndroidRuntime(11581): FATAL EXCEPTION: main
05-26 09:35:23.120: E/AndroidRuntime(11581): Process: com.weever.streetsmarts, PID: 11581
05-26 09:35:23.120: E/AndroidRuntime(11581): java.lang.IllegalStateException: IAB helper is not set up. Can't perform operation: queryInventoryAsync
05-26 09:35:23.120: E/AndroidRuntime(11581): at com.smartmobilesoftware.util.IabHelper.checkSetupDone(IabHelper.java:784)
05-26 09:35:23.120: E/AndroidRuntime(11581): at com.smartmobilesoftware.util.IabHelper.queryInventoryAsync(IabHelper.java:612)
05-26 09:35:23.120: E/AndroidRuntime(11581): at com.smartmobilesoftware.util.IabHelper.queryInventoryAsync(IabHelper.java:641)
05-26 09:35:23.120: E/AndroidRuntime(11581): at com.smartmobilesoftware.inappbilling.InAppBillingPlugin$1.onIabSetupFinished(InAppBillingPlugin.java:166)
05-26 09:35:23.120: E/AndroidRuntime(11581): at com.smartmobilesoftware.util.IabHelper$1.onServiceConnected(IabHelper.java:262)
05-26 09:35:23.120: E/AndroidRuntime(11581): at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1119)
05-26 09:35:23.120: E/AndroidRuntime(11581): at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1136)
05-26 09:35:23.120: E/AndroidRuntime(11581): at android.os.Handler.handleCallback(Handler.java:733)
05-26 09:35:23.120: E/AndroidRuntime(11581): at android.os.Handler.dispatchMessage(Handler.java:95)
05-26 09:35:23.120: E/AndroidRuntime(11581): at android.os.Looper.loop(Looper.java:157)
05-26 09:35:23.120: E/AndroidRuntime(11581): at android.app.ActivityThread.main(ActivityThread.java:5356)
05-26 09:35:23.120: E/AndroidRuntime(11581): at java.lang.reflect.Method.invokeNative(Native Method)
05-26 09:35:23.120: E/AndroidRuntime(11581): at java.lang.reflect.Method.invoke(Method.java:515)
05-26 09:35:23.120: E/AndroidRuntime(11581): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
05-26 09:35:23.120: E/AndroidRuntime(11581): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
05-26 09:35:23.120: E/AndroidRuntime(11581): at dalvik.system.NativeStart.main(Native Method)
05-26 09:35:23.120: W/ActivityManager(869): Force finishing activity com.weever.streetsmarts/.StreetSmarts
Hello ,
Thank You for your great efforts and work in this plugins . i am a new one who using phonegap . i got a headache about the alert of "ERROR: Class not found".
i have change the the following code
In InAppBillingPlugin.java
"package com.smartmobilesoftware.inappbilling;"
change to
"package android.com.smartmobilesoftware.inappbilling;"
then build an apk and install in nexus 7 , click "initalize billing plugin" , it alerts "ERROR : Class not found"
i am using lastest version of Cordova and also setup the merchant in development console.
would you please let me know how to fix this. THANK YOU VERY MUCH
Buying a product by using the plugin works fine for me. But for many reasons I need the full response information with all the transaction details after completing a purchase. It seems that the buy method only provides the product ID.
a) Is it correct that product ID is the only information that is provided by the buy method?
b) If so, are there any plans to provide the full response (like the consume method does) short term?
c) Would you provide support to modify the plugin in a way that it provides the full response?
Hello,
I'm new to in-app billing, I integrated the demo in my project an set up so in-app item in the developer console. The init function get a success message back but when i try to get the availible products I only return an empty array. If I try to purchase an product I get an 1005 error code. Has anybody a clue?
what have I allready done:
I changed the base64 key build the app via "cordova build android --release" uploaded it to the developer console and finally installed the apk on a device.
Hello,
I have no access to the old Google Play Developper Console. Can I use this plugin with the new console and how ? (cordova 2.5, android 2.2)
Thanks
When installed on Android (cordova 3.5.0) I get “[ERROE] Error initializing Cordova: Class not found”. i checked config.xml and it looks ok.
If I remove the plugin the app works fine.
From onConsumeFinished:
myInventory.erasePurchase(purchase.getSku());
I think this means that it's not possible to get a list of purchases anymore (that includes those purchases that have been consumed).
This seems less than ideal.
In my case, I provision the "reward" to the user once the client has successfully consumed the purchase on Google Play. That process might not work for some reason, so I think having access to consumed purchases as well as consumption state is valuable.
Hello,
I'm setting up a new application. Are you planning to upgrade the project to be compatible with Cordova 3.0?
Thanks!
Are there plans to submit this plugin to PhoneGap Build?
The success callback in getProductDetails v3 doesn't return the product details in the Inventory object. I noticed that the QueryInventoryFinishedListener that is used in getProductDetails just sends success ("OK") as callback and not the details itself. I'm using this API to show the price and description before user proceeds on purchasing the IAB product.
I have been using this plugin, all of it's methods worked for me except the resoreTransactions()
. I already have made two purchases. Now the issue comes when I try to restore the previous purchases using this method when the app is resinstalled.
I first made the init()
call in the deviceReady
event.
function onDeviceReady(){
inappbilling.init(initSuccessHandler, initErrorHandler);
}
function initSuccessHandler(result){
// the code for executing below statement only once, when app is reinstalled.
inappbilling.restoreTransactions(restoreSuccessHandler, restoreErrorHandler);
}
function restoreSuccessHandler(result){
var strResult = "";
if(typeof result === 'object') {
strResult = JSON.stringify(result);
} else {
strResult = result;
}
alert(strResult );
}
The alert()
in restoreSuccessHandler()
only shows -"Restore request sent to Google Play
" , whereas it should return the previously purchased items.
What I am doing wrong here? Please help.
I would expect one item with the same structure like the return values from getOwnItems
.
GooglePlay Market can't be awaked after the button clicked in the country not supported payment (e.g. China), and has no log or msg returned, but it can be awaked in the country supported payment (e.g. Japan) . This is not friendly for customers.
So how can I check this problem and show the friendly msg for customers.
Tks.
Hi Poiyutrez,
What about the parameter provided to the error callbacks? Your example alerts the error parameter, but gives no clues as to what that parameter could be.
When I provide an error callback to any of these functions, what can I expect the error object to consist of? In non-production mode, it has been unpredictable and undocumented strings coming from the plugin or from Android.
In the Android docs, I found a nice list of error response codes: http://developer.android.com/google/play/billing/billing_reference.html
But there is no way of telling if the error object will be a simple string, or an object like
{
code: 3,
msg: "User already owns this product",
etc: "etc"
}
...or something else.
I would have tested this by triggering the various possible errors, but I can't, since Google Play does not allow me to buy my own in app products with my own device.
Can you give some clarification?
Regards,
Wytze
Update: solved (look at the bottom).
I'm running my app on two accounts on the same device: wife's (W) and my own (M).
Right now, I'm trying to run
inappbilling.init(
function(resp) {
console.log(resp);
},
function(resp) {
console.log(resp);
}
);
on W and this is what appears in the console:
Failed to query inventory: IabResult: Error refreshing inventory (querying owned items). (response: -1003:Purchase signature verification failed)
At the same time, with the same device and the same codebase, it works ok on the M account. It simply returns
OK
Additional notes:
** Solved it! **
Turns out I forgot to re-insert my base64 key after I reinstalled the plugin. I went throught 10 hours of frustrating searching and trying everything, 2 wiped devices, 1 bucket of hair pulled from my head. I hope my daughter won't find out why I'm not with her on Sunday :/
@poiuytrez please consider moving the key outside of the code. For example, a competing plugin, Google's https://github.com/MobileChromeApps/mobile-chrome-apps/tree/master/chrome-cordova/plugins/google.payments keeps it as a key in www/manifest.json.
Any clue what might be the problem?
They're turning off Old Panel - this worries me
Over the last few days I've managed to cobble together AdMob and your excellent plugin for a inApp get rid of AdMob purchase.
Can't write Java - yours was far easier than the rest of the experiment
Hi, i've followed your instructions: created an app, configured in-app purchases waited more than 8h but the plugin gives me an empty list of available products ...
do you know of any obvious stuff i may be missing?
Thank you
phone gap version : 3.3.0-0.18.0
Callback calls inside the listener methods [onQueryInventoryFinished] are not getting executed. I am doing something like what is been given in the example . Could you please guide me through.
inappbilling.init(successInit,errorCallback, {showLog:true})
function successInit(result) {
// display the extracted text
alert(result);
// make the purchase
inappbilling.buy(successPurchase, errorCallback,"gas");
}
function errorCallback(error) {
alert(error);
}
function successPurchase(productId) {
alert("Your item has been purchased!");
The callback calls inside "execute" method are working properly. I am not sure if this is a problem with the latest phonegap version.
Hi,
I've recently upgraded my app to version 2.0 and it includes your plugin. So far 85000 people upgraded and I received a dozen or so 1-star comments that the app crashes (and hell knows how many people simply uninstalled the app).
I only have one crash reported @ the Google Play Developer Console, here's the stack trace:
java.lang.NullPointerException
at com.smartmobilesoftware.util.IabHelper.queryPurchases(IabHelper.java:836)
at com.smartmobilesoftware.util.IabHelper.queryInventory(IabHelper.java:558)
at com.smartmobilesoftware.util.IabHelper.queryInventory(IabHelper.java:522)
at com.smartmobilesoftware.util.IabHelper$2.run(IabHelper.java:617)
at java.lang.Thread.run(Thread.java:856)
I found a similar (probably the same) problem on Stack Overflow ( http://stackoverflow.com/questions/15456434/billing-api-v3-iabhelper-nullpointerexception ) and it looks like IabHelper is buggy. Solutions are offered, but I don't speak Java.
@poiuytrez Can you please take a look at it?
Hello.
I was wondering if there are any plans to support plugman
or the plugin management of cordova or phonegap 3.0?
I'm setting up a complete new application and I am interested in that features.
Thanks!
I am developing an android phonegap application and I want to use in app billing in it. I installed the phonegap billing plugin and it works perfectly. Can anyone help me make it work correct with a links for example:
<a href="good.html" id='good' data-ignore="true">Good</a>
Thats after clicking on a link first of all i ll be able to pay or check if a good is already bought before linking to a page. Thanks.
Hello I'm using the V2 version and it seems to correctly work, but I've a question, if I try to purchese another time the same item (like a consumable item) the store tell me "you already have this item", How can I consume it and have another purchase of the same? Thanks
Hello when i call inappbilling.init(success, error) in the console I've an error "exec() call to unknown plugin: InAppBillingPlugin" and the error callback function get an error "Class not found".
Could you help me?
Since some days the google play console shows an alert, that apps need to switch to in-app billing API level 3. see http://developer.android.com/google/play/billing/api.html
Are there any plans to support the recent version as well. Should it just remain working?
Thanks for some information
I am using Cordova 3.4, so it may just be an issue with this. The init fails with the error "Class Not Found". I managed to fix this, but don't know if it will break for other versions of Cordova / Phonegap.
The cause is line 31 of plugin.xml:
<config-file target="config.xml" parent="/*">
I changed this to the line below and the plugin loads correctly for me now.
<config-file target="res/xml/config.xml" parent="/*">
It's possible that the location of the config file has changed in a new version of Cordova.
this works the first time, but i got this error in logcat when i try a second time
There is an error "Remote billing service crashed" and can't go to google play when I purchase a managed item from my app after lived for a long time, but it's OK when lived on my page for a short time, what's wrong?
am current develop an Android application with In-App Billing Services using Cordova 3.4. I follow this doc and use automatic installation to install and implement the function.
I created an application in Developer Console, putting the apps in Alpha testing channel, set up an testing account...etc Everything is followed to the document. As a result, the plugin can be initialised and return the result "OK" to me. But when I call the getAvailableProducts function, it only return an empty result.
One more weird issue is that when I try to use a wrong public key. The plugin can be initialised and return "OK" to me. I am wondering if I could connect to Google and get the correct in-app items. Hope anyone can give me some direction of finding what setting I could gone wrong.
Thank you!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.