Embed a store in your app. Process financial transactions associated with the purchase of content and services.


The StoreKit framework provides classes that let your app request payment from a user for additional functionality or content that it delivers.

Handling Errors

A StoreKit request may fail for one of many possible reasons, including invalid product information, invalid payment details, problems with your iTunes Connect account, or networking issues. When handling errors, such as with the request(_:didFailWithError:) delegate method, it is therefore important to use the domain and code of the resulting error to determine the underlying cause of failure.

The SKErrorDomain error domain is used for errors related to payments, store products, and cloud services, as described in SKError.Code. For additional information for troubleshooting StoreKit framework issues, see the In-App Purchase FAQ.

The NSURLErrorDomain error domain is used for errors related to networking. The following table describes some of the most common networking errors that may occur when using StoreKit.

Table 1

Common NSURLErrorDomain errors when using StoreKit

Error code


NSURLErrorTimedOut (-1001)

The connection timed out.

NSURLErrorCannotFindHost (-1003)

The connection failed because the host could not be found.

NSURLErrorCannotConnectToHost (-1004)

The connection failed because a connection cannot be made to the host.

NSURLErrorNetworkConnectionLost (-1005)

The connection failed because the network connection was lost.

NSURLErrorNotConnectedToInternet (-1009)

The connection failed because the device is not connected to the internet.

NSURLErrorUserCancelledAuthentication (-1012)

The connection failed because the user cancelled required authentication.

NSURLErrorSecureConnectionFailed (-1200)

The secure connection failed for an unknown reason.



class SKCloudServiceController

An object that determines the current capabilities of the user’s music library.

class SKCloudServiceSetupViewController

A view controller that helps users perform setup for a cloud service, such as an Apple Music subscription.

class SKDownload

A SKDownload object represents downloadable content associated with a product. When you create a product in iTunes Connect, you can associate one or more pieces of downloadable content with it. Then, at runtime, when a product is purchased by a user, your app uses SKDownload objects to download the content from the App Store.

class SKMutablePayment

The SKMutablePayment class defines a request to the Apple App Store to process payment for additional functionality offered by your application. A payment encapsulates a string that identifies a particular product and the quantity of that item the user would like to purchase.

class SKPayment

The SKPayment class defines a request to the Apple App Store to process payment for additional functionality offered by your application. A payment encapsulates a string that identifies a particular product and the quantity of those items the user would like to purchase.

class SKPaymentQueue

The SKPaymentQueue class provides a queue of payment transactions to be processed by the App Store. The payment queue communicates with the App Store and presents a user interface so that the user can authorize payment. The contents of the queue are persistent between launches of your app.

class 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.

class SKProduct

SKProduct objects are returned as part of an SKProductsResponse object. Each product object provides information about a product you previously registered in iTunes Connect.

class SKProductsRequest

An SKProductsRequest object is used to retrieve localized information about a list of products from the Apple App Store. Your application uses this request to present localized prices and other information to the user without having to maintain that list itself.

class SKProductsResponse

An SKProductsResponse object is returned by the Apple App Store in response to a request for information about a list of products.

class SKReceiptRefreshRequest

The SKReceiptRefreshRequest class allows an app to refresh its receipt. With this API, the app can request a new receipt if the receipt is invalid or missing. In the sandbox environment, you can request a receipt with any combination of properties to test the state transitions related to Volume Purchase Plan receipts.

class SKRequest

SKRequest is an abstract class representing a request to the Apple App Store. Subclasses of SKRequest represent different kinds of requests.

class SKStoreProductViewController

A SKStoreProductViewController object presents a store that allows the user to purchase other media from the App Store. For example, your app might display the store to allow the user to purchase another app.

class SKStoreReviewController

Controls the process of requesting App Store ratings and reviews from users.


protocol SKCloudServiceSetupViewControllerDelegate

A protocol that defines the methods a cloud service setup view controller can use to get information about the status of a setup view.

protocol SKPaymentTransactionObserver

A set of methods that are implemented by observers of an SKPaymentQueue object.

protocol SKProductsRequestDelegate

The SKProductsRequestDelegate protocol declares methods that are implemented by the delegate of an SKProductsRequest object. The delegate receives the product information that the request was interested in.

protocol SKRequestDelegate

The SKRequestDelegate protocol declares common methods that are implemented by delegates for any subclass of the SKRequest abstract class.

protocol SKStoreProductViewControllerDelegate

An object implementing the SKStoreProductViewControllerDelegate protocol is called when the user dismisses the store screen. Typically, this protocol is implemented by the view controller in your application that originally displayed the store screen.


struct SKCloudServiceCapability

Constants that specify the current capabilities of the user’s music library on the device.

struct SKCloudServiceSetupAction

A string used to specify the type of setup action to offer for a cloud service.

struct SKCloudServiceSetupOptionsKey

A key used to specify the type of setup option for a cloud service.


StoreKit Constants

This document describes the constants defined in the StoreKit framework and not described in a document for an individual class.

See Also

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software