What are the conditions to properly test real purchases, when i already have tested my app using test product like android.test.purchased
?
Test in-app billing and subscriptions Once you've set up application licensing, authorized users can also purchase in-app products and subscriptions without charging the users' accounts. When making a purchase from a license test user, you will see two choices for payment method: “Test card, always approves”
Yes, You can test. Login into Google play with google account. Now purchase the in-app products. The purchase made in an emulator device will be a Sandbox Purchase or it will be a real purchase .
There are few steps that you need to pass, remembering, that some of them need some time to update on Google Play servers.
For this example, let's use com.example.product
as our real product Id. Any time it shows up in this example change it to your own.
You CAN'T test REAL PURCHASES in DEBUG mode. You need to download an app from Beta, so Google know it's ok to make purchases in the app.
Check if you have BILLING permission in AndroidManifest.xml
:
<uses-permission android:name="com.android.vending.BILLING" />
Change android.test.purchased
to com.example.product
,
Export *.apk file. It MUST BE SIGNED!
Publish APK in Beta,
You can now go to the next steps, but you'd need some time for your Beta to be ready for download.
You CAN'T add new product until you have published a beta.
You CAN'T test subscriptions, only products.Now you CAN also test subscriptions (they are renewed every 24h)
Add new product
button and define new product with com.example.product
Id,You CAN'T test purchases being signed-in on your device with a developer account. You CAN'T make purchases from yourself.
Google Play Developer Console > APP > BETA
Google Play Developer Console > SETTINGS > LICENSE TESTING
- this will make testing purchases enabled for their accounts.As a tester, you WON'T be charged
When testing from downloaded app Beta, you'll see a testing information on first IAP dialog.
You'll see both your product's name and price set in dev console.
You'll be testing with your real payment options. Don't be scared of seeing your credit card. As i mentioned before - you won't be charged.
When you successfully make a test purchase, you'll get a confirmation e-mail, which looks like a real purchase confirmation.
To repeat the same purchases, you'll need to consume products, cancel purchases, or simply wait 2 weeks until testing purchases will expire.
To cancel purchases:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With