IAP and Android

I am trying to implement IAP and have started with Android, but can’t get it to work. The app is published as Alpha and I have added a product, but when I do iap.list with my product id I get an empty table as product and nil in error. Any pointers?

1 Like

It can take some time for the Google servers
to propagate the info. Check again now and see if the problem persists.

Yes you were right, now it works - but I get an error from Google Play: “Authentication needed. You must log in to your Google account”. I am logged in and I don’t get that prompt when opening in-app purchases in any other app.

Are you using Closed or Open Alpha testing? Is your Google account added to the list of testers? Have you accessed the opt-in link with your Google account and joined the alpha test?

Another thing worth noting is that the version you are installing on your phone must match the version you have uploaded to Google in three ways:

  1. It must have the same versionCode
  2. It must have the same package name
  3. It must be signed using the same certificate and key

I am using Closed Alpha and my account is added and I joined (allthough I did not use the gmail-address that google has generated so that might be it. I have added it now but I guess it will take some time to propagate as well).
I have not changed versionCode, package name or signing cert and key since uploading.

What do you mean when you say “I did not use the gmail-address that google has generated”?

My google account is tied to a non-gmail address, but google has decided they want me to have a gmail-address so they have generated one for me that is shown whenever I am logged in (but I can log in with my normal address).

Ah, ok. I wonder if that’s what causing you’re problem. OTOH I’m using my @king.com address and that’s working fine.

I have changed to the gmail-address and so far it doesn’t help, but I’ll wait until tomorrow

Hmm, I think it’s something else. When I’ve made changes to the alpha/beta test groups the change has had almost instant effect.

Maybe you could invite me to your alpha test? bjorn.ritzl@gmail.com or bjorn.ritzl@king.com

Now I’m getting “The publisher can not buy this item”, so I’m guessing it’s working. I will try with another google account to confirm.

I don’t think I’ve ever since this error message. Let me know what it took to fix it.

Ok, I spoke a little prematurely it seems. The error message mentioned earlier (which is actually my english iterpretation of “Utgivaren kan inte köpa det här objektet”) is what I get when running from a bundled apk with release mode.

If I run the application from Defold with my phone as target, I still get the “Authentication needed” error, and iap.list returns an empty list. I can see that the bundled apk gets the list ok because it displays the price correctly.

Hold on. So you’re running from Defold to dmengine.apk, downloaded from d.defold.com? That won’t work, unless you’ve changed package name, version code and resigned the APK so that it matches the one you’ve uploaded to Google Play.

Could you also temporarily switch to english so that you can get the “Utgivaren kan inte köpa det här objektet” in English so that It’s easier to search for a solution on StackOverflow etc.

Ah of course, I was to tired to catch that… It would be great for debugging purposes to be able to resign dmengine - but I guess your not to keen on open sourcing it… :smile:

My translation was very close, but not exactly right: “The publisher cannot purchase this item” is the correct error message

Ah, I see. This should explain the casue of your problem and how to fix it: http://stackoverflow.com/questions/14139034/testing-in-app-billing-the-publisher-cannot-purchase-this-item

1 Like