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

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

Related

Testing IN-APP PURCHASE With Another account on same device

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

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.

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.

Testing subscription in Android: item not found

I am trying to test the new subscriptions in Google Play but the service returns "Item not found".
I've used the identifier "android.test.purchased" to test.
With this identifier I can test perfectly the normal in-app product, but whith subscription it doesn't work.
In the Google Play Console I added a subscription, and it is published.
Do I have to use the real subscription identifier and pay for testing?
Thank you
Even I have been looking for this , and am guessing that you may have already solved your problem.But this might help others
Even I have been unable to find any documentation about test product-ids for subscription however Testing In-App billing suggests only use of 4 reserved static product ids. This makes me infer that there is no test-id for subscription.
Hope this helps
yes,you will have to use real subscription and pay (you can cancel later).
there's no test for subscription.
notice that you will have to send in your request
api version=2 and product type should be "subs".
Google Play has already implemented a sandbox to test subscriptions and issue purchases. You need to publish your app in beta and after a few hours of doing that the test users(added in Google Play dev console) can make test purchases(these are not charged) in your app. They can even make subscription test purchases. A test subscription automatically renews every day(until canceled from Google Play) irrespective of the subscription duration.
Although, please note that the test user(Google account) must have a valid credit card added to the Google Wallet account in order to make test purchases(which are not charged). While making the purchase, the purchase confirmation dialog clearly mentions that this is a test purchase and you will not be charged.

Categories

Resources