Search code examples
iosxamarin.iosstorekit

SKPaymentQueue: What happens if I never call finishTransaction:?


My app will allow the user upgrade to Pro features via an In-App Purchase. I am validating the receipt data with my own server, and one the confirmation comes back from my server, I call finishTransaction:

What will happen if the validation fails (perhaps not due to piracy attempt) and I dont call finishTransaction: ? Will it stay in the queue indefinitely?


Solution

  • I always found that I got strange behavior afterward at some point, if FinishTransaction wasn't called.

    The best option is to set a setting in StandardUserDefaults, etc. indicating "I bought this but it failed", and call FinishTransaction. Then when they restart the app (or foreground the app) you could check for this and send it to your server.

    Also, if your purchase is not a consumable (i.e not buying coins or money), you can just call FinishTransaction and tell the user to activate RestoreTransaction from a button in your settings menu. This button is required by Apple for non-consumable purchases anyway.