Mac Developer Library

Developer

StoreKit Framework Reference SKPaymentTransaction Class Reference

Options
Deployment Target:

On This Page
Language:

SKPaymentTransaction

The SKPaymentTransaction class defines objects residing in the payment queue. A payment transaction is created whenever a payment is added to the payment queue. Transactions are delivered to your application when the App Store has finished processing the payment. Completed transactions provide a receipt and transaction identifier that your application can use to save a permanent record of the processed payment.

Inheritance


Conforms To


Import Statement


import StoreKit @import StoreKit;

Availability


Available in OS X v10.7 and later.
  • downloads downloads Property

    An array of download objects representing the downloadable content associated with the transaction. (read-only)

    Declaration

    Swift

    var downloads: [AnyObject]! { get }

    Objective-C

    @property(readonly) NSArray *downloads

    Discussion

    The contents of this property are undefined except when transactionState is set to SKPaymentTransactionStatePurchased. The SKDownload objects stored in this property must be used to download the transaction’s content before the transaction is finished. After the transaction is finished, the download objects are no longer queueable.

    Import Statement

    import StoreKit

    Availability

    Available in OS X v10.8 and later.

  • The transaction that was restored by the App Store. (read-only)

    Declaration

    Swift

    var originalTransaction: SKPaymentTransaction! { get }

    Objective-C

    @property(readonly) SKPaymentTransaction *originalTransaction

    Discussion

    The contents of this property are undefined except when transactionState is set to SKPaymentTransactionStateRestored. When a transaction is restored, the current transaction holds a new transaction identifier, receipt, and so on. Your application will read this property to retrieve the restored transaction.

    Import Statement

    import StoreKit

    Availability

    Available in OS X v10.7 and later.

  • The state of a transaction.

    Declaration

    Swift

    typealias SKPaymentTransactionState = Int

    Objective-C

    enum { SKPaymentTransactionStatePurchasing, SKPaymentTransactionStatePurchased, SKPaymentTransactionStateFailed, SKPaymentTransactionStateRestored, SKPaymentTransactionStateDeferred, }; typedef NSInteger SKPaymentTransactionState;

    Constants

    • SKPaymentTransactionStatePurchasing

      SKPaymentTransactionStatePurchasing

      The transaction is being processed by the App Store.

      Available in OS X v10.7 and later.

    • SKPaymentTransactionStatePurchased

      SKPaymentTransactionStatePurchased

      The App Store successfully processed payment. Your application should provide the content the user purchased.

      Available in OS X v10.7 and later.

    • SKPaymentTransactionStateFailed

      SKPaymentTransactionStateFailed

      The transaction failed. Check the error property to determine what happened.

      Available in OS X v10.7 and later.

    • SKPaymentTransactionStateRestored

      SKPaymentTransactionStateRestored

      This transaction restores content previously purchased by the user. Read the originalTransaction property to obtain information about the original purchase.

      Available in OS X v10.7 and later.

    • SKPaymentTransactionStateDeferred

      SKPaymentTransactionStateDeferred

      The transaction is in the queue, but its final status is pending external action such as Ask to Buy. Update your UI to show the deferred state, and wait for another callback that indicates the final status.

      Available in OS X v10.10 and later.

    Import Statement

    import StoreKit

    Availability

    Available in OS X v10.7 and later.