Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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:

  1. Create a new in-app subscription product in the google play developer console.
  2. Point the android app at the new subscription product you just created.
  3. In your code to check for active subscriptions, add a line to specifically ignore the order number of the previous subscription that you tested.
  4. Export a release build of the app and transfer it directly to your testing device.
  5. After testing, return to step #1 to test the next time.
  6. 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:

  1. Open your app page in Google Play Store application
  2. Click "Manage subscriptions"
  3. Click "Cancel subscription"
  4. Go to "Settings", "Apps" in your phone.
  5. 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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top