iOS Reference Library Apple Developer
Search

SKPaymentTransactionObserver Protocol Reference

Conforms to
Framework
/System/Library/Frameworks/StoreKit.framework
Availability
Available in iOS 3.0 and later.
Companion guide
Declared in
SKPaymentQueue.h

Overview

The SKPaymentTransactionObserver protocol declares methods that 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.

Tasks

Handling Transactions

Handling Restored Transactions

Instance Methods

paymentQueue:removedTransactions:

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

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

Parameters
queue

The payment queue that updated the transactions.

transactions

An array of the transactions that were removed.

Discussion

Your application does not typically need to implement this method but might implement it to update its own user interface to reflect that a transaction has been completed.

Availability
  • Available in iOS 3.0 and later.
Declared In
SKPaymentQueue.h

paymentQueue:restoreCompletedTransactionsFailedWithError:

Tells the observer that an error occurred while restoring transactions.

- (void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error

Parameters
queue

The payment queue that was restoring transactions.

error

The error that occurred.

Availability
  • Available in iOS 3.0 and later.
Declared In
SKPaymentQueue.h

paymentQueue:updatedTransactions:

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

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

Parameters
queue

The payment queue that updated the transactions.

transactions

An array of the transactions that were updated.

Discussion

The application should process each transaction by examining the transaction’s transactionState property. If transactionState is SKPaymentTransactionStatePurchased, payment was successfully received for the desired functionality. The application should make the functionality available to the user. If transactionState is SKPaymentTransactionStateFailed, the application can read the transaction’s error property to return a meaningful error to the user.

Once a transaction is processed, it should be removed from the payment queue by calling the payment queue’s finishTransaction: method, passing the transaction as a parameter.

Important: Once the transaction is finished, Store Kit can not tell you that this item is already purchased. It is important that applications process the transaction completely before calling finishTransaction:.

Availability
  • Available in iOS 3.0 and later.
Declared In
SKPaymentQueue.h

paymentQueueRestoreCompletedTransactionsFinished:

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

- (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue

Parameters
queue

The payment queue that restored the transactions.

Discussion

This method is called after all restorable transactions have been processed by the payment queue. Your application is not required to do anything in this method.

Availability
  • Available in iOS 3.0 and later.
Declared In
SKPaymentQueue.h



Last updated: 2010-01-20

Did this document help you? Yes It's good, but... Not helpful...