How do I test Google Play Android subscription? - android

How do I test a Google Play Android subscriptions and Google API?
The app is uploaded, but not published.
The APK is activated.
The subscription product id is published.
I tried to purchase subscription on totally unrelated phone, not my account.
All accounts I tested are listed in Android Developer Console > Edit Profile
The BILLING_REQUEST_ITEM_TYPE is set to "subs".
The BILLING_REQUEST_API_VERSION is set to 2.
The app is signed and a release version, ant release installr.
IGNORE THIS: When I try to purchase a subscription, it displays the subscription description, but immediately says "The item you are requesting to purchase is not available."
I cannot test the Google Android Publisher web API, https://developers.google.com/android-publisher/v1/purchases/get
IGNORE THIS: It requires a user subscription token but I can't get a token without buying a subscription!
Ok somehow it started to work and I was able to purchase a subscription. However, there was an error in my script on the server so I was not able to save the user subscription token. Now when I try to repurchase the subscription, it says "You already own this subscription."
When I click Details, it says "Item not found." with a Retry button!
I feel like I'm the only one in the world trying to use this API!
Additionally, there is an error in the Google billing API. I do not call mBillingService.confirmNotifications() until after I receive a confirmation from the server that the subscription was saved, yet I see a charge/deposit in my merchant account.

Have you installed a signed version of your .apk on your test-device? In order for Google Play to acknowledge your purchase request, the .apk needs to be signed (through the usual "Export"-feature in Eclipse, for example)

Related

How to cancel test subscription in Google play developer console

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.

Google Play InApp Billing Purchase Error

I implemented google play IAB sdk but when I run the application I got the following message:
Authentication is Required. You need to sign into your Google Account.
Although I published the application on Developers Console and also I double check the ProductID.
I guess you are testing your app directly from Android studio, you have to create a closed beta, add your email to testers and publish.
Use only signed APK to test inapp purchase with same version code and version name as you have in published APK on google console
Also add your email to tester
In addition to #Tinco De Simone's answer, maybe you are trying to access wrong item id from the console. From this thread, "In the developer console subscription item had id "premium" and I've tried to access "premium_version" item". Double check if the itemID fits with id that you request in your app.
Also be noted that it might take up to 6-8 hours before a newly created in-app product is available.
You may also check this related SO quesiton: Android IAB. Error - Authentication is required. You need to sign into your Google Account
This message indicates that, may be you are not logged in with any Google account in your testing device, as Google pay always requires a Google account to purchase anything from play-store.

In-App Billing: Error: Your payment could not be processed at this time

RE: Unable to test in-app purchase via Google Play Store due to In-App Billing: Error: Your payment could not be processed at this time
I have completed an app that uses in-app billing to allow the user to purchase some virtual products within the app. I've followed all the steps outlined in "Testing In-app Purchases Using Your Own Product IDs":
http://developer.android.com/google/play/billing/billing_testing.html#billing-testing-real
These are the steps I have taken to test:
Uploaded application as a draft to the Developer Console.
Added items to the application's product list.
Set up Test Google Account
Added a Test Google Account to Developer Console
Set Up Google Wallet for Test Google Account, Added Payment Method under my name
Factory reset of Test Device
Restarted device and Signed in with new Test Account
Loaded draft apk
When I attempt to purchase an item in the application, Google Wallet responds:
"Error: Your payment could not be processed at this time. You may receive an email asking you to verify your account."
I check my gmail inbox and for each failed purchase I have two emails - the first is an order receipt, and the second is an order cancellation receipt.
I've tried waiting 24, 48 hours and get the same response.
Any ideas on how to resolve this. How else I am supposed to verify that in-app billing will work for my users if I cant even go through the process end-to-end myself.

User is not eligible for this purchase - in app billing

