<!--
{
  "documentType" : "article",
  "framework" : "StoreKit",
  "identifier" : "/documentation/StoreKit/in-app-purchase",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Apple In-App Purchase"
}
-->

# Apple In-App Purchase

Offer content and services in your app across Apple platforms using a Swift-based interface.

## Discussion

With the Apple In-App Purchase API, you can offer customers the opportunity to purchase digital content and services in your app. Customers can make the purchases within your app, and find your promoted products on the App Store.

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, making the transactions for Apple In-App Purchases available to your app on all of the customer’s devices. For each transaction that represents a current purchase, your app delivers the purchased products. To validate purchases, you can verify transactions on your server, or rely on StoreKit’s verification.

![A diagram of the interactions between StoreKit, your app, the App Store, and your server that occur during a transaction.](images/com.apple.storekit/media-4447232@2x.png)

The App Store can also communicate with your server. It notifies your server of transactions and auto-renewable subscription events through <doc://com.apple.documentation/documentation/AppStoreServerNotifications>, and provides the same transaction information, and more, through the <doc://com.apple.documentation/documentation/AppStoreServerAPI>.

To learn how adding Apple In-App Purchases fits in an overall app development workflow for the App Store, see [App Store Pathway](https://developer.apple.com/app-store/pathway/). For an overview of Apple In-App Purchases and its features, including its configuration, testing capabilities, marketing for your products, and more, see [Simple and safe Apple In-App Purchases](https://developer.apple.com/in-app-purchase/). For an overview on subscriptions, including creating subscription groups, Family Sharing, and more, see [Auto-renewable subscriptions](https://developer.apple.com/app-store/subscriptions/).

### Configure Apple In-App Purchases

To use the Apple In-App Purchase API, you first need to configure the products that your app merchandises.

- In the early stages of development, you can configure the products in the StoreKit configuration file in Xcode, and test your code without any dependency on App Store Connect. For more information, see <doc://com.apple.documentation/documentation/Xcode/setting-up-storekit-testing-in-xcode>.
- When you’re ready for sandbox testing and production, configure the products in App Store Connect. You can add or remove products and refine or reconfigure existing products as you develop your app. For more information, see [Configure Apple In-App Purchase settings](https://developer.apple.com/help/app-store-connect/configure-in-app-purchase-settings/overview-for-configuring-in-app-purchases).

You can also offer apps and Apple In-App Purchases that run on multiple platforms as a single purchase. For more information on universal purchase, see [Add platforms](https://developer.apple.com/help/app-store-connect/create-an-app-record/add-platforms/).

### Support a store in your app

The Apple In-App Purchase API takes advantage of Swift features like concurrency to simplify your Apple In-App Purchase workflows, and SwiftUI to build stores with [StoreKit views](/documentation/StoreKit/storekit-views). Use the API to manage access to content and subscriptions, receive App Store-signed transaction information, get the history of all Apple In-App Purchase transactions, and more.

> Related sessions from WWDC21:
> Session 10114: [Meet StoreKit 2](https://developer.apple.com/videos/play/wwdc2021/10114/)

The Apple In-App Purchase API offers:

- Transaction information that’s App Store-signed in JSON Web Signature (JWS) format.
- Transaction and subscription status information that’s simple to parse in your app.
- An entitlements API, [`currentEntitlements`](/documentation/StoreKit/Transaction/currentEntitlements), that simplifies determining entitlements to unlock content and services for your customers.

> Related sessions from WWDC22:
> Session 110404: [Implement proactive Apple In-App Purchase restore](https://developer.apple.com/videos/play/wwdc2022/110404/)

To support a store in your app, implement the following functionality:

- Listen for transaction state changes using the transaction listener, [`updates`](/documentation/StoreKit/Transaction/updates), to provide up-to-date service and content while your app is running.
- Use [StoreKit views](/documentation/StoreKit/storekit-views) to merchandise your products; or request products to display from the App Store with [`products(for:)`](/documentation/StoreKit/Product/products(for:)) and enable purchases using [`purchase(options:)`](/documentation/StoreKit/Product/purchase(options:)). Unlock purchased content and services based on the purchase result, [`Product.PurchaseResult`](/documentation/StoreKit/Product/PurchaseResult).
- Iterate through a customer’s purchases anytime using the transaction sequence [`all`](/documentation/StoreKit/Transaction/all), and unlock the purchased content and services.
- Optionally, validate the signed transactions and signed subscription status information that you receive from the API.

## Topics

### Apple In-App Purchase merchandising

[StoreKit views](/documentation/StoreKit/storekit-views)

Display a customizable Apple In-App Purchase store using StoreKit views for SwiftUI.

### Product and subscription information

[Implementing a store in your app using the StoreKit API](/documentation/StoreKit/implementing-a-store-in-your-app-using-the-storekit-api)

Offer Apple In-App Purchases and manage entitlements using signed transactions and status information.

[Supporting monthly subscriptions with a 12-month commitment](/documentation/StoreKit/supporting-monthly-subscriptions-with-a-12-month-commitment)

Configure, merchandise, and grant access to a monthly subscription with a 12-month commitment.

[Managing the life cycle of monthly subscriptions with a 12-month commitment](/documentation/StoreKit/managing-lifecycle-of-monthly-subscriptions-with-a-12-month-commitment-)

Handle renewals, cancellations, billing issues, refund requests, and price changes, and test subscriptions with a commitment plan.

[`struct Product`](/documentation/StoreKit/Product)

Information about a product that you configure in App Store Connect.

[`struct SubscriptionInfo`](/documentation/StoreKit/Product/SubscriptionInfo)

Information about an auto-renewable subscription, such as its status, period, subscription group, and subscription offer details.

[`typealias SubscriptionInfo`](/documentation/StoreKit/SubscriptionInfo)

Information about an auto-renewable subscription.

[`typealias SubscriptionStatus`](/documentation/StoreKit/SubscriptionStatus)

Represents the renewal status information for an auto-renewable subscription.

### Purchase requests and results

[`struct PurchaseAction`](/documentation/StoreKit/PurchaseAction)

An action that starts an Apple In-App Purchase.

[`func purchase(options: Set<Product.PurchaseOption>) async throws -> Product.PurchaseResult`](/documentation/StoreKit/Product/purchase(options:))

Initiates a purchase for the product with the App Store and displays the confirmation sheet.

[`enum PurchaseResult`](/documentation/StoreKit/Product/PurchaseResult)

The result of a purchase.

### Transaction history and entitlements

[`struct Transaction`](/documentation/StoreKit/Transaction)

Information that represents the customer’s purchase of a product in your app.

[`static var updates: Transaction.Transactions`](/documentation/StoreKit/Transaction/updates)

The asynchronous sequence that emits a transaction when the system creates or updates transactions that occur outside the app or on other devices.

[`static var all: Transaction.Transactions`](/documentation/StoreKit/Transaction/all)

A sequence that emits all the customer’s transactions for your app.

[`static var currentEntitlements: Transaction.Transactions`](/documentation/StoreKit/Transaction/currentEntitlements)

A sequence of the latest transactions that entitle a customer to Apple In-App Purchases and subscriptions.

### JWS verification

[`enum VerificationResult`](/documentation/StoreKit/VerificationResult)

A type that describes the result of a StoreKit verification.

[`enum VerificationError`](/documentation/StoreKit/VerificationResult/VerificationError)

Error cases for StoreKit JWS verification.

### Subscription status and renewal information

[`struct Status`](/documentation/StoreKit/Product/SubscriptionInfo/Status-swift.struct)

The renewal status information for an auto-renewable subscription.

[`struct RenewalInfo`](/documentation/StoreKit/Product/SubscriptionInfo/RenewalInfo)

The renewal information for an auto-renewable subscription.

[`typealias SubscriptionRenewalInfo`](/documentation/StoreKit/SubscriptionRenewalInfo)

Represents the renewal information for an auto-renewable subscription.

[`struct RenewalState`](/documentation/StoreKit/Product/SubscriptionInfo/RenewalState)

The renewal states of auto-renewable subscriptions.

[`typealias SubscriptionRenewalState`](/documentation/StoreKit/SubscriptionRenewalState)

The renewal states of auto-renewable subscriptions.

[`typealias SubscriptionPeriod`](/documentation/StoreKit/SubscriptionPeriod)

Represents the duration of time between subscription renewals.

### Offers

[Supporting offer codes in your app](/documentation/StoreKit/supporting-offer-codes-in-your-app)

Enable customers to redeem offer codes through the App Store or within your app.

[Supporting win-back offers in your app](/documentation/StoreKit/supporting-win-back-offers-in-your-app)

Re-engage previous subscribers with a free or discounted offer for an auto-renewable subscription, for a specific duration.

[Merchandising win-back offers in your app](/documentation/StoreKit/merchandising-win-back-offers-in-your-app)

Present win-back offers to eligible customers in your app with the win-back offer sheet or by implementing custom merchandising.

[`struct SubscriptionOffer`](/documentation/StoreKit/Product/SubscriptionOffer)

Information about a subscription offer that you configure in App Store Connect.

[`struct OfferType`](/documentation/StoreKit/Product/SubscriptionOffer/OfferType)

The types of offers for auto-renewable subscriptions.

### Promoted Apple In-App Purchases

[Supporting promoted Apple In-App Purchases in your app](/documentation/StoreKit/supporting-promoted-in-app-purchases-in-your-app)

Display promoted Apple In-App Purchases on your product page and handle purchases that users initiate on the App Store.

[`struct PurchaseIntent`](/documentation/StoreKit/PurchaseIntent)

An instance that emits purchase intents, which indicate that the customer initiated a purchase outside of your app, for your app to complete.

[`struct PromotionInfo`](/documentation/StoreKit/Product/PromotionInfo)

Information about a promoted Apple In-App Purchase that customizes its order and visibility on the device.

[Testing promoted Apple In-App Purchases](/documentation/StoreKit/testing-promoted-in-app-purchases)

Test your Apple In-App Purchases before making your app available in the App Store.

### App Store interactions

[`enum AppStore`](/documentation/StoreKit/AppStore)

Interactions with the App Store, such as managing subscriptions, verifying devices, authorizing payments, synchronizing transactions, getting the environment, and more.

[`struct AppTransaction`](/documentation/StoreKit/AppTransaction)

Information that represents the customer’s purchase of the app, cryptographically signed by the App Store.

### Storefront information

[`struct Storefront`](/documentation/StoreKit/Storefront)

The region and unique identifier of the App Store storefront for the device.

[`static var current: Storefront?`](/documentation/StoreKit/Storefront/current)

The current App Store storefront for product purchases.

[`static var updates: Storefront.Storefronts`](/documentation/StoreKit/Storefront/updates)

The asynchronous sequence that emits storefront information when the system updates the storefront.

### Apple In-App Purchase Testing

[Testing at all stages of development with Xcode and the sandbox](/documentation/StoreKit/testing-at-all-stages-of-development-with-xcode-and-the-sandbox)

Verify your implementation of Apple In-App Purchases by testing your code throughout its development.

[Testing Apple In-App Purchases with sandbox](/documentation/StoreKit/testing-in-app-purchases-with-sandbox)

Test your implementation of Apple In-App Purchases using real product information and server-to-server transactions in the sandbox environment.

[Testing refund requests](/documentation/StoreKit/testing-refund-requests)

Test your app’s implementation of refund requests, and your app’s and server’s handling of approved and declined refunds.

[Testing win-back offers in Xcode](/documentation/StoreKit/testing-win-back-offers-in-xcode)

Validate your app’s handling of win-back offers that you configure for the testing environment.

[Testing Ask to Buy in Xcode](/documentation/StoreKit/testing-ask-to-buy-in-xcode)

Validate your app’s handling of Ask To Buy in the testing environment.

### Advanced Commerce API interactions

[`struct AdvancedCommerceProduct`](/documentation/StoreKit/AdvancedCommerceProduct)

A product configured as a generic SKU in App Store Connect for use with the Advanced Commerce API.

[Sending Advanced Commerce API requests from your app](/documentation/StoreKit/sending-advanced-commerce-api-requests-from-your-app)

Send Advanced Commerce API requests from your app that you authorize with a JSON Web Signature (JWS) you generate on your server.

[Generating JWS to sign App Store requests](/documentation/StoreKit/generating-jws-to-sign-app-store-requests)

Create signed JSON Web Signature (JWS) strings on your server to authorize your API requests in your app.

### Errors

[`enum StoreKitError`](/documentation/StoreKit/StoreKitError)

StoreKit Apple In-App Purchase error codes.

### Deprecated

[Choosing a StoreKit API for Apple In-App Purchases](/documentation/StoreKit/choosing-a-storekit-api-for-in-app-purchases)

Use the latest API to support Apple In-App Purchases in new or existing apps, or the original API to support Apple In-App Purchases in earlier operating systems.

[Original API for Apple In-App Purchase](/documentation/StoreKit/original-api-for-in-app-purchase)

Offer additional content and services in your app using the Original Apple In-App Purchase API.

### Macros

[Macros](/documentation/StoreKit/macros)



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)