Instance Method

restoreCompletedTransactions()

Asks the payment queue to restore previously completed purchases.

Declaration

func restoreCompletedTransactions()

Discussion

Use this method to restore finished transactions—that is, transactions for which you have already called finishTransaction(_:). You call this method in one of the following situations:

  • To install purchases on additional devices

  • To restore purchases for an application that the user deleted and reinstalled

When you create a new product to be sold in your store, you choose whether that product can be restored or not. See the In-App Purchase Programming Guide for more information.

The payment queue delivers a new transaction for each previously completed transaction that can be restored. Each transaction includes a copy of the original transaction.

After the transactions are delivered, the payment queue calls the observer’s paymentQueueRestoreCompletedTransactionsFinished(_:) method. If an error occurred while restoring transactions, the observer will be notified through its paymentQueue(_:restoreCompletedTransactionsFailedWithError:) method.

This method has no effect in the following situations:

  • All transactions are unfinished.

  • The user did not purchase anything that is restorable.

  • You tried to restore items that are not restorable, such as a non-renewing subscription or a consumable product.

  • Your app's build version does not meet the guidelines for the CFBundleVersion key.

See Also

Restoring Purchases

func restoreCompletedTransactions(withApplicationUsername: String?)

Asks the payment queue to restore previously completed purchases, providing an opaque identifier for the user’s account.