I'm getting
"User is not eligible for this purchase"
message from google play while trying to purchase as a test.
I've uploaded singed apk in google play, published the billing item(in app product), saved the apk as draft, still getting this error.
Also I was trying to purchase from test user device.
Edit:
The actual reason for this error:
If an unauthorized user try to purchase an item then this message
should appear.
So if the App is not published, a non test user should get this error while try to purchase.
I realized that, Google play takes time to update the changes in app store. So you can not expect the changes immediately. Rather you should wait, in my case it took average 2/3 hours.
Still there may be some unknown error, which I could not figure.
My Cases:
First I was trying to purchase from my test device still got this error, But after waiting some time I didn't get this error. So I think the time was reason here.
Secondly I was trying from a non test device, which was an unauthorized device as the app was not published.
You must use, only, Test Account for Testing purposes. You can not use market account or others for purchasing your app while Testing.
From Android Docs
The synchronous response for a CHECK_BILLING_SUPPORTED request provides a Bundle with a server response code. A RESULT_OK response code indicates that in-app billing is supported; a RESULT_BILLING_UNAVAILABLE response code indicates that in-app billing is unavailable because the API version you specified is unrecognized or the user is not eligible to make in-app purchases (for example, the user resides in a country that does not allow in-app billing). A SERVER_ERROR can also be returned, indicating that there was a problem with the Google Play server.
see details here
This error comes when everything you done is perfect, you have used signed APK with the proper product id, but you have to note that the account that you are using might don't have proper valid credit card details.
So whenever you want to buy any product even with test account, that account should have valid credit details.
You have to specify test account in Edit profile of your publisher account
Licensing & In-app Billing
Test Accounts box
There is a now an additional situation which can result in the "User is not eligible" message.
It comes down to this recent change in the licensing system:
The Licensing keys are now managed for each app individually. To see
the license key for an application, switch to the new design and go
to the Services and APIs for the application
You can no longer use the old "shared" license key when creating new apps. You must switch the Google play developer console to the "new design" and use the license key for each specific app from that app's Services and APIs section.
If you try to use the old shared key the behavior is as follows:
If app is not yet published, tester will receive "User is not
eligible for this purchase" message.
If app is published, user will go through purchase process and
be charged for purchase, but the app will not receive a "purchase success" message.
TL;DR: Make sure you are using the new per-app license key and that you have copied it correctly.
I had the same issue.
I fixed it by uploading apk via "Old Design" of Developer Console.
Steps:
rename application package.
create release build and sign it with your developer key.
upload it to the Developer Console Old Design. You will be asked about switching to the new design for getting public key. DON'T do it.
Perform all next actions from Old Design.
After creatind and publishing inApp content switch to the New Design and take your application security key.
Put new key to your application, rebiuld and resign.
Install your application to the device.
Wait 2-3 hours.
Profit.
lved it. There is some problem in the "New Design" of Developer Console. I deleted the apk and created a new app from "old design" and it worked. Price points(In-App products) got automatically added again as the app package name is exactly the same as old one I deleted.
Also make sured the new public key is used which is app specific now.
Make sure you fill in the #gmail.com address as a licensed test account. Other e-mail addresses associated with your Google account will NOT work.
For the "Unpublisched" app, enter your email account under "Account details" and "Gmail accounts with testing access" in Play Developer Console. Also one need to wait 24 hours.
The android:versionCode set in the Manifest must be the same as the one active in Google Play console
I met this problem and was bothered for one or two day.I delete the test device's gmail and added it again. After then it works.

Android In-App billing error

I have followed google instructions for implementing in-app purchases service.
I was provided access to Google Play developer console as invited user. I took private key from it, and added my google account to the input field with test accounts. After that I created APK file and signed it with valid certificate. Then uploaded application to Google Play but didn't publish it. After it I created needed in-app purchases and published them. Then installed same signed apk file on my device.
Right after publishing in-app purchases and for some period of time my application was giving me message like "not found", but some time later it became available. And now I can buy all the items from the application, but no one else who installed the same APK file can't. I tried to add their email addresses into list of test accounts in profile - no luck, even the user owner of the Google Play account can't buy anything. They keep receiving something like "item you selected is not available for purchase" When they try to buy test purchase item (the one that is described in documentation) they can successfuly get "android.test.purchased: PURCHASED"
Google Play takes a pretty long time to update its servers. When I was implementing in app billing the first time, I must have rewritten everything at least 50 times. Nothing changed, except some 12 hours later it all started working magically. Most likely their server hasn't updated yet. If you can use the test items correctly, then your implementation is likely fine, and you just need to wait for the servers to update.
Only the signed apk file that you uploaded in play store can be used to buy the in app product.
Did you give the in app id in the signed apk file before registering the in app id in play store.then only others can buy the item.
as per the edit
see you have use android.test.purchase ri8 it is an test id when your make your app real your need to replace that with your own in-app id.Then you have a question how to obtain in-app id.its very simple after saving your app(not published) in draft there is an option to add the in app product for your app.click that option where you will see the app id in one of the field then fill the in app id and also set corresponding amount for your product and publish the in-app product not the app.Replace the android.test.purchase with your new id in the signed apk and wait for some time so that the server can update your changes.

Categories

Resources