IABv3 SKU is available, but cannot be purchased - in-app-billing

I have implemented in-app-billing for Android many times. But for my latest app, I can not get the purchase working.
I use IABv3.
When I do the queryInventoryAsync() I got proper results: my SKU is found, and I even see its price, description, etc, in the log.
So the in-app product exists, and can be queried.
Yet, when I purchase it, I see:
The item you requested is not available for purchase.
And IabHelper reports:
Purchase canceled - Response: 4:Item unavailable
working code in other apps.
app state is PUBLISHED.
there is an ALPHA and a BETA track, both with uploaded APKs.
google account is listed as test user.
item is active.
What could be causing a situation where the queryInventory does see the product, but the purchase request does not see the product?
UPDATE: It started working without any changes. Somehow there was a large delay. I wonder if it has to do with the review, or the age-rating review?

It started working (without me doing any changes) roughly at the time I received an email with this:
If I had to guess, the IAB item was blocked until the app was rated or reviewed otherwise by Google.

Related

How to get purchaseHistory for IAPs with BillingClient

As the documentation says:
queryPurchaseHistoryAsync():
Returns the most recent purchase made by the user for each SKU, even if that purchase is expired, canceled, or consumed.
So lets say I would like to make an IAP for the user to remove Ads forever from my app.
How do I decide with a fresh install if that user already purchased that IAP if this function also returns the "canceled" IAPS?
I would like to query the actually purchased IAPS, not everything. Becuase that way a user could unlock the Ad free version with a cancelled IAP.
To make it worse, the Purchase class doesn't have status like "cancelled" or "consumed" I cannot decide the state of the user's purchased IAPS.
Am I missing something here?
Thanks in advance
The billing client documentation states it checks for the user.
Then we have the question: Who is the user
If you look at the steps taken for the billing api on https://developer.android.com/google/play/billing/billing_library_overview then you see that a connection to google play is needed.
What happens then is that the current user on android, the account they are signed in with on google play and their mobile device is determined to be the user.
So if they purchased it via google play in app, it will always be assigned to that user on google play and that is what's being queried by this. No matter on which device they are logged in, Their tablet, smartwatch, phone, television, etc...
How to get a list of actually bought products
Instead of using async that gives you everything included abandoned shopping carts I suggest you use https://developer.android.com/reference/com/android/billingclient/api/BillingClient#querypurchases
That way Get purchases details for all the items actually bought and paid within your app. This method uses a cache of Google Play Store app without initiating a network request.
Note: It's recommended for security purposes to go through purchases
verification on your backend (if you have one) by calling the
following API:
https://developers.google.com/android-publisher/api-ref/purchases/products/get
If you read that API link it's easy to check with the online cache if the purchase was valid with a simple GET request.
Personally I would build in a check if the phone is suspect to be rooted before doing the manual background check with the purchases API that sends a request to the store.
Phones that are not rooted have a higher trust level, as the user are probaly not very tech savvy and will not have a shimmer of a clue how to circumvent such checks, and the google play cache will be updated regularly, reflecting trustworthy data.
When a phone is suspect to be rooted(you can read protected directories/write to them), then perform the check online if they bought the stuff each time you deem it neccesary.

In-App purchase error - consumable you've already purchased this item, but it hasn't been downloaded

