To ensure that In-app Billing is functioning correctly in your app, you must test the app before you publish it on Google Play. Early testing also helps to ensure that the user flow for purchasing in-app items is not confusing or slow, and that users can see their newly purchased items in a timely way.
Test with static responses
Test your In-app Billing app with static responses by using Google Play's reserved product IDs. By using reserved product IDs instead of actual product IDs, you can test the purchase flow without specifying an actual payment method or transferring money. To learn more about reserved product IDs, see Testing In-app Billing.
Test with your own product IDs
Because Google Play doesn't allow you to use your developer account to directly purchase in-app products that you create yourself, you need to create test acccounts under your developer account profile. To create a test account, simply enter a valid Google email address. Users with these test accounts are able to make in-app-billing purchases from uploaded, unpublished apps that you manage. The signature of the unpublished apps doesn't need to match the published versions.
To test your In-app Billing app using your own product IDs:
In the Play Console, add one or more tester accounts to the developer account that you are using to publish your app by completing the following steps:
a. Login to the Play Console with your developer account.
b. Click Settings > Developer account > Account details, and then in the License Testing section, add the Google email addresses for your tester accounts.
Build a signed APK file for your In-app Billing app. To learn how to build and sign your APK, see Building Your Application for Release.
Make sure that you have uploaded the signed APK for your app to the Play Console, and associated one or more in-app products with your app. You don't need to publish the app on Google Play to test it.
Install the APK file to your physical test device by using either the
adbtool, or the Play button in Android Studio. To learn how to install the app, see Running on a Device. Make sure that your test device is running on Android 2.2 (API level 8) or higher and is installed with Google Play client Version 3.9.16 or higher.
Login to the test device by using a tester account. Test your In-app Billing app by purchasing a few items, and fix any issues that you encounter. To learn more about how you can perform large-scale testing of your In-app Billing app, see Test Purchases (In-app Billing Sandbox).