cordova-plugin-inapppurchase icon indicating copy to clipboard operation
cordova-plugin-inapppurchase copied to clipboard

Object code -2

Open ACEEDesign opened this issue 9 years ago • 15 comments

I'm getting

Object {code: -2, message: "Billing cannot be initialized"}

when i try to run load purchases. What does this relate to? I'm trying to use the plugin with meteor so it's hard to work out what the issue is specifically. Im thinking its most likely the manifest.json is not being picked up

ACEEDesign avatar Aug 17 '16 11:08 ACEEDesign

Object {message: "Billing is not initialized", code: -3, errorCode: -3}

i am working on ionic meteor and i am facing the same error while running the in-app purchase code i.e inAppPurchase.buy(productId)

shaharyar123 avatar Aug 24 '16 12:08 shaharyar123

I'm also doing ionic Meteor, and have the same code: -2 error. I have BILLING_KEY set in my mobile config, but unsure if that is working correctly.

mikeislearning avatar Aug 25 '16 18:08 mikeislearning

I gave up and used https://github.com/cranberrygame/cordova-plugin-payment-iap

Works well and quite straight forward to implement (for android anyway)

On 25 August 2016 at 20:43, Michael MacPherson [email protected] wrote:

I'm also doing ionic Meteor, and have the same code: -2 error. I have BILLING_KEY set in my mobile config, but unsure if that is working correctly.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AlexDisler/cordova-plugin-inapppurchase/issues/59#issuecomment-242496758, or mute the thread https://github.com/notifications/unsubscribe-auth/AS4iFKslQK-RK5svd85PY41wjWTb6rZwks5qjeJpgaJpZM4JmXAn .

ACEEDesign avatar Aug 26 '16 11:08 ACEEDesign

Nice, I ended up going with https://github.com/poiuytrez/AndroidInAppBilling

mikeislearning avatar Aug 26 '16 16:08 mikeislearning

I was having this problem and realized that my 'manifest.json' was in my root directory and not in my 'www' directory. Dumb mistake since it says "www folder" in the docs, but you might want to check that you are not also making this mistake. This library worked great for me after fixing that mistake.

tpanhorst avatar Sep 12 '16 17:09 tpanhorst

I have successfully implemented and tested this plugin on iOS. However, on Android I'm getting error code -2 like you guys bit with a different message:

Object {code: -2, message: "Unable to initialize billing: IabResult: Error che…ing v3 support. (response: 3:Billing Unavailable)", text: "Error checking for billing v3 support. (response: 3:Billing Unavailable)", response: 3}

I've been googling around for a bit and have seen people who've solved this particular message by clearing the cache and/or data of the Play Store app but that hasn't worked for me. Has any one else had this variation of "error code -2" using this plugin?

I had previously tried Jean-Christophe Hoelt's plugin and got that working, but I really disliked the API of that plugin compared to this clean one.

marcusforsberg avatar Sep 12 '16 17:09 marcusforsberg

My issue was that I had two Google accounts on my phone. The first one in order had no billing support, while the other one did - and the billing service apparently just grabbed the first account in the list and failed because that one didn't have support. Everything works fine after logging out from the first account (so the account I do have billing support on is first in the list of Google accounts on the phone) - so my issue was definitely unrelated to that in this thread. :)

marcusforsberg avatar Sep 13 '16 14:09 marcusforsberg

I ended up by using this plugin: cordova-plugin-payment-iap (https://github.com/cranberrygame/cordova-plugin-payment-iap) as it has been wide tested and documented in https://codecanyon.net/item/quizionic2-ionic2-app-template-w-sqlite-admob-inapppurchase/18182426 app template.

fpassa avatar Apr 12 '17 18:04 fpassa

I have found the solution, create the manifest like this for meteor apps

[Project Root]/cordova-build-override/www/manifest.json

ACEEDesign avatar Jun 29 '17 06:06 ACEEDesign

hi .i found solution for this error after add this plugin to your project you must remove the android platform and install it again with command: $ cordova platforms remove android then $ cordova platforms add android

hootan09 avatar Jul 16 '17 14:07 hootan09

As mentioned by @hootan09 , it can be solved by adding platform again. Thanks

vhmolinar avatar Oct 06 '17 02:10 vhmolinar

I encountered the "Billing cannot be initialized" error. I think I know what caused that. Check and make sure the manifest.json is under the "www" directory.

FiveHundredMiles avatar Dec 03 '17 15:12 FiveHundredMiles

@ACEEDesign solution worked) that is also mentioned in the Meteor guide

albertkai avatar Feb 17 '18 15:02 albertkai

I found the solution that works for me. Instead of creating the manifest.json to /www, it should be inside /platforms/android/platform_www

gwaixin avatar Feb 02 '20 09:02 gwaixin

For ionic, I solved it by following the instruction here https://stackoverflow.com/questions/39125226/in-app-purchase-object-message-billing-is-not-initialized-code-3-errorco/63399431#63399431

matthitachi avatar Aug 13 '20 16:08 matthitachi