Android in-app purchase - RESULT_ITEM_UNAVAILABLE - android

I'm trying to integrate Android Market in-app purchases into my app, but unfortunately coming across an annoying error every time I try to purchase a test product.
I've taken the sample application (Dungeons) and added it to my app. I've updated the Public Key and also updated the list of products to the following:
/** An array of product list entries for the products that can be purchased. */
private static final CatalogEntry[] CATALOG = new CatalogEntry[] {
new CatalogEntry("lemonstorm.huru.full", "Full v", Managed.MANAGED),
new CatalogEntry("android.test.purchased", "purchased",Managed.UNMANAGED),
new CatalogEntry("android.test.canceled", "cancelled",Managed.UNMANAGED),
new CatalogEntry("android.test.refunded", "Refunded",Managed.UNMANAGED),
new CatalogEntry("android.test.item_unavailable", "unavailable",Managed.UNMANAGED)
};
I've exported the application using Eclipse, and installed it on my phone and also uploaded it to the Android Market website. Also on the Android Market website I've added lemonstorm.huru.full as an in-app purchase and published it.
I've also added my googlemail account as a testing account (that is the one I'm signed into on my phone).
When I run the application on my phone I get a RESULT_ITEM_UNAVAILABLE message whenever I try to buy lemonstorm.huru.full, but if I try for example, android.test.purchased, it works absolutely fine.
The documentation for RESULT_ITEM_UNAVAILABLE states the following:
Indicates that Android Market cannot find the requested item in the application's product list. This can happen if the product ID is misspelled in your REQUEST_PURCHASE request or if an item is unpublished in the application's product list.
The product ID is definetely the same, it's definetely published and the request must be going through ok as it's the sample application and it worked for android.test.purchased
Any thoughts would be appreciated!

I had this same problem. After I published the application, the products were found. Looks like a bug in Google's test accounts(?)

I've had the same issue. I was playing with Dungeons sample and missed that sword_001 and potion_001 products must be "Published". The problem for me was that they where just saved and remained "Unpublished".
To solve it I've just edited products and pressed Publish button for both. Now I can buy both from the sample app.

I got BillingClient.BillingResponse#ITEM_UNAVAILABLE response and this message from Play Billing Library:
ProxyBillingActivity: Got purchases updated result with resultCode 0 and billing's responseCode: 4
It turns out, I forgot to visit the opt-in link for testing (I only added the tester to list of alpha testers and to the list of users with license testing access).

As far as I know:
Does the version code the same with unpublished draft application in your application publish site?
Did you Touch Factory data reset to test account?
Did you set managed product of your lemonstorm.huru.full in publish site?

Here is a great rundown for how to test in-app billing, it includes a chart for what you can expect to see from the market app in situations where an app is published vs. non published and using a user that is a test user, developer, or other:
http://developer.android.com/guide/market/billing/billing_testing.html

Also, remember to sign the app when you export it.

Related

In app purchase not working: item not available for purchase

Using in app purchase in my application. I have double checked the products are listed at playstore and in active states. plus the application is published but in beta testing. product ids using in my code is very same as in playstore. I'm testing the signed apk on phone.
Problem: whenever i click the button and try to get product it endup like this.
please help. thanks
Step you need to follow, once launches an inapp products in your application.
You have latest In-app Billing Version configured in application
Apk is in published state but in beta testing or any other testing
List the products with unique ids at play store panel
Change the state of products to active state
Product ids are same in source code as well in play store (double check)
You have signed apk installed in phone
versionCode of published apk & testing apk must be same
you have added a tester at play store under same apk
You need to test inapp from very same email, you have added at google play store (as tester)
once i followed all steps this error is gone. In my case it is because of tester's email :)
You have to use a different (test) account than the one you're signed in to the developer console with, and add it in the developer console.
Edit: see here: the item you requested is not available for purchase
I think, you might miss something but to get the missing part, you must share your code of InApp Billing section. By the way, you can also use the library project from https://github.com/anjlab/android-inapp-billing-v3.
Possibly a caching problem with Google Play services. Clear out the cache and try again.

In-app billing issue: "This version of the application is not configured for Billing through Google Play. Check the help center.."

