In-App Purchase failing in iOS 9 after payment update

We have had many users reporting that they have paid for our product via in-app purchase but we have failed to unlock the content. The common denominator between these reports is iOS 9. We have offered IAP for years and haven't experienced this issue until now.


We have found that the issue occurs when the customer is prompted to update their App Store payment information during the IAP process. This takes them out of our app. Then upon returning, the content is still locked. I was also able to replicate this by purchasing our product with a store build.


The Apple staff member in this related forum https://forums.developer.apple.com/thread/6431 indicates that the transaction will move to the a SKPaymentTransactionStateFailed when the user is directed out of the app to update their payment information. After updating their information, a SKPaymentTransactionStatePurchased is received. That forum suggests that finishTransaction should be called on the failed transaction. Then, finishTransaction should be called again after SKPaymentTransactionStatePurchased is received and the content is unlocked. This is what we have been doing for a long time but this doesn't appear to be working with iOS 9. It seems that we are only getting a call for the change to SKPaymentTransactionStateFailed but not for a subsequent SKPaymentTransactionStatePurchased. I can't guaruntee that we are not getting the state SKPaymentTransactionStatePurchased call as we can't use the debugger with our store builds but our code is simple enough to say this is very likely


Here is a simplified version of our code:


- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions{
  for (SKPaymentTransaction *transaction in transactions)
    {
        switch (transaction.transactionState)
        {
            case SKPaymentTransactionStatePurchasing:
                break;
            case SKPaymentTransactionStatePurchased:
                [self completeTransaction:transaction];
               [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
                break;
            case SKPaymentTransactionStateFailed:
                [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
                break;
            case SKPaymentTransactionStateRestored:
            default:
                break;
        }
    }
}


We would like to know if others are experiencing IAP issue with iOS 9? Also, is it correct to call finishTransaction after SKPaymentTransactionStateFailed? If we do, will we still receive another delegate call for SKPaymentTransactionStatePurchased?


Any help that can be offered would be appreciated.


Bill

Thank you for the update! It seems the problem is gone. After 2017/Jan/13, there is no user complain to us.......

This problem still exists, we can receive complaints from players every day. About 0.002 probability.

Players have charged,but the log show error SKErrorPaymentCancelled or SKErrorUnknown.

If you can replicate this problem, please submit a bug report as per the instructions I described earlier in the post.


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions

{

for (SKPaymentTransaction *transaction in transactions)

{

switch (transaction.transactionState)

{

case SKPaymentTransactionStatePurchasing: // 0

break;

case SKPaymentTransactionStatePurchased: // 1

[self _completeTransaction:transaction];

break;

case SKPaymentTransactionStateFailed: // 2

[self _failedTransaction:transaction];

break;

case SKPaymentTransactionStateRestored: // 3

[self _restoreTransaction:transaction];

break;

default:



break;

}

}

}



transaction.error.code == 2037 (what's the reason?)

transaction.error.code == -2 (what's the reason?)



We received the code which was 2037 or -2 through the log.

We cann't find any illustration about the codes by Apple guide.

Anyone having this error again?


All the IAP process works well in Sandbox enviroment but in Production no.

When I click to subscribe all the charge process proceed but the purchased items aren't unblocked.


I think that the StoreKit aren't calling the paymentQueue: updatedTransactions method and then I can't know the purchase state.

When I click second time in the subscribe button I have the message that I am subscribing the item and then my items are unblocked, that is the paymentQueue: updatedTransactions was called and then I get the IAP state.


I have the code to unblock my items inside the SKPaymentTransactionStatePurchased and SKPaymentTransactionStateRestored cases.

Yes, I got this error from last Friday, I still have to check with more users, but it seems to be happening in iOS 10.2.1

Today I tested the purchase again and works! Maybe there is a big delay between the app release and the IAP be ok . Apple's bug.

I'm getting an error in sandbox, when the user purchases the IAP (but has previously bought it), it shows an alert saying 'You have already purchased this, it will be downloaded again for free.'. But then my updatedTransactions doesn't get called at all, so I can't tell if they've actually bought it.

If the user taps "yes" to that UIAlert then there should be a call to updatedTransactions. Are you sure you have added a transaction observer?

The bug is back again...
every year happens...

Did you just renew your Apple Developer membership. If you did, then did you update the paid app contract? The paid app contract must be signed by both the developer and Apple to be in effect. If not, then the SKProductsRequest will fail making it seem like in-app purchases no longer work.


rich kubota - rkubota@apple.com


developer technical support CoreOS/Hardware/MFI

Thank you for your reply!

My problem like this:

We have found that the issue occurs when the customer is prompted to update their App Store payment information during the IAP process. This takes them out of our app,and they paid the iap. When they return to our app,only received SKPaymentTransactionStateFailed.

This problem hanppens ervery year.
I suggest when the customer finished update their payment information,let the customer return to app.Don't let the customer buy iap out of the app.

The normal response when a purchaser of an IAP has to update their credit card information is:


1) if the user choses to not update their credit card information then updatedTransactions receives a failed transaction

2) if the user choses to update their credit card informtaion and then choses not to go forward with the purchase then updatedTransactions receives a failed transaction

3) if the user choses to update their credit card information and then choses to go forward with the IAP then updated transactions receives two transactions in rapid succession; a failed transaction followed quickly therefater with a purchased transaction.


If you are saying that in your case #3 occurred but updatedTransactions received only a failed transaction then that is a bug in the system.


If you are saying your code turns off the transactionObserver after receiving a failed transaction then you need to
1) fix your code and

2) get the user to do something to add a transaction observer and receive the tarnsaction that is waiting in the queue for them.

thank you very much

In-App Purchase failing in iOS 9 after payment update
 
 
Q