I am new in ios developement .I added an in-app purchase to my app, and I get the products data from the appstore successfully. the iap is a consumable.When I call the "addPayment:" method, I get the "Confirm your in-app purchase... [Environment: Sandbox]" question. I click Yes, and then I get a message which says:
"You've already purchased this but it hasn't been downloaded. Tap OK to download it now. [Environment: Sandbox]".would be very grateful if anyone had any ideas whats wrong?
This happens when the user is making a purchase on something they have already bought. Given that you are working with a consumable, you need to make sure you send a consumption/provisioning request to the Apple purchase servers when you give the user what they bought.
I was in a similar situation; resolved by restarting my iPhone (holding home/power buttons until the white-apple-logo-on-black-background appears).
Specifically, I had non-consumable purchase hosted on Apple's Server. Installed app to iphone5, made purchase. Deleted App, reinstalled in another build, and upon restorePreviouslyPurchasedTransactions, ITunesStore server didn't respond with my hosted-contact productIdentifier. (Although it did respond and restore some other test purchases that were non-hosted). Purchasing the hosted-content item again produced the error "You've already purchased this In-App Purchase but it hasn't been downloaded."; the alert was without an option to download. I found this site, http://support.nimblebit.com/customer/portal/articles/672080-problem-making-in-app-purchase-ios-os-x; restarted my device, and restore now recognizes the previous purchase.
I don't know exactly what triggered this problem, but note that I had been performing extensive testing on the downloading of this hosted-content item, debugging and ending the program before downloads were complete. I had code in place, upon startup, to spot unfinished transactions and finish them. So FinishTransaction was eventually called. At the time of this error, there were no outstanding transactions in the paymentQueue. My only guess is that abruptly killing an app at some point in the download process leaves a flag intact on the device that the item is being downloaded and so is not available to restore, which if this is the case, fortunately gets reset upon restarting the device.
Have you uploaded content?
This In-App Purchase is not currently available for testing in the sandbox environment because you have chosen to host your content with Apple, but have not delivered your content. Upload your content to test this In-App Purchase in sandbox.

Application crash after approved

I got my application approved on app store.
But due to some change in the feed I am using my app is crashing now. What am I supposed to do now?
Giving an update will take 7 days for apple to approve and I will get bad reviews if any one downloads it in between.
What am I supposed to do now?
You could:
Fix the feed.
Remove the app from sale until you fixed the bug and the update is approved.
Remove the app from sale until you fixed the bug and the update is approved and request a speedy review.
To remove a App from sale, go to the Rights and Pricing of that app in iTunnesConnect and set the Availability Date in the future. this will remove the app from sale. Just put the date back to now to make it available again.
You can ask for an expedited review (http://developer.apple.com/appstore/contact/appreviewteam/), if you haven't abused of it yet and have real reasons (as it seems) to ask for it, they will review your App in between 1 and 3 days... :)
If you want to stop selling your App while it is happening, you can go to the Pricing menu in iTunes Connect and remove all the countries available...
You need to submit an expedited review request. From my personal experience I've generally pushed these out within 24 hours. Usually Apple does these as a one time exception, and is supposed to be used once in a great while. I've done 4 total in 2 years. Anyhow, since there is contact information on the website, if users download and contact you reply back that there are pending updates, and will be out shortly.
You could go through pausing delivery of app until ready, etc, etc. Availability can be changed and automated via dates. You can remove from countries available.
Here is link for expedited review. You'll need your App ID and Name, etc.
http://developer.apple.com/appstore/contact/appreviewteam/

In-app purchases not working shortly after review

I have an app with two in-app purchases. One is called adfree, the other galaxycluster. The adfree product has been working for a long time. In the newest version, I added the galaxycluster product. I tested it in the sandbox and submitted it for review together with the app update.
Since the app status changed to in review, product requests for galaxyclusters fail. I noticed this initially in the sandbox environment and now that the app update has been approved and released, this is still not working in the production environment.
Did anyone else notice something similar? I.e. product requests working in the sandbox, then not working anymore when the app is in review? Should I just wait for 24 hours?
Waiting (12 hours) did indeed resolve the issue (and created two bad reviews in the meantime).

In App Purchase problem for non consumable products

I am developing an application in which user can purchase any image he likes. For this i have implemented the in app purchase functionality as consumable products. That means if user purchase the same image again, he has to pay for that again. But apple rejected this application by saying that the product should be non-consumable in this case.
Now the problem is i have to create unique product id for every image and the number of images are around 1800. So, do i need to make the 1800 ids in the itunesconnect?
Also, there is a parameter in itunesconnect that:
For Review
When you have tested your in app purchase and are ready to approve it and submit it for review, upload a screenshot below. This is for review purposes only and will not be displayed in the Store.
For this do i need to add screen shot by testing each and every image?
Please provide any simple solution for the problem.
Thank s in advance...
If you have 1800 unique products, you will need 1800 entries in the store.
There isn't an automated means for uploading product information so you will have to do it all by hand.
Note that you maybe also come away with a generic image IAP object, that's consumable. But you have to provide additional server infrastructure to make sure a account can be created and purchases can be restored.
And even then, it seems to be a thin line. There are however apps in the store that work this way.
Update (Feb 2012): It's not working anymore. Apple rejected the latest app using this technique. I'm sorry.