Playstore subscriptions - testing strategy - android

Scenario:
I am on the verge of completing my google playstore in-app billing implementation. I am using a monthly or yearly subscription in order to charge my consumers.
Problem: I can't seem to find a way to remove a subscription from active state, since cancellation simply stops the billing from occurring. This doesn't allow QA to thoroughly test the purchase procedure without creating an account for each test, or waiting until the subscription period ends.
Question: Have I missed or am wrong about something? If so, what is it? If not, what should be done to allow QA to do proper testing?

According to what I have understood from your question,
you can not test subscription from the test account. Google play doesn't provide subscription testing using dummy product. you have to test on the real product.
Now question arises how can I test subscription
you can check subscription by purchasing real product and check product status or purchase cancellation using the purchase status api from your server.
you can also get more information from the given link below for the step by step cancellation purchase status:
1) link1
2) link2
you can simply query every day and check your subscription is valid or not and also get it's expiration date.
I also have one other option with out pay for any charges on your real product, you can set trial period in the Google console and before trial period ends up cancel subscription from the Google play store Menu -> MyApp -> Subsciption and cancel product and check above procedure given in the links.
EDIT:
Important: In all cases, you must continue to offer the content that
your subscribers have purchased through their subscriptions, for as
long any users are able to access it. That is, you must not remove any
subscriber’s content while any user still has an active subscription
to it, even if that subscription will terminate at the end of the
current billing cycle. Removing content that a subscriber is entitled
to access will result in penalties. Please see the policies document
for more information.
more information check below links:
1)
http://developer.android.com/google/play/billing/billing_subscriptions.html#cancellation
2) https://support.google.com/googleplay/answer/2476088?hl=en
3)
https://support.google.com/googleplay/android-developer/answer/140504?hl=en
You can not done this with out waiting until the subscription process cycle completes after cancellation of subs product, the only way remaining which is Free trial version it's only the way to provide us to test for the product cancellation in which product cancel immediately after you cancel subscription trial period, it will not continue until even trial periods ends.
more information check below link:
http://developer.android.com/google/play/billing/billing_subscriptions.html#administering
And I think it is better way because in the trial period you should go
with the actual credit card payment process but you doesn't need to
pay anything for it. Google play record the transaction as $0.00 for
the subscription process. And if you cancel the subscription the you
should not pay anything for testing, but yes I am not sure free trial version
is worked before you publish the app but it is only get by efforts only.
Conclusion:
In the current api it is not possible to test subcription product like
normal products and if user has been cancel the subscription product
then you have to wait to purchase the same product until the
subscription cycle has been expired, there is no another way if the
subscription cycle is going on and you can test for the same product
again before subscription cycle ends. And if you still want to test
for the same product then you have to choose another account for
testing it or another way is Free trials, you will not be any charged
until your Free trials period expired or cancel subscription in that
period and for the testing account before publish the app you will be refunded
automatically after 14 days of purchased product according to my
knowledge.
Hope it will solve your problem.

I have a horribly clunky workaround for this problem. Here is what I do every time I want to do a test of in-app subscriptions:
Create a new in-app subscription product in the google play developer console.
Point the android app at the new subscription product you just created.
In your code to check for active subscriptions, add a line to specifically ignore the order number of the previous subscription that you tested.
Export a release build of the app and transfer it directly to your testing device.
After testing, return to step #1 to test the next time.
Don't forget to fix your change from step #2 before deploying the app!
You might want to create many subscriptions in step #1 so you don't have to continually wait hours for them to propagate. Please comment if you know of a better way!
UPDATE: Google now has test subscriptions and is making it easier to use them! https://android-developers.googleblog.com/2018/01/faster-renewals-for-test-subscriptions.html

It seems that nowadays there is better solution:
Open your app page in Google Play Store application
Click "Manage subscriptions"
Click "Cancel subscription"
Go to "Settings", "Apps" in your phone.
Find Google Play Store and clear application data.
You should now be able to re-buy subscription.

Create a mock class that mocks out the Google Play methods that you are using.

Related

Cancel in app auto renewal subscription android

I am using google in-app billing v-3 to implement auto renewal subscription process of google in my android application.
In my application user can go for different types of subscriptions, like Subs-1 for 30MB of space, Subs-2 for 90MB and so on. Now if, user chooses initially Subs-1 and then upgrades it to Subs-2, as a result now there are two simultaneous subscriptions on user's account.
I want to cancel first subscription, when second is purchased. Is there any method for the same in android code, or do I have to go for server-side implementation of the same here.
Google docs are really confusing, and I didn't find any solution there.
Yes you could use the cancel method, detailed here https://developers.google.com/android-publisher/api-ref/purchases/subscriptions/cancel#request
All you would need is the subscription_id and token which you got when user purchased the subscription

InApp Subscriptions or Google Wallet

