Testing IN-APP PURCHASE With Another account on same device - android

Good day.I have implemented the in-app purchase flow in my application,added everything necessary to the console but i am failing to test it.Issue is that the android i dont know why uses the non-testing account (developer account) as on the purchase dialog it says 'The publisher can not purcahse this item' but although i have added test account to the device,switched account in the google play but i keep getting this error.Can anyone please tell me what is wrong with it?

If you want to test in-app purchase, you need to account on https://play.google.com, publish your app in alpha version. In IN-APP PRODUCTS, you add products you want, add emails you want to test (only emails in the list can test). You follow this link:
https://developer.android.com/google/play/billing/billing_testing.html

Related

Android In-App billing subscriptions test not working

I'm trying to test In-App billing subscriptions. My personal account and my developer account are the same. I can't buy my own products with this account, so, I need to test with another account. Here are the steps I followed:
created a new account (lets call it account B)
added account B on Google Play on my phone
uploaded a signed apk for beta test
created a beta testers list and added account B
connected to account B on my phone in Firefox, went to the test link, opted-in, and installed the app (from Firefox, not from Play Store)
bought an item
been charged (and auto-refunded myself -_- ...)
So, seems like its not exactly working. After reading again the developer guide, I saw that when an account is set as a tester account, it is clearly stated in the in-app billing popup that you will not been charged:
However, Google Play marks test purchases with a notice across the center of the purchase dialog, for easy identification
There is nothing like this in my popups. Does anyone know where can be the mistake?
I saw on some questions on stackoverflow that it might not be possible to have a phone set up for testing if the testing account is not the primary account on Google Play app, is that true?
EDIT: I added a friend's account to the list and asked him to test. He has only one account on his phone. Like me, nothing indicates that he would not be charged (and so, I guess that, like me, he would).
EDIT: I see this in the guide:
Note: For test subscription purchases, leave the orderId field blank. You can use the purchaseToken field to identify test purchases.
What does they mean by "For test subscription purchases, leave the orderId field blank"? Do I need to do something here, or does they mean that in the response, the field is left blank?
However, Google Play marks test purchases with a notice across the
center of the purchase dialog, for easy identification
The purchase dialog should display a message as shown in the image below:
Note: For test subscription purchases, leave the orderId field blank.
You can use the purchaseToken field to identify test purchases.
It means orderId field for test purchases is blank in the response. This is because a real order wasn't placed and so no order id is created for the test purchase.
Update
For test purchase, 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.

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.

Remove In-App Billing record from google test account for Testing again

I have created google play test account for testing In-App billing, but the problem is that when i purchase the item and then uninstall app and then install it again on that device and test for In-App billing it gives response that the app is already purchased. So how can i remove the old record of purchasing from test account on Google Developer Console.
Any help will be appreciated.
Since your product is Managed Product by Google therefore your purchased item is already connected to your google account. The best way to get around is to use another gmail account or create a new gmail that you can use to test again.
Secondly, It's always better to test your purchase with static response i.e "android.test.purchased" in your product ID field. If everything goes fine here then try it on Alpha/Beta mode in developer console.

Android In-app billing version 2 subscription static response not working

In Android In-app billing version 2 subscription static response is not working, This static response like android.test.purchased is working for inapp products, but the same is not working for subscriptions
1) IS there any other of testing it( we would like to do a static response testing which save our time
2) Can any please share a working code of in-app billing subscription
Testing inapp subscription billing is horrible. You can test out of your SDK for the adroid.test.purchased to make sure you are parsing responses properly. To test the subscription, add a test product to the subscription products on the developer console and publish the product. You must publish the products for this to work. Get up google groups and add test email accounts to the group. Invite the testers. THEN upload your .apk to an ALPHA and publish it. you must publish it as an alpha for the test phones and logins to find it.
Go to the link provided under the ALPHA tab to set up testers and log in from the phone using one of the test emails. Buy the inapp product to make sure all your code works. You can cancel the test product purchases in the Google Wallet and re-use the products until the code is correct. THEN set up a test subscription product. You will only be able to test the subscription once per test email. There is no way to remove the test subscription. Be sure to change the product names in your apk before you upload. Also, change the version code in the AndroidManifest, and turn off debugging.
If you try to install the app twice on a device, you may need to clear the data from these apps under settings in the phone: chrome, play store, play services, or it will continue to think you have it installed and won't download it. You must access the test .apk from a browser, NOT through the play store.
This is the most onerous testing I have ever experienced. Also, watch for errors from Google IABilling response, since the "already owned" response for a product is different for a subscription. I am still trying to figure out what the response is for the already owned subscription. Will update if I find out. This explanation is the ONLY information available anywhere that I have found, and this was weeks of trial and error. If you have more data on this, please share!!!

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.

Categories

Resources