AlexDisler / cordova-plugin-inapppurchase

A lightweight cordova plugin for in app purchases on iOS/Android
316 stars 192 forks source link

Object code -2 #59

Open ACEEDesign opened 8 years ago

ACEEDesign commented 8 years ago

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

shaharyar123 commented 8 years ago

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)

mikeislearning commented 8 years ago

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.

ACEEDesign commented 8 years ago

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 notifications@github.com 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 .

mikeislearning commented 8 years ago

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

tpanhorst commented 8 years ago

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.

marcusforsberg commented 8 years ago

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 commented 8 years ago

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. :)

fpassa commented 7 years ago

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.

ACEEDesign commented 7 years ago

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

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

hootan09 commented 7 years ago

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

vhmolinar commented 7 years ago

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

FiveHundredMiles commented 6 years ago

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.

albertkai commented 6 years ago

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

gwaixin commented 4 years ago

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

matthitachi commented 4 years ago

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