Testing Google Play Iap While App Is In Draft Mode - "invalidclient" Error

My app is currently not yet published on Google Play, but I’ve uploaded the APK and the app is in Draft mode.

I’ve created the In-app products for it in the Google Play Developer Console, and have my google account listed in “Gmail accounts with testing access.”

When I try to buy a product in my Android app, the Google Play Store comes up, I hit “Accept & Buy,” and the purchase looks like it completes successfully – I even get the toast from Google Play that says “Thank you. Your item will appear shortly.”  And, on top of that, I receive an email that shows my successful Google Play Order Receipt.

However, my transactionCallback() handler is getting a transaction.state as “failed” and the transaction.errorType is “invalidClient.”

Same error when I use the product Id android.test.purchased, which is Google’s test product id.

What’s really odd is when I tested this about a week ago and it worked and I was not getting “invalidClient.”  I haven’t changed my code at all regarding this since then. I think all I’ve done is uploaded a new apk since then, and I made sure that the version on my handset is the same as the new apk.  Also, I’ve tested this with multiple google accounts on multiple devices.

Anyone have any ideas what’s going on, or know what “invalidClient” means?

Hi,

An invalid client could mean: 

  1. the package names are different between the one on google’s servers and the one on your device

  2. the keystore used to sign the apks between google’s servers and the one on your device are different

  3. the apk hasn’t been registered on google’s servers(usually a few hours)

  4. the account thats signed on on the device isn’t a testing account

There could be other reasons but those are the most likely ones.

Ding ding ding!

It was #3. After a couple hours, it started to work again.  Thanks for the quick response!

Hi,

An invalid client could mean: 

  1. the package names are different between the one on google’s servers and the one on your device

  2. the keystore used to sign the apks between google’s servers and the one on your device are different

  3. the apk hasn’t been registered on google’s servers(usually a few hours)

  4. the account thats signed on on the device isn’t a testing account

There could be other reasons but those are the most likely ones.

Ding ding ding!

It was #3. After a couple hours, it started to work again.  Thanks for the quick response!

I am currently having the same issue with Google, but I still need to wait for a few hours, just uploaded the APK.

A general question: does this mean I always have to wait several hours for every test attempt? Or do I put one APK in draft mode with the correct version information but then test some builds on the device?

Thanks in advance!

Hmm, I’m now getting invalidClient even for the test purchase android.test.purchased, is this expected? According to the development documentation, for the test purchases one doesn’t even need to have a draft application.

It used to work (and still works) with the published application, but I cannot get the development version to work with in-app at the moment.

Has anybody got any hints?

From my experience this is what you need to do to test it. All the steps may or may not need to be done but this is how I got mine working.

  1. Sign your app and upload it to google play

  2. Fill out all the fields (you can has garbage data for the time being) and save it

  3. Create your in app purchases and make sure they say active and not (waiting to be active or soemthing like that)

  4. Wait a good 4-6 hours (may be quicker for some people but took about 6 hours for me)

  5. Go into your google play developer console settings and make sure your test email address is entered into the “Gmail accounts with testing access” field. This email must be different then your developer gmail acount

  6. Using an android device where the main email on the device isn’t the one that’s tied to your android developer account open your app and try and make a purchase.

I am currently having the same issue with Google, but I still need to wait for a few hours, just uploaded the APK.

A general question: does this mean I always have to wait several hours for every test attempt? Or do I put one APK in draft mode with the correct version information but then test some builds on the device?

Thanks in advance!

Hmm, I’m now getting invalidClient even for the test purchase android.test.purchased, is this expected? According to the development documentation, for the test purchases one doesn’t even need to have a draft application.

It used to work (and still works) with the published application, but I cannot get the development version to work with in-app at the moment.

Has anybody got any hints?

From my experience this is what you need to do to test it. All the steps may or may not need to be done but this is how I got mine working.

  1. Sign your app and upload it to google play

  2. Fill out all the fields (you can has garbage data for the time being) and save it

  3. Create your in app purchases and make sure they say active and not (waiting to be active or soemthing like that)

  4. Wait a good 4-6 hours (may be quicker for some people but took about 6 hours for me)

  5. Go into your google play developer console settings and make sure your test email address is entered into the “Gmail accounts with testing access” field. This email must be different then your developer gmail acount

  6. Using an android device where the main email on the device isn’t the one that’s tied to your android developer account open your app and try and make a purchase.

Thanks dmglakewood, your #5 helped solve it for me.  The Google documentation made it sound like I could use my developer gmail account to test IAP, but that always fails for me.  Testing using another gmail account (and giving it testing account access) was successful.

Thanks dmglakewood, your #5 helped solve it for me.  The Google documentation made it sound like I could use my developer gmail account to test IAP, but that always fails for me.  Testing using another gmail account (and giving it testing account access) was successful.