Testing in-app billing: “The publisher cannot purchase this item”
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!
12 Solutions collect form web for “Testing in-app billing: “The publisher cannot purchase this item””
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.
Here’s an attempt to put all the requirements into one answer. This is the simplest process that worked for me:
- Set up a new Gmail account, or use an existing Gmail account that is not your developer account.
- List the email address of the test account in the Google Play Developer Console in Settings > Account Details > License Testing.
- 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.
- Build a signed, release variant of your app.
- Upload the app as an alpha in the Play Store, publish it, and wait several hours for it to become active.
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). 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.
- 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.
- 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.
- 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.
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.
For all those who are still stuck with this annoying feature, there’s a solution with the newest version of android (5+ Lollipop).
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.
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
I solved this by uninstalling the app, going to Play Store and switching to my non-developer account and downloading and installing the app.
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.
I had fixed this issue by:
1. Using Signed apk
2. I had not activated in-app products, means they were in Inactive mode
I solved this error by
- used the signed apk for testing
- sku name same as inapp product name
- in app product is active status
- app must published status show
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!!
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 🙁