I have in-app billing subscriptions available to users which I would like to test and ensure the logic works as expected. However, I am unable to do so.
Note:
There are a number of SO questions relating to In-App Billing not working, specifically for this error:
Error while retrieving information from server [DF-AA-20]
Such as can be found:
- here, and
- [here][2]
, and
- here, and
- here
Summarised, all solutions relate to some missing part of the requirements.
A prominent issue is the issue of the app being tested without being published to atleas the Alpha test track
(which I have done). This is detailed later in the post.
Documentation:
Implementation
The requirements for implementing In-App Billing into an Android app is as follows:
- Add the latest
BillingClient
in your module level gradle file:
The tutorial suggests:
`implementation 'com.android.billingclient:billing:1.2.1`
which cannot be found by Gradle (02 Feb 2019)
Mine works with:
`implementation group:'com.android.billingclient', name:'billing', version:'1.2'`
- Implement the
BillingClient
providing an interface to the Android (Google) Billing Service for making purchases.
This is defined in a detailed step-wise tutorial here
Testing:
The requirements for testing your In-App Billing
in an Android app is as follows:
For Solo tests
For
In-App purchases
solo tests, one can test these using the static test responses defined hereSubscriptions cannot be solo tested, they need have other conditions
Note: Static responses cannot be used to test subscriptions.
For Testing with Testers (see here for more)
- Create a Open/Closed track for testing and add the testers you wish to allow for testing. Upload the app to the relevant test track and you MUST publish. Uploading the app as a draft does not work anymore
Note: Previously you could test an app by uploading an unpublished "draft" version. This functionality is no longer supported. However, you can test your app with static responses even before you upload it to the Google Play Store. For more information, see Test with static responses.
See here for more details,
One-Time subscriptions are explained in further detail here
Subscription purchases work as expected, but the subscription times are heavily shortened to emulate the subscription times. Read in further detail here.
Note: To allow for testing, the app must be published, in atleast the test track. This makes the subscriptions available to that version of the app.
Note 2: It appears that various users have had issues testing on the same Google account as their developer account. Make sure to use a different tester account which is not the same as your developer account. See here for details
Note 3 I saw the documentation made mention of a public key use for licensing, but the in-app purchase tutorial did not require it during implementation. I am not sure if this is causing my issue
Problem:
Having followed all of these steps above, I am unable to successfully purchase a subscription.
- I download the test app to an emulator (with Google Play services active).
The test account also has a card payment method setup prior to downloading.
- I proceed to purchase the subscription, then the following is shown:
Am I missing something?