In-App Purchase

Offer users additional content and services through purchases made within your app.

Overview

In-App Purchase allows you to offer users the opportunity to purchase in-app content and features. Purchases can be made within your app, or directly from the App Store if you choose to promote the products there.

The StoreKit framework connects to the App Store on your app’s behalf to prompt for and securely process payments. The framework then notifies your app, which delivers the purchased products. To validate purchases, you can verify receipts on your server with the App Store or on the device. For auto-renewable subscriptions, the App Store can also notify your server of key subscription events.

A diagram of the interactions between StoreKit, your app, the App Store, and your server that occur during a transaction.

To use In-App Purchase, you must first configure the products you wish to offer users in App Store Connect. As you develop your app, you can add or remove products and refine or reconfigure your existing products.

Understand Product Types

Product types let you use In-App Purchase across a range of business models within your app by providing several different product behaviors. There are four In-App Purchase types you can offer:

  • Consumables are used once and depleted, and can be purchased multiple times.

  • Non-consumables are purchased once and do not expire.

  • Auto-renewable subscriptions to services or content are purchased once and renew automatically on a recurring basis until users decide to cancel.

  • Non-renewing subscriptions to services or content provide access over a limited duration, do not renew automatically, and can be purchased again.

Non-consumables and auto-renewable subscriptions can be synced and restored across devices using StoreKit. When a user purchases an auto-renewable or non-renewing subscription, your app is responsible for making it available across all the user's devices, and for enabling users to restore past purchases.

Topics

Essentials

Setting Up the Transaction Observer for the Payment Queue

Enable your app to receive and handle transactions by adding an observer.

Offering, Completing, and Restoring In-App Purchases

Fetch, complete, and restore transactions in your app.

SKPaymentQueue

A queue of payment transactions to be processed by the App Store.

SKPaymentTransactionObserver

A set of methods that process transactions, unlock purchased functionality, and continue promoted in-app purchases.

SKPaymentQueueDelegate

The protocol implemented to provide information needed to complete transactions.

SKRequest

An abstract class that represents a request to the App Store.

Product Information

Loading In-App Product Identifiers

Load the unique identifiers for your in-app products in order to retrieve product information from the App Store.

Fetching Product Information from the App Store

Retrieve up-to-date information about the products for sale in your app to display to the user.

SKProductsRequest

An object that can retrieve localized information from the App Store about a specified list of products.

SKProductsResponse

An App Store response to a request for information about a list of products.

SKProduct

Information about a product previously registered in App Store Connect.

Storefronts

SKStorefront

An object containing the location and unique identifier of an Apple App Store storefront.

Purchases

Requesting a Payment from the App Store

Submit a payment request to the App Store when a user selects a product to buy.

Processing a Transaction

Register a transaction queue observer to get and handle transaction updates from the App Store.

SKPayment

A request to the App Store to process payment for additional functionality offered by your app.

SKMutablePayment

A mutable request to the App Store to process payment for additional functionality offered by your app.

SKPaymentTransaction

An object in the payment queue.

Purchase Validation

Choosing a Receipt Validation Technique

Select the type of receipt validation that works for your app.

Validating Receipts with the App Store

Verify transactions with the App Store on a secure server.

SKReceiptRefreshRequest

A request to refresh the receipt, which represents the user's transactions with your app.

Content Delivery

Unlocking Purchased Content

Deliver content to the user after validating the purchase.

SKDownload

Downloadable content associated with a product.

Providing Access to Previously Purchased Products

Restoring Purchased Products

Give users functionality that restores their purchases in your app, to maintain access to purchased content.

SKReceiptRefreshRequest

A request to refresh the receipt, which represents the user's transactions with your app.

SKRequest

An abstract class that represents a request to the App Store.

SKPaymentTransaction

An object in the payment queue.

SKTerminateForInvalidReceipt

Terminates an app if the license to use the app has expired.

Subscriptions

Subscriptions and Offers

Offer users additional time-based content and services through purchases made within your app.

Promotions

Promoting In-App Purchases

Show your in-app purchases on your app's product page.

Testing Promoted In-App Purchases

Test your in-app purchases before making your app available in the App Store.

SKProductStorePromotionController

A product promotion controller for customizing the order and visibility of in-app purchases per device.

Testing in the Sandbox

Testing In-App Purchase Transactions

Verify that you have implemented in-app purchases correctly by testing your code in the sandbox environment.