Notifies the App Store that the app finished processing the transaction.
- iOS 3.0+
- macOS 10.7+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 6.2+
The transaction to finish.
Transactions on the payment queue are persistent until they are completed. StoreKit calls your observer’s
payment method every time your app launches or resumes from background to tell you about transactions in the queue. After you've finished processing a transaction in your app, always call the
finish method to finish the transaction and remove it from the queue.
finish only after the app has finished all work it performs to complete the transaction. The transaction's state determines which steps you might take:
For a failed transaction (
SKPayment), update your user interface, track information in analytics, and perform other similar tasks.
Transaction State Failed
For a successful transaction (
Transaction State Purchased
SKPayment), perform all necessary actions to unlock the functionality the user has purchased before finishing the transaction. For example, if you are downloading content, finish the transaction only after the downloads are complete.
Transaction State Restored
If you validate receipts, validate them before completing the transaction, and take one of the paths described above.
In rare circumstances, this call might fail, and you'll receive updates for that transaction again. For this reason, you should record information in your app about the transactions it has processed and which steps the app has already completed. That way, you don't repeat steps that shouldn't be performed multiple times. For example, if you are processing a consumable transaction, you only want to add the consumable benefit once.
If you call
finish on a transaction that is in the
SKPayment state, StoreKit raises an exception.