65

My app seems ready to get a 'real life' test for an in-app purchase procedure on my device. However, I receive an "The publisher cannot purchase this item" error message in Play Store. Now, how am I supposed to test this? I don't want to lose my phone's configuration by reinstalling it with a dummy account just for testing. In the Developer Console under "Settings"-"License testing", I have added my email address under "GMail accounts with testing access", but this doesn't change anything... maybe I missed some simple way, but right now it feels very confusing!

richey
  • 3,890
  • 9
  • 35
  • 49

13 Answers13

43

A developer cannot purchase anything from herself. To fully test, you will need to create a test account in the Developer Console and then install your app on a device where that is the primary account. There is no other way. See http://developer.android.com/google/play/billing/billing_testing.html

don smolen
  • 459
  • 3
  • 3
  • As @richy said, adding a test account didn't work for me as well. I tried purchasing a subscription. – AlikElzin-kilaka Dec 17 '13 at 15:27
  • 5
    My problem was that I had connected several gmail-accounts with my device and among them was the developer account. Once i removed it, it worked for me. – Whyser Feb 28 '14 at 16:41
  • 6
    What if I want to have the app installed as a regular user too, and wish to see that the purchasing works fine? Why shouldn't I be able to do so? – android developer Mar 16 '14 at 07:26
  • 1
    @AlikElzin-kilaka, the documentation says you can't use test accounts to buy subscriptions: http://developer.android.com/google/play/billing/billing_testing.html#testing-purchases – arlomedia Sep 22 '14 at 21:48
  • You must also REMOVE your dev account from the device, simply signing into the test account alone wasn't enough for me. – Rory Harvey Jan 21 '15 at 19:41
  • 1
    If you are looking to test in app features as the publisher, you can now issue promo codes and redeem them as the developer. – sauce Jan 26 '16 at 14:11
  • You DON'T create any test accounts in Developer Console, what are you talking about? What you do is adding email to test licensing list, that's all. What can you create there? – user25 May 08 '18 at 19:45
21

Here's an attempt to put all the requirements into one answer. This is the simplest process that worked for me:

  1. Set up a new Gmail account, or use an existing Gmail account that is not your developer account.
  2. List the email address of the test account in the Google Play Developer Console in Settings > Account Details > License Testing.
  3. On your device, go to Settings > Accounts, select your developer account, tap the three-dots menu, then select Remove to remove the account from the device. You can add it again later.
  4. Build a signed, release variant of your app.
  5. Upload the app as an alpha in the Play Store, publish it, and wait several hours for it to become active. Or setup an internal test channel to get the update faster.
  6. If your device already has a debug version of the app installed, you will have to delete that. Or use this technique to run the debug and release versions in parallel (but you will still need to delete the debug version the first time).
  7. Download the release version onto your device. Apparently you can do this from the Play Store by navigating directly to the app URL, but whenever I tried this I received an "item not found" message. I uploaded the app to my own server and then downloaded it to the device from there.
  8. Download the release version onto your device. Or use this technique to sign the release build in Android Studio from your keystore, then deploy the app onto your device from Android Studio.
  9. Run the release version on your device. If the alpha in the Play Store is not yet active, you'll see an error that the app version isn't configured for in-app billing. If the alpha is ready, you will be able to proceed through the test process.
  10. When you get to the payment screen, you will have to enter real payment information, even though you will not be charged for your purchases. I opted to use an existing PayPal account rather than add my credit card info to my Google test account.
Abhishek Jain
  • 3,562
  • 2
  • 26
  • 44
arlomedia
  • 8,534
  • 5
  • 60
  • 108
  • Clicking "Publish" on an alpha app doesn't really publish it publicly in the store, right? If so, then what does it mean? – natario Oct 25 '15 at 22:25
  • No, this doesn't publish the app publicly. I don't know what other purpose an alpha app has; there must be a way to send it to testers, but I didn't explore that. I don't remember everything I tried, but in this context I think publishing the alpha is needed to activate the IAP items. – arlomedia Oct 26 '15 at 19:44
  • 1
    Thanks for your concise answer! Really helps summing up this whole kind of messed up process. As an addition though I would add that once you added a Gmail account in the Tester group, go to https://play.google.com/apps/testing/{your.package.name} to accept the invitation and install the application from the Play Store that will be visible to this tester. – Stephen Vinouze Apr 11 '17 at 13:44
  • You can add a second user to do the testing if you don't want to remove your primary google account. – Mygod Jul 13 '18 at 09:41
14

