Clarification regarding setting up In-App Purchase on Android

Hi,

While following the tutorial for setting up IAP at http://coronalabs.com/blog/2013/09/03/tutorial-understanding-in-app-purchases/, I ran into a couple of issues.  I did some searching afterwards, and now I am more confused than ever  LOL.  I do however have my app set up and working with the iTunes IAP, so my concern is only Android-specific.

So here are my questions:

  1. I had built a new APK with the new Google Play IAP stuff.   My currently live app (no IAP) is using Version Code 7, so the new one (with IAP) will use Version Code 8.  I uploaded it, saved it as draft and assigned it Alpha status.  OK so far, right?

  2. Then I created my IAP product.   My question is, does it take a few hours for this to process, and thus I cannot test right away?

  3. To test this product ID,  do I need to add a new Google account on my device with the tester ID specified in the Settings of the Developer Console?

  4. When I want to test the APK on my device with the test account, should this APK be signed (not debug build), and should it use the alpha draft’s version code (8), or the currently published (non-IAP) version code (7)???   I saw a post on stackoverflow where they were saying to test with the older code.  Can someone clear this up?

Any help would be great, especially from those who got it working!  

  1. Yes.  Though note that now you cannot use version code 8 for your release version since you cannot upload another APK with the same version code.  Not a big deal, but just wanted to be sure you were aware of that as I did not know this before I went in.

  2. Yes, it varies, but for me, it was like 3 or 4 hours later and I could test.

  3. In the Settings of the Google Play Developer Console, you can list the users who can test Licensing and get those responses.  But it should not affect IAP, as I recall.  if you have Licensing in your app, then you should have your test accounts listed and the license response set accordingly so that the app works as expected.  You do need to have a separate Google account from the one who owns the merchant account.  For my testing, I completely reset my Android test devices and created a new Google account for each.

  4. Once you upload your IAP-enabled APK to the Alpha in the Google Play Developer Console, every test build you do to the device needs to have the same version code as the Alpha with IAP enabled.  Otherwise, it won’t work.  You can change the version code in your builds, but that means you need to upload them as another Alpha and wait for them to propagate.  So it is best to keep with the same version code.

Thanks for the reply. I actually managed to get the IAP working a few hours after I posted. However, I’m not sure if I had the licensing actually working properly… It is saying in the console each time I launch:

WARNING: licensing.init() was already called for google.

Am I doing it wrong?   EDIT:  Nevermind, seems like it works now, as I get the license listener function called.

Is there a way to create a test account and not have actually pay for the app with real money when testing IAP??

I did try the test.android.purchased SKU with the developer account, which works for payments, but it will not trigger a restore.

I can’t say for sure that you have licensing working properly, but I do get that warning as well.

As for test accounts and not paying with real money, no, there is no sandbox method that Apple and Amazon offer.  However, you can make the purchase with an account and a real credit card, then log into your merchant account (remember that the accounts must be different Google accounts) and then cancel the transaction before it ever goes through, or wait until it goes through, then just issue a refund.

I’m pretty sure you can do this with Google Play. I’m not quite sure what I did, but I was able to get my IAP to say “Test: You will not be charged” when using my real IAP.

I was using the v3 Google IAP plugin at the time, which might be the reason it worked as a test IAP.

  1. Yes.  Though note that now you cannot use version code 8 for your release version since you cannot upload another APK with the same version code.  Not a big deal, but just wanted to be sure you were aware of that as I did not know this before I went in.

  2. Yes, it varies, but for me, it was like 3 or 4 hours later and I could test.

  3. In the Settings of the Google Play Developer Console, you can list the users who can test Licensing and get those responses.  But it should not affect IAP, as I recall.  if you have Licensing in your app, then you should have your test accounts listed and the license response set accordingly so that the app works as expected.  You do need to have a separate Google account from the one who owns the merchant account.  For my testing, I completely reset my Android test devices and created a new Google account for each.

  4. Once you upload your IAP-enabled APK to the Alpha in the Google Play Developer Console, every test build you do to the device needs to have the same version code as the Alpha with IAP enabled.  Otherwise, it won’t work.  You can change the version code in your builds, but that means you need to upload them as another Alpha and wait for them to propagate.  So it is best to keep with the same version code.

Thanks for the reply. I actually managed to get the IAP working a few hours after I posted. However, I’m not sure if I had the licensing actually working properly… It is saying in the console each time I launch:

WARNING: licensing.init() was already called for google.

Am I doing it wrong?   EDIT:  Nevermind, seems like it works now, as I get the license listener function called.

Is there a way to create a test account and not have actually pay for the app with real money when testing IAP??

I did try the test.android.purchased SKU with the developer account, which works for payments, but it will not trigger a restore.

I can’t say for sure that you have licensing working properly, but I do get that warning as well.

As for test accounts and not paying with real money, no, there is no sandbox method that Apple and Amazon offer.  However, you can make the purchase with an account and a real credit card, then log into your merchant account (remember that the accounts must be different Google accounts) and then cancel the transaction before it ever goes through, or wait until it goes through, then just issue a refund.

I’m pretty sure you can do this with Google Play. I’m not quite sure what I did, but I was able to get my IAP to say “Test: You will not be charged” when using my real IAP.

I was using the v3 Google IAP plugin at the time, which might be the reason it worked as a test IAP.