How to test Google Play in app purchase? - android

From what I understand reading This link. It appears to me that the only way to test in app purchase is to write the complete code for in app purchase. And then do a proper build. Upload it to beta release. And then download the app via the opt in link.
But how do I develop it in the first place? Am I expected to write some lines of code and then do a build and upload it? That is a huge turn around time. Is there no way for me to have some test account that I can sign in go google play (on phone) with and then just make purchases?
Currently, my code already handles the products
android.test.purchased and android.test.canceled. How do I make it so that I can test my own products Ids? Currently it just says the product you are requesting is not available.

Google allowed to test your in app purchase in for dummy products like you mentioned android.test.purchased. To test real products you must have to deploy application in beta release at least. Following article will help you in detail :
An Android Studio Google Play In-app Billing Tutorial
Hope it will help.

You need to publish your application in beta version in play store to review the application. Without reviewing your application, you cannot test app purchases. After the review you can test your application without redeploying it to play store.

Related

Android - Testing in-app subscriptions?

I'm currently trying to test in-app subscriptions using the In-app Billing Version 3 API. I have downloaded the TrivialDrive test project and successfully tested in-app purchases using static responses (android.test.purchased etc). The problem I'm facing is that static responses are only supported for testing in-app purchasing NOT in-app subscriptions. The only viable way I have found so far to test in-app subscriptions is to publish the app as beta on the developer console, assign a tester email and then download the beta apk via the opt in URL. This is a slow process as it takes a while for every iteration of the product to be published. Is there any way where in-app subscriptions can be tested in a more 'classical' way? i.e. insert breakpoints in Android Studio and see what is actually happening? Am I missing something? Thanks in advance!
about testing you don't have to upload an apk everytime to the playstore and download it, you have to do it once
then you can configure you app to signed everytime you run it on you device doing that you can see the log messages by the tag you specified
hope that helps :)

How do I add in-app purchase to a published app in play store and test it before going into production?

Before asking this question, I have read the developer notes on android developers site and also watched the Google IO video. I have also seen the question posted on SO. Since the question has been asked long ago and its answers are also pretty aged, it doesn't answer my doubts reason being Google has changed quite a few things related to In App Billing and its testing.
I am planning to add in app purchase to my app which I published long ago in play store. I wrote the code of in app billing V3 ytaking help from TrivialDrive example. I have few doubts on how do I proceed further for testing:
[Question]
I have read that I should upload the new apk which includes in app billing code and permission to play store's in-app products. Won't that make the upgrade available to all the users using previous version of app? Once I upload the new apk with in app billing feature, it would replace the older apk in production, right? If yes, how do I make sure the upgrade goes to production only when I am done with testing?
When I click on button for in-app purchase, it displays an alert dialog with following error:
Authentication is required. You need to sign in to your Google Account.
You can upload it to the Alpha or Beta channels first. Add yourself as a test user so you'll be able to make test purchases.
When the version on the Beta channel will be ready, you can make it the production version.
If you choose to upload it to the production, you can choose not to publish it, but save it as draft, and you'll be able to test it.
Authentication is required. You need to sign in to your Google Account error comes when you have not downloaded the app from playstore(i.e. you are testing via IDE).
You can test in app purchases via alpha beta channels from your dev console as told by Udi I.
Additional points:-
Keep in mind that for every real/succesful transaction/purchase Google takes 30% of the fee.
You can re-imburse/cancel the transaction to the user in the first 15 minutes.
User can restore the purchases within 15 Minutes, or the in app purchase amount credited to you will get deducted if the user immediately un-installs the app after doing the transaction.

Do I need to publish application to test in app purchases?

