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

SKPaymentQueueDelegate

The protocol implemented to provide information needed to complete transactions.

Beta
SKPaymentTransactionObserver

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

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

SKProduct

Information about a product previously registered in App Store Connect.

SKProductsResponse

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

SKProductSubscriptionPeriod

An object containing the subscription period duration information.

SKProductDiscount

The details of a discount offer for a subscription product.

Retrieving Storefront Information

SKStorefront

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

Beta

Initiating a Purchase

Requesting a Payment from the App Store

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

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.

SKPaymentDiscount

The signed discount applied to a payment.

SKPaymentQueue

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

Validating Purchases

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.

Delivering Content

Processing a Transaction

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

SKDownload

Downloadable content associated with a product.

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.

Restoring Purchased Products

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.

Working with Subscriptions

Handling Subscriptions Billing

Build logic around the date and time constraints of subscription products while planning for all scenarios where you should control access to content.

Enabling Server-to-Server Notifications

Use server notifications from the App Store to monitor and respond to users' subscription status changes.

Offering a Subscription Across Multiple Apps

Support a single auto-renewable subscription across multiple apps.

Promoting In-App Purchases

SKProductStorePromotionController

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

Testing Promoted In-App Purchases

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

Providing Introductory Offers

Implementing Introductory Offers in Your App

Offer introductory pricing for auto-renewable subscriptions to eligible users.

Testing Introductory Offers

Test your introductory pricing in a variety of user scenarios.

SKProductDiscount

The details of a discount offer for a subscription product.

Providing Subscription Offers

Setting Up Subscription Offers

Generate a key and configure offers for auto-renewable subscriptions in App Store Connect.

Implementing Subscription Offers in Your App

Offer discounted pricing for auto-renewable subscription products to eligible subscribers.

Generating a Signature for Subscription Offers

Create a signature to validate a subscription offer using your private key.

Generating a Subscription Offer Signature Using Node.js

Generate a signature using your private key and lightweight cryptography libraries.

SKPaymentDiscount

The signed discount applied to a payment.

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