I am using in-app billing in my android application. After signing, I uploaded a draft APK to the market (no debuggable in manifest), also included the com.android.vending.BILLING permission and all the files.I first tried the reserved android.test.purchased product ID for testing. It worked fine.
Now I add a 'In-app Product' with a new price for managed product to my app in the Google Play Develoiper Console and set the product to active. The APK is still in draft. I created a test user and reset my device to make that test user the primary account on my test device. Also mentioned the product id in String SKU in my main activity.(previously it was android.test.purchase)
Now, while trying to install the app, I am seeing this message:
"Error : This version of the application is not configured for Billing through Google Play. Check the help center for more information."
I have waited for more than 2 hours and tried again. Still same. I have also checked the versioncode in the main application and in the phone's installed application is same. I am using In-app Managed Product. Also, I would like to add a product id with yearly subscription if managed product works fine. Please suggest.
Try waiting 12-24 hours. Sometimes it can take quite a while to kick in on Google's servers.

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

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

How can I test in-app-billing with a non-published app?

I have an Android app that uses In-App-Billing to sell Account Managed Items.
I tested the app with the static response IDs and everything seems to work. I now want to test the app with real product Ids.
I created the app in the Google Play Store and uploaded a draft version of the app with the correct permissions. I now created an In-App-Billing item and published the item.
At the moment the app is unpublished. The item is created and published and I have a test account that is registered in the profile of the developer account and is the only account on the device that I use for testing. The app is signed with the same key as the uploaded draft. Edit:I'm testing with Android 4.1 && 4.03 at the moment
If I try to buy the item the Google Play Store pops up but shows a dialog with the following method: The item you requested is not available for purchase.
How can I test buying the item without publishing the app?
When you test the app, make sure you have exported and correctly signed it (not using debug key). Also make sure that you are using the correct Google account (registered test account) on the device.
Additionally, the registered test account cannot be the developer account.
Apart from this, it should work fine.
Note: Testing your own in-app purchases does require a valid credit card and actual payment.
And finally, it currently takes a few hours for market edits to propagate through the servers and show up.
It may take some time to reflect the changes on google play if you just uploaded the app and added the item there wait for some time near about 2 hr. it will be shown the item you want to purchase.
For others who reach this thread, Now it's not possible to test In-app billing with just a draft version of the app.
Draft Apps are No Longer Supported
Previously, you could publish a "draft" version of your app for testing. This functionality is no longer supported. Instead, there are two ways you can test how a pre-release app functions on the Google Play store:
You can publish an app to the alpha or beta distribution channels. This makes the app available on the Google Play store, but only to the testers you put on a "whitelist".
In a few cases, you can test Google Play functionality with an unpublished app. For example, you can test an unpublished app's in-app billing support by using static responses, special reserved product IDs that always return a specific result (like "purchased" or "refunded").
for details read https://developer.android.com/google/play/billing/billing_testing.html#billing-testing-test
You can test in-app billing by using options, look at this
Edit :
On the link I mentionned, you can see this :
Note: You do not need to publish your application to do end-to-end
testing. You only need to upload your application as a draft
application to perform end-to-end testing.
If you still can not test it, what you can do is to publish it and test it. If you think there might be bugs in your app's in-app billing, refunds are still a solution.
I'm thinking about something, on the dev site, you can see this :
Verify that your device is running a supported version of the Google
Play application or the MyApps application.
On what Android version are you testing on ?
You've to add the products(item sku) in you app product in your play store app account. The SKU you set In-App billine is not available. For testing, set the SKU androidtestpayment. Now you'll now get that error The item you requested is not available for purchase.

Configuring Android In App purchase for testing

Im new to this situation. Ive coded for Android In App purchase, and uploaded it as a draft in google play(Not published) for testing purpose. Now Ive to create some In App products there in developer console, that can be bought through my app.
My doubt is about the pricing when the app is put for testing. The price cant be set to zero. It shows a minimum of $0.99 should be there.
To test my app, how can I configure it such a way that i can purchase it freely.
Helps would be appreciated, :)
This should help you get started Testing In-app Billing.
However there is a warning:
Note: Making in-app billing requests with the reserved product IDs
overrides the usual Google Play production system. When you send an
in-app billing request for a reserved product ID, the quality of
service will not be comparable to the production environment.
And one more thing i could find out on the above topic is, its possible to add testing email accounts in the Google Play. Developer can add any number of gmail ids as testing accounts there.

Categories

Resources