In-App purchases not working

I did notice that you are calling init when you click the buy button. I would move that to scene:create (if using Composer).  I believe some of these calls take some time to complete.

Oh, thanks, I tought I could only open the store when I wanted to make a purchase.

I tried all kinds of code but still nothing happens when I click the button. Also, how do I know what I purchased?

How are you testing?  Testing purchases will not work in the simulator.  You will need to deploy and test on a device.

On simulator, when I click the button, I get the error message saying that in-app purchases are not available on simulator. But when I built the .apk and installed on the device, nothing happens when I press the button. I have already loged in with Google Play. Also, the first code is wrong, the unlocked purchase has to be made in the transactionCallback function. Still, that’s not the problem, I just want the purchases interface to appear.

Messages will show in the device’s console log which would require you to use “adb logcat” to view. Many instructions have you add additional parameters to filter out everything but Corona messages. However, to debug this you need to see all the other messages.  Please read this guide:

http://docs.coronalabs.com/guide/basics/debugging/index.html

and report back what’s going on in your console log.

Rob

I’ve been trying for some time to debug, but the adb doesn’t recognize any device I connect.

You may have to get the device into developer mode. You may have to install a USB driver for your device too. Google is your friend when trying to solve getting adb setup to run with your device.

Rob

Ok, so I can finally debug, guess I needed Samsung specific USB drivers.

What I got was this:

I/Corona ( 6829): PURCHASE \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* D/Finsky ( 6928): [6353] InAppBillingUtils.getPreferredAccount: \*myAPP\*: Account from first account - [\*\*\*\*] W/Finsky ( 6928): [6353] Stub.handleBillingRequest: IABv2 is deprecated I/Corona ( 6829): transactionCallback: Received event storeTransaction I/Corona ( 6829): state: failed I/Corona ( 6829): errorType: invalidClient I/Corona ( 6829): errorString: The Android Marketplace app has not been properl y configured with an account. I/Corona ( 6829): Transaction Failed

I searched for solutions of this, but still not sure how to fix this.

Here is the error of interest: 

The Android Marketplace app has not been properly configured with an account

You have to use the Google Play app and be logged in with an account that’s not your developer account.

Rob

The developer account is the one that hosts the application in the Google Play Developer Console? I happen to debug with that one, but I already tried with other accounts and it was the same. I’ll debug with other accounts.

I/Corona (27501): PURCHASE \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* D/Finsky (29350): [6852] InAppBillingUtils.getPreferredAccount: \*myApp\*: Account from first account - [\*\*\*] W/Finsky (29350): [6852] Stub.handleBillingRequest: IABv2 is deprecated I/Corona (27501): transactionCallback: Received event storeTransaction I/Corona (27501): state: failed I/Corona (27501): errorType: invalidClient I/Corona (27501): errorString: The Android Marketplace app has not been properl y configured with an account. I/Corona (27501): Transaction Failed

I tried with a different account and the same error appeared. Also, should I use local store = require( “store” ) or
local store = require(“plugin.google.iap.v3”)? The last one just freezes my purchase page.

Please review the IAP guide.  It covers the IAPv3 changes…  https://docs.coronalabs.com/guide/monetization/IAP/index.html

You need to add things to build.settings in two places as well as config.lua.  Then you have to test to see if you’re on Android and specifically require the v3 plugin, else just use the store plugin. Amazon has a similar different require process for including it.

Rob

Thanks, it looks like I was still being guided by old tutorials. I managed to get some feedback from the buttons. I get the interface nut it says that I need to be logged in my Google Account all the time. I tried with several accounts and it’s the same thing.

Does somebody knows how to solve it? I tryed in every way possible and I get that error everytime.