Android in-app billing error with android.test.purchased item

I'm trying to test my in app purchase flow with the fake item android.test.purchased, from android documentation. I'm not able to test this flow, just when I launch it, I get this error: "The item you requested is not available for purchase". I have the permission in my manifest and I don't understand why I get this error with the fake item android.test.purchased.

Upvotes: 8

Views: 6232

Answers (3)

Romulo
Romulo

Reputation: 1

I was with the same problem and fixed listing the "android.test.purchased" ID in the IAP activate list. I know Google says that you do not need to list the IAP ID with static responses but, in my case, after I listed the ID "android.test.purchase" and activated I get success in my tests

Upvotes: 0

Nick Titov
Nick Titov

Reputation: 598

Here is the list of requirements for the Google IAB testing.

Prerequisites:

  1. AndroidManifest must include "com.android.vending.BILLING" permission.
  2. APK is built in release mode.
  3. APK is signed with the release certificate(s).
  4. APK is uploaded to alpha/beta distribution channel (previously - as a draft) to the developer console at least once. (takes some time ~2h-24h).
  5. IAB products are published and their status set to active.
  6. Test account(s) is added in developer console.

Testing requirements:

  1. Test APK has the same versionCode as the one uploaded to developer console.
  2. Test APK is signed with the same certificate(s) as the one uploaded to dev.console.
  3. Test account (not developer) - is the main account on the device.
  4. Test account is opted-in as a tester and it's linked to a valid payment method.

Reference.

Upvotes: 3

Gopal
Gopal

Reputation: 1784

To test in-app products or make in-app purchases in your alpha or beta channel app, each tester needs to opt-in to your app’s alpha or beta test. On your test’s opt-in URL, your testers will get an explanation of what it means to be a tester and a link to opt-in.

The most current version of the Google Play application must be installed on the device.

Ref: https://stackoverflow.com/a/22469253/3758024

https://stackoverflow.com/a/11076056/3758024

https://developer.android.com/google/play/billing/billing_testing.html

Upvotes: 0

Related Questions