I was working on in app billing last time about 1 yesr ago. In that time to test in app billing I was need to setup tester account, upload application in draft mode and publish purchases.
Since then Google added "sandbox" mode (which allows to test purchases without money transactions) and I want to use it. I've read documentation but for me it's parts contradict each other.
Here it says that I only need to upload the app (nothing about publishing), add purchases and test accounts. Which is similar to the old mode. But it also says that alpha-testers WILL pay money for purchases.
Here it says that "draft" mode is unsupported so I need to publish my app to Alpha testing. Nothing about setting up alpha-testers list.
So my question is if I need to publish my app to alpha-testing mode to test purchases without money transactions?
P.S. Can I still use IABHelper from demo application? Examples in the documentation doesn't use it anymore.
UPDATE Docs says that purchases may be published before the app. But developer console says that purchases will be activated only after application is published.
You need to publish to alpha or beta (which won't be visible to the public). You do not need to publish to production
What I do is publish to beta with an .apk and install that same .apk on testing devices via side loading (no downloading and installing from the playstore when in beta)
You don't need to publish your app... you can keep it unpublished but you've to upload apk there..

How can I test in-app-billing with a non-published app?

I have an Android app that uses In-App-Billing to sell Account Managed Items.
I tested the app with the static response IDs and everything seems to work. I now want to test the app with real product Ids.
I created the app in the Google Play Store and uploaded a draft version of the app with the correct permissions. I now created an In-App-Billing item and published the item.
At the moment the app is unpublished. The item is created and published and I have a test account that is registered in the profile of the developer account and is the only account on the device that I use for testing. The app is signed with the same key as the uploaded draft. Edit:I'm testing with Android 4.1 && 4.03 at the moment
If I try to buy the item the Google Play Store pops up but shows a dialog with the following method: The item you requested is not available for purchase.
How can I test buying the item without publishing the app?
When you test the app, make sure you have exported and correctly signed it (not using debug key). Also make sure that you are using the correct Google account (registered test account) on the device.
Additionally, the registered test account cannot be the developer account.
Apart from this, it should work fine.
Note: Testing your own in-app purchases does require a valid credit card and actual payment.
And finally, it currently takes a few hours for market edits to propagate through the servers and show up.
It may take some time to reflect the changes on google play if you just uploaded the app and added the item there wait for some time near about 2 hr. it will be shown the item you want to purchase.
For others who reach this thread, Now it's not possible to test In-app billing with just a draft version of the app.
Draft Apps are No Longer Supported
Previously, you could publish a "draft" version of your app for testing. This functionality is no longer supported. Instead, there are two ways you can test how a pre-release app functions on the Google Play store:
You can publish an app to the alpha or beta distribution channels. This makes the app available on the Google Play store, but only to the testers you put on a "whitelist".
In a few cases, you can test Google Play functionality with an unpublished app. For example, you can test an unpublished app's in-app billing support by using static responses, special reserved product IDs that always return a specific result (like "purchased" or "refunded").
for details read https://developer.android.com/google/play/billing/billing_testing.html#billing-testing-test
You can test in-app billing by using options, look at this
Edit :
On the link I mentionned, you can see this :
Note: You do not need to publish your application to do end-to-end
testing. You only need to upload your application as a draft
application to perform end-to-end testing.
If you still can not test it, what you can do is to publish it and test it. If you think there might be bugs in your app's in-app billing, refunds are still a solution.
I'm thinking about something, on the dev site, you can see this :
Verify that your device is running a supported version of the Google
Play application or the MyApps application.
On what Android version are you testing on ?
You've to add the products(item sku) in you app product in your play store app account. The SKU you set In-App billine is not available. For testing, set the SKU androidtestpayment. Now you'll now get that error The item you requested is not available for purchase.

Android billing testing - how do I test with the test user?

I set up test users so that I can test that in-app billing works, but I am a bit confused by the process.
I am following the android developer billing test guide here: http://developer.android.com/guide/google/play/billing/billing_testing.html
It has a few confusing points. It says not to publish your app, but somehow I need to get the app on my phone. So how can I get an un-published app on my phone?
Also, am I supposed to make an area on the app with the 4 product ids that google reserves and try to buy those, and then once I see it works, just get rid of those buttons to buy those test products? Is that how this is meant to be done?
Thanks!!
It says not to publish your app, but somehow I need to get the app on
my phone. So how can I get an un-published app on my phone?
There's no need to publish your app to get it installed. Create a signed build (See http://developer.android.com/tools/publishing/app-signing.html). Then install it on your phone using adb install <apk name> The SAME build you must upload to your playstore dashboard. After uploading, you will see 2 options:
PUBLISH
SAVE
Click on 'SAVE'. After saving your uploaded app, you will be able to add InApp products for that app. You MUST save and publish your inapp products in order to test them.
You should upload the apk to your developer account and fill in the mandatory fields and save it without publishing it and then you can create in-app products for the application and publish it. please note that the in-app products must be published before testing billing. But you don't require to publish the application to test billing.
Try the MoVend library for Android. it supports google play in-app billing, paypal and many more.
http://www.movend.com/
How to sign an android apk file
To install it you can use adb or you can send this file by mail. Then download in the device and install it.
Check that Settings > Applications > Unknown sources is checked in the Device.
If you are having problems implementing in-app purchase I recommend you the library AndroidBillingLibrary.

Categories

Resources