Protocol

SKPaymentTransactionObserver

A set of methods that process transactions, unlock purchased functionality, and continue promoted in-app purchases.

Overview

The methods in this protocol are implemented by observers of an SKPaymentQueue object.

An observer is called when transactions are updated by the queue or removed from the queue. An observer should process all successful transactions, unlock the functionality purchased by the user, and then finish the transaction by calling the payment queue’s finishTransaction(_:) method.

Topics

Handling Transactions

func paymentQueue(SKPaymentQueue, updatedTransactions: [SKPaymentTransaction])

Tells an observer that one or more transactions have been updated.

Required.

func paymentQueue(SKPaymentQueue, removedTransactions: [SKPaymentTransaction])

Tells an observer that one or more transactions have been removed from the queue.

Handling Restored Transactions

func paymentQueue(SKPaymentQueue, restoreCompletedTransactionsFailedWithError: Error)

Tells the observer that an error occurred while restoring transactions.

func paymentQueueRestoreCompletedTransactionsFinished(SKPaymentQueue)

Tells the observer that the payment queue has finished sending restored transactions.

Handling Download Actions

func paymentQueue(SKPaymentQueue, updatedDownloads: [SKDownload])

Tells the observer that the payment queue has updated one or more download objects.

Handling Purchases

func paymentQueue(SKPaymentQueue, shouldAddStorePayment: SKPayment, for: SKProduct) -> Bool

Tells the observer that a user initiated an in-app purchase from the App Store.

Relationships

Inherits From

See Also

First Steps

class SKPaymentQueue

A queue of payment transactions to be processed by the App Store.