2
votes

Here is the reproduce steps of issue:

  1. I tap the "purchase" button in my app.
  2. I enter the password of Apple ID.
  3. Apple show a dialog to confirm purchase or not. And I tap "Yes."
  4. Apple show a dialog to say that I have no payment information, need to complete it.
    (This moment I got a transaction with state SKPaymentTransactionStateFailed in updatedTransactions: function)
  5. I tap continue then jump to iTunes app and start to complete my credit card information.
  6. After complete the payment information , apple ask me to confirm purchase again.
  7. I tap "confirm" then the purchase is done.
    (Notice that it didn't come back to my app automatically.)

Here is my questions:

  1. Why this flow didn't invoke the callback function I wrote when transaction with state SKPaymentTransactionStatePurchased is coming?
  2. The last one, do I need to finish transaction when I receive transaction with state SKPaymentTransactionStateFailed?
1
I'm curious for the answer of your 3rd question. I've read on a tutorial that even if the transaction failed, it is very important to call finishTransaction, or StoreKit will not know you’ve finished processing it, and will continue delivering the transaction to your app each time it launches! If someone can confirm this... - zbMax
The reason why I ask the third question is that I didn't get any extra transaction back even when I complete the purchase. So I guess maybe I finished it when transaction failed, so it cannot continue to send other transactions afterward. - Chiakie

1 Answers

0
votes
  1. In my experience, if you're in the sandbox and are asked for credit card info, something is wrong. Could you try to log out of your App Store account before you build/run the app? That usually solves it for me. If that doesn't work, you might try deleting the app as well as logging out before running the app again. Are you making sandbox purchases with a test user created through iTunesConnect?

  2. According to SKPaymentTransactionObserver Protocol Reference, yes, you should call -finishTransaction: even for SKPaymentTransactionStateFailed. I do this in my own projects with no ill effects.