Configuring your Android app to enable sandbox testing can be sometimes a daunting task.
But no worry, we listed below all the steps required to make it work!
Google Play Console
You must have an active account on the Google Play Console.
If you're already enrolled make sure your subscription isn't expired (it must be renewed every year).
Add testing account
You'll need to add the Android primary account of the phone you're using for testing, it is the email you used when you logged in for the first time on your Android device (note the only way to change a primary account is to do a factory reset).
In order to do that go to your Google Play console.
Go to Setup > License testing and add your email in the text input.
Publish app in Testing track
You'll need to publish at least one signed version of your app in a testing track.
In the example below we're publishing the app in a Closed Testing track but it can also be published in the Internal Testing track.
In order to do that go to the Google Play console in Release > Testing > Closed testing (or Internal testing).
Create list of testers
After creating the closed track you'll have the possibility to create a list of testers.
Create an email list by clicking on the link.
A modal should appear, add the email account of the phone you're using for testing and press ENTER.
Join the testing
In order to join the testing you must open the opt-in url from the device you're using for testing (you can send the link to your device by email for example). After opening the link on the device, click on the button Become a tester.
Upload signed APK to the closed track
Generate a signed APK or use Android App Bundle to upload your app to the closed track you've created previously.
Rolling out the release isn't even necessary, just upload your app. After your release is approved and available to the selected users, the sandbox testing should work.
Build and run your app on the device you're using for testing, there is no need to use the signed APK you've uploaded.
If configured properly, you should be able to load and purchase your products.
When starting a purchase you should see: This is a test order, you will not be charged.
For more informations, please go to the official Google Play documentation: Test Google Play Billing