I have gone through most of the links here on stackoverflow and i have some doubts regarding InApp Subscriptions and Google Wallet.
What i know:
InApp Subscriptions basically allows a user to be able to subscribe to an app, say for example if it offers one year trial period, then once thats over, Google automatically handles the subscriptions then after.
Google Wallet, its a method that can be used to perform the purchase. What i don't understand is, can i use this method in order to allow users to use the app for one year, and then make them pay for the next years?
Billing continues indefinitely at the interval and price specified for the subscription. At each subscription renewal, Google Play charges the user account automatically, then notifies the user of the charges afterward by email. For monthly and annual subscriptions, billing cycles will always match subscription cycles, based on the purchase date. (Seasonal subscriptions are charged annually, on the first day of the season.)
This is what happens in my app:
1. A user logs in, and i get a date that probably keeps track of the billing cycle
2. If the sessions expired, the user is asked to pay using the inApp Billing serivce
3. Based on TrivailDriveApp Example, where we have the success log printed on subscription, we update the date of payment.
Some questions i have:
As per the quote from android, if the user is automatically subscribed to the service, and if a mail is sent to the user, does that mean that i would never be able to get a notification about the payment extension? How do i sync that with the server then?
Is my approach wrong in handling this kind of scenario? Or do i have to select a different method of handling app extensions?
P.S: There is no way of testing inapp subscriptions also. I wonder if i could do that without using real credit/debit card credentials.
EDIT:
I would also want to keep track of when the purchase or billing was done, if subscriptions are auto-renewed, then should i take up the purchase flow as an InApp Product instead of an InApp Subscription?
Please help.

Android in-app purchase of a subscription with a free trial - how to avoid abuse?

I've searched high and low for guidance on how best to address this...
I've read Google Play In-App Subscriptions (http://developer.android.com/google/play/billing/billing_subscriptions.html) and the section on Implementing Subscriptions (http://developer.android.com/google/play/billing/billing_integrate.html#Subs) but I still don't see a way to avoid abuse.
I've also seen the related question here - Google Inapp purchasing and trial period. However, using the SharedPreferences is subject to relatively easy abuse.
I have an app that will require a subscription for full functionality. I set up a monthly subscription in-app purchase product, say ID = "myapp.subscription.monthly", costing $0.99/month.
I want to give people a chance to experience the full functionality, so I give "myapp.subscription.monthly" a 30-day trial period.
When the user installs the app for the first time, they are prompted to purchase the monthly subscription, they are charged $0.00 and told that starting 30 days from now their card will start getting charged $0.99/month.
When my app calls "getPurchases()", the fact that they have a subscription will be returned.
If they cancel during the free trial, or say after a couple of months of billing, a call to "getPurchases()" returns nothing, according to the "Implementing" section:
The call returns a Bundle with all the active subscriptions owned by the user. Once a subscription expires without renewal, it will no longer appear in the returned Bundle.
Since the user has no active subscriptions, my app will prompt them to purchase the subscription for full functionality. Again, they will get the 30-day free trial.
I've thought about having a second subscription product, say "myapp.subscription.monthly.no.free.trial" and I would have that be the available item for purchase. However, without a way to ask Google Play if the user ever previously purchased a subscription, my app can't know that is should be offering the "no free trial" product.
So, how to avoid someone just subscribing and cancelling over and over to keep getting the free 30 days? Is there a way to ask Google Play for the complete purchase history?
According to documentation (https://support.google.com/googleplay/answer/2476088?hl=en, Trial subscriptions), its says:
You can't sign up for multiple trials.
I guess Google automatically handle this
Google Play Store handles this automatically
If your user cancels the free trial and then tries to make a purchase, they will be shown the $0.99 rather than giving a Free trial again. But, if the user pays the $0.99 after canceling the free trial, the actual billing will only start after the canceled Free trial period has ended.
It would have been helpful if there was any way to know whether a product has a free trial or not on the client side. Hope that will be put into the In-App Billing APIs soon.
I am also using in app billing but google always provide one free trial per user.
If u subscribe same sku again then google will not provide trial period to that user.

testing subscriptions - can't cancel

I have my in-app subscription working using a second test account. Now when I check inventory using queryInventoryAsync the subscription shows up as expected.
So now I want to do some more testing. I want to cancel the subscription and then when I know that works, I want to test again.
However, when I go to Google Play -> My Apps on the same phone as I used to buy the subscription, it shows no subscriptions! So I can't cancel it. What is wrong?
Also, how can I test expiration of subscription and make Google think time has passed.
Thanks,
Gary
Turns out that Google does not support testing of subscriptions. You have to use real charges.
To cancel the subscription have to go to the Google Wallet web. It's the only way, you can't do it in-app.
To testing process. You can use a subscription with trial time, in this way you haven't to pay until this trial time finish and you can test at least the purchase flow.
Also you "only" have to wait a week to see the subscription expired, and without make a refund if you had cancelled before.

Android in-app billing testing

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.

Categories

Resources