I'm testing in-app billing with my own cellphone
I've sucessfully added some acounts to alha track and they can now buy the goods in the test mode.
The thing is due a bug existent in the first alpha version the purchased good wasn't being consumed and now everytime i try to purchage i get
ITEM_ALREADY_OWNED
int ITEM_ALREADY_OWNED
Failure to purchase since item is already owned
reading googles guide about testing in-app billing it says:
Cancel completed test purchases Google Play accumulates completed test
purchases for each user, but does not pass them to financial
processing.
In some cases, you may want to manually cancel a trial purchase to
continue testing. To do so, open the app page in the Play Store. If
the test purchase you want to cancel is a subscription, you can also
use the cancel () method of the Purchases.subscriptions API.
I do not find an option to cancel the test purchases at googles play page of my app, nor in the console neither in the tester account...
how can i cancel it to keep testing?
The problem here is that you need to consume the item, instead of cancelling. The item was purchased, and while not consumed you won't be able to buy it again. Please check this answer on how to consume the item. Hope it helps.
Related
I use kotlin example from google in my app (com.android.billingclient:billing:2.0.3).
Since I call playStoreBillingClient.acknowledgePurchase(params) and try to cancel purchase with cosumeAsync(token) (which ok with 1.2 version) I get next error:
/** Failure to consume since item is not owned */
int ITEM_NOT_OWNED = 8;
From google docs https://developer.android.com/google/play/billing/billing_testing
"Cancel a completed test purchase
Google Play accumulates completed test purchases for each user but does not pass them on to financial processing.
Test purchases are not automatically canceled, so you might want to manually cancel a test purchase to continue testing. To do so, open the app page in the Play Store."
But what I should do on app page?
Also I tried to refund from google play console
This worked for me, refund the purchase in the play console, then clear Google play store cache and data.[This is if you have acknowledge the purchase].
To save stress, you can do it this way, when the purchase is made, do not acknowledge the purchase, the purchase will be refunded automatically after 5 minutes, then you will be able to test the purchase again. If you are done testing, you can now acknowledge the purchase.
I initially had test accounts for testing in -app purchases in android but I since removed the testing accounts and moved the app from beta to production. Both test accounts have attempted to cancel their test subscriptions through the Google play app according to documentation. Although the Google play app says the subscription had canceled, it still remains active. Even with trying to uninstall the app. How can I remove the test subscriptions?
I have removed the beta test apk from the Play Store and disabled testing. I have removed all testing accounts from the licensing page as well as the authorized beta testers list. Beta test users are still reporting having an active (daily) test subscription. No matter how many times they hit cancel, it still renews the next day. I need to get this removed. It is hindering our development process.
Assuming you're testing with real transactions where you got a token when you subscribed, you can try cancelling subscription using Google Play Developer API > Cancel Subscription
Purchases.subscriptions: cancel
Cancels a user's subscription purchase. The subscription remains valid until its expiration time.
HTTP request
POST
https://www.googleapis.com/androidpublisher/v2/applications/packageName/purchases/subscriptions/subscriptionId/tokens/token:cancel
where
packageName string The package name of the application for which this
subscription was purchased (for example, 'com.some.thing').
subscriptionId string The purchased subscription ID (for example, 'monthly001').
token string The token provided to the user's device
when the subscription was purchased.
The API requires authorisation.
Also check this
Canceling completed test purchases
Google Play accumulates completed test purchases for each user but
does not pass them on to financial processing.
In some cases, you might want to manually cancel a test purchase to
continue testing. To do so, open the app page in the Play Store. If
the test purchase that you want to cancel is a subscription, you can
also use the cancel() method of the Purchases.subscriptions API.
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.
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.
Is it possible that I can re-buy a manged item?
I am testing my android app and I did not use the checkPayload method when I bought the item first.
now I implemented the checkPayload method and of course now it tells me that the payload isn't the same... Is it possible I can reject the first time buy and re-buy it again?
I anyway would like to re-buy it again, so I can test my code...
Cancel transaction from google play console, wait a lot of time (few hours) and you will be able to purchase it again.
BTW - you should check inventory on Google Play to get purchased items in case of some issues during purchase (i.e. crash between purchase and notifying the application).
You should be using the latest version of the Google In-App Billing system, in which case you can 'consume' a managed product (all products are managed in v3). Once consumed, the user can purchase the item again. Since this is for testing, you'll want to disable this consumption in your release build.
http://developer.android.com/google/play/billing/billing_integrate.html#Consume