Meanwhile, I have helped myself by changing the SKU ID to "android.test.purchased" (see http://developer.android.com/google/play/billing/billing_testing.html ) that allows to "kind of" walk through the purchase process and play a bit around with it.

However, this is not a smooth solution in my opinion and only partially satisfying as the developer doesn't see what a 'real' user sees and experiences, but rather receives some result codes from a black box with a fake name (it is even titled that way) and can't make it beyond the Google Play interface.

richey
  • 3,890
  • 9
  • 35
  • 49
  • How do you reset the purchase of this special SKU ID ? Also, it seems I always get an error for the onQueryInventoryFinished method of QueryInventoryFinishedListener interface. How come? – android developer Jan 04 '14 at 16:35
6

For all those who are still stuck with this annoying feature, there's a solution with the newest version of android (5+ Lollipop).

Simple solution 1. Go to settings, then scroll down to "Users" 2. Add a new test user. 3. Open the app with this user

You can now test you're in app purchases with a test user.

Oliver Dixon
  • 7,012
  • 5
  • 61
  • 95
  • Worked for me on Android 7.0! Makes it easy to switch between the test user and your normal user for those of us who use our personal everyday devices for testing. – Magnus Apr 30 '18 at 07:39
4

I solved this by uninstalling the app, going to Play Store and switching to my non-developer account and downloading and installing the app.

Mark Pazon
  • 6,167
  • 2
  • 34
  • 50
4

You are trying to purchase that item using the same account that you used to upload the app to the store.

If you upload an app on the android store using abc@gmail.com and you try to make a purchase on that app using abc@gmail.com you will get that error.

Try making the puchase using another Google play-store account, on someone else's phone for example.

Bottom line: You can't purchase it yourself.

Abel Dantas
  • 380
  • 2
  • 17
3

Summarizing my own pitfalls:

  • upload your app in alpha or beta channel
  • publish your app(publishing in beta or alpha channels didn't make your app visible to anyone except those in testers list)
  • add your account to the "testers" list
  • go to "testers" link (something like "https://play.google.com/apps/testing/< package_name>") and click "participate" (That's one that I missed)
  • publish your inapp items
  • build release(!) version of the app and upload it onto device.
  • make sure that device version and market version are signed by the same release key

  • make sure that market version number is not smaller than one defined in the build gradle

Aleksey_M
  • 402
  • 3
  • 12
0

I was facing same error, now solved there were two main reasons of my failure:
1. I had not activated in-app products, means they were in Inactive mode
2. If you want to test, you must add Beta testers.

0

I had fixed this issue by:
1. Using Signed apk
2. I had not activated in-app products, means they were in Inactive mode

Mursaleen
  • 59
  • 1
  • 5
  • How come do you make in-app purchase, when you make your products inactive? – Halil Jul 20 '14 at 04:45
  • When I deactivated a previously active in-app product, the error message changed from "the publisher cannot purchase this item" to "this item is not available for purchase." At least the active/inactive change occurred immediately so I didn't have to waste time waiting to test it. – arlomedia Sep 22 '14 at 21:23
0

I solved this error by

  1. used the signed apk for testing
  2. sku name same as inapp product name
  3. in app product is active status
  4. app must published status show
Isaac G Sivaa
  • 1,289
  • 4
  • 15
  • 32
Happy
  • 1
  • 4
0

I faced same issue when installed manually the APK from eclipse to my phone then manually opening it. The correct procedure is to send it to Google play for alpha testing then wait several hours to be published to your alpha or beta testers which you ofcourse you must manage , must create, must give them access to your app. The developer shall receive an email with a link to provide to his testers after several hours. Once that happens just forward it to your community . In your mobile create an extra google account (that belongs to the community) and with that open gmail and press the link. It shall guide you to google play where you will automatically download the app as tester. Install , buy gass .. tada!!

George Papatheodorou
  • 1,539
  • 19
  • 23
0

Best way in my opinion is to fully test the paid/free version features without the Google Play inapp code. Only at the very end, add the inapp code to switch between free or pro. Upload the APK to the alpha release and get a device which has never seen your developer account nor the app itself. Install and buy it with redeemable codes. If the codes work then the actual payment should (the payment method is not part of your codebase, it's on Google side)

Gianluca Ghettini
  • 11,129
  • 19
  • 93
  • 159
-1

I think the reason you got this result is because you ran the app in development environment.

To test in-app billing, you'll need to sign the app. See more info here and here.

This is indeed a nuisance and prolongs the dev cycle :(

Community
  • 1
  • 1
AlikElzin-kilaka
  • 34,335
  • 35
  • 194
  • 277
  • 3
    i didn't downvote but it deserves one. "The publisher cannot buy this item" indicates that the publisher has already signed the apk. – Halil Jul 20 '14 at 04:49
  • One does need to sign the app in --release mode to test in-app billing, but the error message indicates that it was already signed, so that's not the problem. Perhaps you should delete your answer, or rewrite it? – Agamemnus Jan 03 '15 at 19:11