Instance Method

finishTransaction:

Notifies the App Store that the app finished processing the transaction.

Declaration

- (void)finishTransaction:(SKPaymentTransaction *)transaction;

Parameters

transaction

The transaction to finish.

Discussion

Transactions on the payment queue are persistent until they are completed. StoreKit calls your observer’s paymentQueue:updatedTransactions: 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 finishTransaction: method to finish the transaction and remove it from the queue.

Call finishTransaction: only after the app has finished all work it performs to complete the transaction. The transaction's state determines which steps you might take:

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 finishTransaction: on a transaction that is in the SKPaymentTransactionStatePurchasing state, StoreKit raises an exception.

See Also

Managing Transactions

delegate

A delegate that provides information needed to complete transactions.

transactions

Returns an array of pending transactions.

- addPayment:

Adds a payment request to the queue.