StoreKit Alert "Thank You. Your purchase was successful. [OK]" presentation logic - in-app-purchase

We include iOS In-App purchases in several apps (multiple targets, different brands of the same codebase);
During our testing, we found that sometime at the end of the purchase process the alert "Thank You. Your purchase was successful. [OK]" is shown, while some times it's not.
We've tested on several devices, several apps, several sandbox users, and we could not find a reproduction path: same app tested at once on two identical devices (model, OS version), with brand new sandbox users, the alert is showing on one app and not on the other one.
To make it clear, the purchase process is always successful, the transaction is closed, and everything is working properly; Only the alert is sometime missing.
What's the exact logic behind that?

Related

How do in app purchases behave in Pending Developer Release?

I recently finished the first version of an iOS application. I have several in-app purchases within it. When testing these, I always used a physical iPhone. Apple just approved the build for release and the app is now in "Pending Developer Release." As one last sanity check, I generated a promo code for myself on app store connect and downloaded the app onto my phone through the app store. I quickly noticed that the SKProductsRequestDelegate method is never fired and the list of in-app purchases is never downloaded from Apple's IAP server. This is similar behavior to when the app is run within a simulator: the IAP data is never loaded.
I am unfamiliar with how the "Pending Developer Release" stage impacts in-app purchases. Will they work as expected when I release the app to the public? Is there some change I need to make and resubmit?
Any help would be greatly appreciated.
As far as I know, it should work seamlessly except for the charging (You won't be charged if your app is downloaded from outside AppStore). So trying to gather logs may help you in this case.
Turns out this was an issue on Apple's end. I contacted support and something on their end had been messed up when they approved the in-app purchases.

Cannot get my app approved because of error "Can not connect to iTunes"

I read many answers here with similar problems but none helped me to get my app approved. It's been 3 weeks of trial and error. I am totally frustrated of it.
What I am trying to do:
I am submitting my first app (there is no other app with my account created yet).
I have one in-app purchase (nonconsumable) in my app that removes ads and opens all content.
Sounds easy right?
I have been rejected for a few different reasons that has one thing in common - they (Apple testers) cannot successfully perform in-app purchase.
What I did:
Successfully bought and restored in app-purchase with my sandbox user.
At first I was using swifty storekit library. Got refused with "Unknown error. Please contact support" So I ditched this library and Implemented whole code myself, according to apple documentation.
As I read there can be problem with my agreements, tax and banking settings in Itunes connect - found out that there was red line about transfering my account settings (dont remember exact line) - did dissapear after 2 days by itself as I read in some answer here. There is no problem there now.
Did find out that I must wait some time before in-app purchase starts working. I takes about 2 days to in-app purchases start working with testflight user, so waited until it starts to work - then successfully bought in-app purchase and restore also works fine even with testflight testing account. (again got refused)
there is not exactly stated how to submit first in-app purchase ever, it is just said submit with binary. I did not get this at first, found out that I should not send in app purchase by itself, but I should "append" my in app purchase in the same form as I am sending my app. At first I tried to send my in app purchase in its own formular. But then I got rejected with error "We found that while you have submitted in-app purchase products for your app, the in-app purchase functionality is not present in your binary." (I say it again - there must be api there as I can successfully buy app with test account).
read in some other answer that I can ask to get my in app purchase approved, so I write "please approve my in app purchase - they did, but I got refused.
Now I cannot select this in app purchase with my binary, as it is not shown for selection probably because it is already approved. So I did submit app without it and got the "in-app purchase functionality is not present in your binary" error again.
Created new in app purchase, this one can be selected to be submited with app. Got rejected again, with error.
"can not connect to iTunes"
In app-purchase is then switched to "Developer Action Needed". This is probably a good thing as if they would approve it then I could not select it with binary as it would be invisible.
What else should I try? What to change? Where to look? I am totaly lost. 3 weeks of time lost. As I cannot reproduce the problem I cannot solve it. Programing is easy, but to get app approved looks like imposible.
Few of many many visited links:
In App Purchase functionality is not present in your binary
iOS In-App purchase works in development but not in production
https://forums.developer.apple.com/thread/13324
https://www.innofied.com/in-app-purchase-working-ios-solution/
What I did next: recorded video of myself successfully buying in app purchase with my testflight account and uploaded it to youtube, added link to my reply form.
Next try: I sent them this message:
"Good evening,
I am totally out of options. Is there anybody at apple who I can consult this? ... Because, everything is working on my side. As I cannot reproduce your problems I can't make it right.
I have tested it with my sandbox user - it works - I can make a purchase successfully and I can restore it too. I noticed that with testflight it needs some time to start working (about two days). So with this build I waited two days and when it did start working on testflight i submited my app. This is my first submit of app ever, should I do something special? You already approved my first in-app purchase in one of my trials, but I cannot select it to be published with my app as it is already approved (it is not shown, so cannot be selected) and if i dont submit it with my app then I got rejected with confusing error stating that in app purchase api is not included. So I created second in-app purchase - the one submited here which is now after rejection in "Developer Action Needed" as you rejected the app. So what can I do now? Don't you need to wait some time after you approve my in app purchase (submited with the app) to start working? Did you approve my in-app purchase which I submited with my app by the way? Please dont send me link to the documentation. As everything works on my side there is nothing I can find there. Give me some advice or contact to someone who can Investigate what is wrong on your side, as you cannot make it work... thank you in advance"
After rougly one day, status did change (they changed) to "in review", and after another half hour I did get email with "Congratulations! We're pleased to let you know that your app, Juggling, has been approved for the App Store"
So to answer my own question ... how to get through application approval? I don't know. What I did wrong, what should I do? I don't know. Are there real people there or artificial inteligence? I don't know. What exactly was the problem? I don't know. What did finally do a change? I don't know. Hope this answers will help next generations of programmers get their apps approved in the future. (Pun intended)
Thank you

In app purchase not working after publishing iOS app to App Store

During development I've created test accounts which are able to obtain the price of the in app purchase as well as actually purchasing it without an issue. However after publishing the iOS app to App Store, the version of the app in App store can't even retrieve price of the product, and nothing shows up when I press the button to send the purchase request.
Uninstalling the app and redeploy the development version to the same device got it to work again.
What could be the problem? Is there a way to debug or see logs on the app store downloaded version? (iOS noob here)
Thanks!
I had the same problem. The app was approved but in-app purchases were not working. After 24-48 of app publishing problem was fixed by its own. By the time app approved it was not appearing on App Store through search. After it was indexed on App Store in-apps started to work also.
It takes a little time even when everything is approved.
My binary was approved.
My In-App Purchase (IAP) was approved.
Testing the purchase in development with a sandbox iTunes Account worked great.
Purchasing in production with a real or sandbox iTunes Account would fail.
I didn't have to wait long, something like a couple hours and it just started working.
Now, my binary and my In-App Purhcase were approved at the same time and almost immediately after they were both approved, I released the app version to the store.
I'm not positive, but what I probably should have done was wait a couple hours before releasing that new app version and give the In-App Purchase a chance to "register" or "propagate" in the Production App Store.
Just a recommendation for others.
It takes some time, but the amount isn't predictable. In my case, I launched 3 very similar apps at the same time, so just add some data on this :
Everything was approved, the apps were quickly available on the App Store.
It took about 4 hours for 2 of the apps to show up in search results.
After 6 hours, IAPs started progressively showing up (not all at once) for these
After 9 hours, IAPs for the two apps were complete.
After 12 hours, IAPs for the last app started appearing, but the last app itself still wasn't showing up in search results.
After 14 hours, the last app appeared in search results.
The order in which I hit the "Publish" button didn't seem to have any influence, nor the number of IAPs, weight of the app, etc.
So delays are unpredictable and do not follow a specific rule ("First-in, first-out" or "search results and then IAP")
I found this Apple Tech note, which is includes follow:
Q. App Review has recently approved my application, but my In-App Purchase identifiers in the production version of the application are being returned in the invalidProductIdentifiers array.
A. When an application is approved, the developer must also approve the application for release to the App Store. On approval, the application ID is activated to the App Store. The same activation is required for the in-app purchase identifiers and can only take place once the application is activated. In some cases, the activation of the In-App Purchase identifiers may lag up to 48 hours following the activation of the application.
If the developer does not approve the release of the production application to the App Store, then any new in-app purchase identifiers will not be activated. This is an issue when a developer wants to verify the application prior to activating it on the App Store. If the desire is to test the in-app purchase process for the new items, the application must be activated to the App Store. This is only an issue for new in-app purchase identifiers in a corresponding application submission. Once these in-app purchase identifiers have been activated, application updates to the submission will find that these in-app purchase identifiers are validated, even if the update is not activated.
But in my case it takes even further, about 52 hours.
I found that doing a simple edit of the description in each IAP helps. Just make an edit, save it, revert to the original and save again. It took up to 8 hours for it to propagate across Apple servers. IAP's I didn't do this to had no change.

iOS: In-App-Purchase fails for some users in production

I've recently released an iPad app which has a non-consumable "pro upgrade"-style In-App-Purchase.
It works for most users, and it worked when testing. However, I do get daily reports of the IAP crapping out for some customers of the app.
It is the worst kind of bug:
For most people, it seems to work fine.
For some people, it works after a reboot of the device or logging out from the App Store.
For
some other people, nothing seems to help and they can't make the
purchase.
And I do not have any remote logging implemented...
This seems to happen across various locales / different iPad models / OS versions.
For those which can't make the purchase, usually an error pops up which says that their Apple ID password is incorrect, after confirming the purchase.
The purchase button in the app only appears after the IAP product was received from Apple's server successfully.
I am not sure how to track down what's going on there. I was initially thinking it's on Apple's side, but the number of people reporting it tells me it must be something with my app.
Any best practices on how to debug this?
thanks!

iOS testing an InApp Purchase a second time?

I have an iOS app that uses InApp purchases. I have gone through all the steps necessary and everything seems to be working ok. I am unclear on one issue though… how do I re-test an InAPP Purchase?
What I mean is I have a few different SKU's available, some when purchased cancel out others. For example, I have Feature A that has a blue and red widget. Then I have Feature B that includes a blue and red widget, but also adds a yellow one.
I successfully tested the InApp Purchase with the test account and bought Feature A, how do I clear the InApp and try my App by Purchasing Feature B?
You can not clear the purchase history.
Create a new user for each different set of testing you want to run.
In your case, MKStoreKit keeps a record in the keychain and that is retained across app deletion. So, you need to call removeAllKeychainData on MKStoreManager to remove all of the old purchases.

Resources