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

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.

Related

How to test IAB without being charged

I am trying to testIn App Purshase without being charged on Unity by reading this https://developer.android.com/google/play/billing/billing_testing.html
My application is published as an Alpha version, signed with a real key. I downloaded it with an other Google account that the one I used to publish the app. This account is both added in the testers list of Google Play Service and my app Alpha testers list.
The problem is, when I want to buy an item, I never see the word "test" as the documentation says.
Can someone explain to me which extra steps shall I do in order to be sure to test my In App Billing without being charged?
Thanks a lot.
A new version of Google Play Console was released the 17th April, and I think that the french version of the Google Play Console was not completely implemented.
Right now the section "Test de licence" is available.
Follow the Testing In-app Purchases:
Setting up test purchases
It’s easy to set up test purchases—any user account can be chosen to
be a test account, and any user of a test account can make test
purchases with any available payment method (even though there’s no
charge to the payment method).
First, upload and publish in-app products that you want testers to be
able to purchase. You can upload and publish in-app products in the
Developer Console. Note that you can upload and publish your in-app
items before you publish the APK itself.
Next, create license test accounts for authorized users. In the
Developer Console, go to Settings > Account details, then in the
License Testing section, add the addresses to Gmail accounts with
testing access field. For more information, see Setting Up for Test
Purchases.
Once you’ve added the users as license tester accounts and saved the
change, within 15 minutes those users can begin making test purchases
of your in-app products.

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.

In-app billing - article not found

I am planning to publish an application with in app billing functionalities. I haven't released the application itself on the playstore yet, but I've activated the in app products. Now when trying to access them via my phone, I get the typical in app purchase window, but saying:
The article You wanted to buy couldn't be found.
Do I have to first publish the application to get the in app billing working or is there some issue with my application?
Some time ago Google made some changes to the testing of In-App purchases. Now you need to publish your application first in order to test them. Luckily it's enough if you publish your application as an alpha-version.
Note: You can do end-to-end testing of your app by publishing it to an alpha distribution channel. This allows you to publish the app to the Google Play store, but limit its availability to just the testers you designate.
Read more in the docs (Testing In-App Billing).

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..

Android in app subscription testing

I want to test the in app subscription mechanism on android devices(In app billing V3. api).
How can I do this? I saw that testing with static responses is works only with the in app products. The beta/alpha testing supports the in app subscriptions?
Thank you.
You can test your app with in app purchase feature. you have to follow below steps for testing
Upload you final signed apk file to Google play.
Dont publish it
Add in app products
get in app products id and add to code
get base 64 key and add to product
sign apk and upload again
your app should be in draft mode
in you Google play account setting add your test account id
use the device which should have the primary account id similar to the one you have added on Google play test account.
Install signed apk you have uploaded to Google play to your device.
run application and test your features
Since there's no effective way to test subscription cancellation/renewal, I'm trusting Google's documentation that an expired subscription won't appear in purchased items (otherwise, whether cancelled but still valid, original or renewed, I don't care in my case).
To test the rest of my work flow I created a test consumable object so that I can re-buy/cancel it at will in the sandbox. This consumable simulates an active subscription. It's not full end-to-end testing, but given that Google's given us no better way to test subscriptions, it will at least give me a fair amount of confidence that my app behaves as expected, otherwise.
A few notes:
1) You can only test with a signed build. I added android:debuggable="true" to my AndroidManifest.xml (under
<application android:debuggable="true"...)
2) This way I can still connect and debug with breakpoints after installing via adb (you can attach to the process under the Devices view, normally visible in the DDMS perspective, look for the little green bug icon.)
So far, it's behaving as expected. I'm still in the process of testing but if I hit any snags I'll update.
In adittion to #Vaibhav-Agarwal if you only want test your app, you could have problems with the IDs (I have experienced with an app for a client).
In my case, to avoid this situation, I had to add a testing project with another special package (test.xxxx.xxxx.xxxx) and here add some in-app product with a trial of 7 days, then when I canceled a purchase I "only" had to wait 7 days to purchase again this subscription.
In this way also,you never had to make a refund, because the subscription with trial time, you haven't to pay until this trial time finish.
NOTE:
Draft Apps are No Longer Supported, you must use Alpha/Beta tester option
In spanish, you will read: "no se ha podido encontrar el elemento que intentabas comprar"
Google has been enhanced theirs In-app Billing testing options. I write this answer for those who coming through . Now, you can test In-app Billing in Sandbox as other platforms do. In order to do that you have to create license test accounts for authorized users.
In the Developer Console, go to Settings > Account details, then in the License Testing section, add the addresses to Gmail accounts with testing access field.
Notes :
Test subscription purchases recur daily, regardless of the product's subscription period.
Once you’ve added the users as license tester accounts and saved the change, within 15 minutes those users can begin making test purchases of your in-app products.
After you publish your app to an alpha or beta channel, your testers need to opt-in to your app’s alpha or beta test using the provided opt-in URL before they can make test purchases.
License test accounts must be on the user’s Android device. If the device has more than one account, the purchase will be made with the account that downloaded the app. If none of the accounts has downloaded the app, the purchase is made with the first account. Users can confirm the account that is making a purchase by expanding the purchase dialog.
For more visit the official documentation.
But you can test Google Play functionality with an unpublished app using static responses.

Categories

Resources