Android in-app billing testing - android

I created product id list for my application in android developer account. Also i created test account to test my in-app purchase implementation. My concern is do i get charged on entering card details from test account for buying the product, to test in-app billing implementation. What is the best way to test in-app billing?

The best way to test an in- App is to
mBillingService.requestPurchase("android.test.purchased", "");
This way you neither have to upload your app nor you have to create in app products on marketplace.

Agree with the one mentioned by ingsaurabh, however in case you want to do a real testing of in-app billing I would recommend going through the entire grind.
Things to test:
a. Purchase
b. Cancel
c. Refund
d. Restore transactions
For all these you would need a real purchase, which would get charged to your account. However later on you can go ahead and cancel it from your developer console and it would get refunded.

The only way to do end to end testing is to do a real purchase. You have to set up a test account on the developer site first. You don;t have to worry about the charges. You can always refund it.

Related

How to check if an Android in-app purchase is a test or regular purchase?

Is there a way to programmatically check if a purchase is a test purchase or a regular one?
When you attempt a test purchase, Google notifies you that this is a test purchase and that you will not be charged for it. Is there a way to get that information in code?
I tried it too much, unfortunately there is no way to get this information from Google on an Android application for now. If you are doing regular purchase with a tester account, all responses you got from Google apis are same with a non tester account. So it is impossible to differentiate it.

Test Subscription Feature of In-app Billing

Is it possible to test subscription feature of In-app Billing? I tried using reserved product IDs for testing(android.test.purchased), But it gave error like 'item not found'.I am using In-app Billing Version 3.I could not find a conclusive answer from the web. Any help is appreciated.
As of February/March 2015, in-app subscriptions can also be tested on Android. Now, Google accounts with testing access (configured in the Settings Menu of the Developer Console) will receive the message
This is a test subscription. It will recur daily. You will not be charged when trying to buy in-app subscriptions.
This also means that all subscriptions seem to be "billed" daily. You will still receive a normal Google Play Order Receipt Email but it will be prefixed by the word Test:
Test: Your Google Play Order Receipt from Mar 12, 2015
Also, if you look inside this email, you will notice that the order number is a random string of letters, instead of a regular order number as described at http://developer.android.com/google/play/billing/billing_subscriptions.html#payment.
Order number: lhjelkffelbnmmcmklbkhkbd
Some points that may help.
If your published application does not have in-app, you dont need to publish your next inapp version to test it.
You need to upload the apk with in app feature to your developer console (dont hit publish), install the same app on your phone
Create in app products (unmanaged) and ensure that the code refers to these unmanaged product id's
Make the product cheap for testing purpose
Purchase your product from your application
From your merchant account refund yourself (you wont be charged if you refund before 24 hours, and you get a full refund. (i think, just confirm this, it keeps changing).
After you are happy, hit publish.
You can add email id's of friends as test accounts, to help them purchase the product and not get charged. Infact you can also mock them for "failure" :)
I hope this helps.
This is the answer from my personal experience.
There's not a proper way to test inapp with a dev sandbox.
This is how I really test inapp.
Create a test application to test inapp and configure it.
Remember to put your developer public key where needed and all manifest permission needed
Add some inapp purchase to test with
Make the app NOT debuggable
Upload it on android market as draft
Now you have to wait some hours because Android Market need to push all changes or you will get an error when you try to make purchases
Now launch the app locally on your device (you have to put debuggable false) and test your inapp purchase buying something.
After all tests I go into my google wallet merchant account and I also make all other purchase flow test for:
Refund
Cancel Inapp-Subscription
If you find a better way to test it with a real sandbox please tell me :)
Use android.test.purchased as a product ID.
Create a class to mock out the apis you are using from Google Play services.

How to test android app using test account with android in-app purchase

I have added my email id to the android in-app purchase testing account.
But When I am going to test the in-app purchase in to android device with this email id account, it is opening to ask to buy with the credit card details and purchase. So I am confused that how can I test the app in proper manner? Am I missing something to test?
Unfortunately to test in-app billing you actually have to buy your item. Aside from static responses using fake item IDs there's no way to test the purchase with "fake money".
The good news is you can go into your merchant account and immediately issue yourself a refund, so you'll never actually be charged.

Android: How to test in-app billing

I have an app in the market without in-app billing. Now the new version should have in-app billing. Of course I am not ready yet and cannot upload the new version to the market, but how can I test and debug my unfinished code?
as a first step you need to test it using test requests. This testing is limited but will give you idea if the flow works correct or not.
Second step - real testing. You have to upload your app to Play (NOT publish, just upload), create another account (you can't buy things from yourself) and enable this account in your dev. console. Then you can purchase (for real money) the app and test how well it goes. Of course you can cancel/refund this anytime using your main account.
As a person implementing this in a couple of my apps I can tell you it's a pain.
Refer here for more info:
In-App Billing reference
You can use the test product id's set up by Google to test your app. Check out this link
Firstly,You can use four reserved product IDs to test static in-app billing responses
Secondly,Using a test account and upload you app as a draft,then you can test it using your own product IDs

Android: Strategy to test In-App-Billing?

Can anyone tell me some best practices to test in app billing with real product using test account?
I have created a test gmail account and add it into my Developer Console. I actually can finish the in-app purchase. But i cancel the transactions in Google Checkout so that my credit card will not be charged. Now i want to test the purchase wit the same product again, than it doesn't work anymore because of the error "you already cancel order in app billing android". I search in Google and found out that i (the developer) can't change the pending status. So if i want to test the in-app-billing function again, i assume that i have to create a new productId.
Does anyone have better strategy to test the in-app-billing functionality?
You can use a "fake" account to test the purchasing in the real product. Please see this link for everything you should need: http://developer.android.com/guide/market/billing/billing_testing.html

Categories

Resources