In-App Purchase issue in iOS 9

Steps to reproduce the issue:

-Buy an in-app prodiuct of type consumbale

- Enter an apple id which is not configured with credit card details in the prompt that asks for apple id and password.

- It will navigate the control to App Store App and request the user to enter the credit card details. So, once if the card details are entered successfully, App Store asks for a confirmation to purchase the in-app product of type consumable from the App store itself. So once if the user click on purchase/buy, the product is purchased successfully.

- which is not reflected in the App. Whereas, an exception error received in the "- (void)failedTransaction:(SKPaymentTransaction *)transaction"

- So, i need to know the way to restore the purchased consumable product from the app and a way to restrict the purchase if the credit card details are not configured.

Replies

You should get two transactions in that case - one failed followed by one successful. Your code needs to handle that.


You can search these forums (and the archived forums) for a bit of discussion of the so-called "StoreKit flow" for a little more detail but that's the gist of it.

Further to junkpile's correct response, your user most likely has an unfinished transaction waiting to call your updatedTransactions method as soon as the app adds a transaction observer. Think through when your code does that - perhaps if the user starts to buy another IAP the app will add the transaction observer and immediately credit the purchase. Best practice code does not dismiss the IAP code nor removeTransactionObserver for about 10 seconds after a failed transaction for this reason. Does your app do that

I dont removeTransactionObserver and is in active state only.

The main issue that i face hear is like, the updatedTransactions method is not called, when an app return to forground from background with incomplete transaction.

Also, when we have an incomplete transaction of a consumable type product and the user try to purchase the product again, then Storekit will prompt the user, that the content will be restored for free and non of the delegate methods are called.

Yes, i follow the guidelines and unfortunately i still face issue.

Where i dont get call with successfull transaction, when the App is moved to forground from background with incomplete transaction.

Are you certain you are not deallocating the class that added the transaction observer? It certainly sounds like you no longer have an active transction observer.

Am sure that the TransactionObserver is in active state.

I had replicated this issue a week ago and had submitted it as a bug report. In my test, when the updatedTransaction delegate method was called, I exitted the function without calling finishTransaction. I then backgrounded the app, then moved it back to the foreground. Interestingly, there was no check made to the Store last week. However, I just tried my example and now I'm seeing the StoreKit password dialog when I foreground my app. Can you check your sample today?


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

I tried with the sample code downloaded from the link that you recommended previously and unfortunately, we still face the same issue.


When the App is moved from Background to foreground with Incomplete transaction, store-kit asks for Apple ID credentials. So, once if we entering the Correct Credentials, the delegate method “- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions” should have been called. But it is not called in development environment.


Alos, i have noticed that this happens in development environment only.

Try entering a different username and password and see if it responds differently. If not, ask yourself what the 'correct' username and password actually is - what username actually made the purchase that the "sandbox" environment is trying to process. (it is 'sandbox' not 'development') And are you certain it is operating in the sandbox environment - did you delete the old build of your app?

Yes it is operating in sandbox environment only and i have deleted the old build.


Also i tired with the same sandbox account that i used to create an incomplete transaction by not finishing the transaction.

I am experiencing the same issue. If user updates iOS and doesn't fill credit card details hitting restore doesn't do anything. This only started to happen on iOS 9. Deleting the app, reinstalling etc doesn't solve the issue at all. What is the proper way to handle this?