SKPaymentTransaction Class Reference

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

Overview

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.

Tasks

Getting Information About the Transaction

Getting Information About the Transaction’s Downloadable Content

Restored Transactions

Properties

downloads

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

@property(nonatomic, 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.

Availability
  • Available in iOS 6.0 and later.
Declared In
SKPaymentTransaction.h

error

An object describing the error that occurred while processing the transaction. (read-only)

@property(nonatomic, readonly) NSError *error
Discussion

The error property is undefined except when transactionState is set to SKPaymentTransactionStateFailed. Your application can read the error property to determine why the transaction failed. For a list of error constants, see SKErrorDomain in Store Kit Constants Reference.

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

originalTransaction

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

@property(nonatomic, 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.

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

payment

The payment for the transaction. (read-only)

@property(nonatomic, readonly) SKPayment *payment
Discussion

Each payment transaction is created in response to a payment that your application added to the payment queue.

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

transactionDate

The date the transaction was added to the App Store’s payment queue. (read-only)

@property(nonatomic, readonly) NSDate *transactionDate
Discussion

The contents of this property are undefined except when transactionState is set to SKPaymentTransactionStatePurchased or SKPaymentTransactionStateRestored.

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

transactionIdentifier

A string that uniquely identifies a successful payment transaction. (read-only)

@property(nonatomic, readonly) NSString *transactionIdentifier
Discussion

The contents of this property are undefined except when transactionState is set to SKPaymentTransactionStatePurchased or SKPaymentTransactionStateRestored. The transactionIdentifier is a string that uniquely identifies the processed payment. Your application may wish to record this string as part of an audit trail for App Store purchases. See In-App Purchase Programming Guide for more information.

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

transactionState

The current state of the transaction. (read-only)

@property(nonatomic, readonly) SKPaymentTransactionState transactionState
Availability
  • Available in iOS 3.0 and later.
Declared In
SKPaymentTransaction.h

Constants

Payment Transaction States

The state of a transaction.

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

The transaction is being processed by the App Store.

Available in iOS 3.0 and later.

Declared in SKPaymentTransaction.h.

SKPaymentTransactionStatePurchased

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

Available in iOS 3.0 and later.

Declared in SKPaymentTransaction.h.

SKPaymentTransactionStateFailed

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

Available in iOS 3.0 and later.

Declared in SKPaymentTransaction.h.

SKPaymentTransactionStateRestored

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

Available in iOS 3.0 and later.

Declared in SKPaymentTransaction.h.