How can I use in app purchase in iOS?
Generated on 1/20/2025
3 searches
To use in-app purchases in iOS, you should leverage StoreKit, which is the framework provided by Apple for implementing in-app purchases. Here are some key points and updates from the WWDC sessions:
-
StoreKit 2: Starting with iOS 18, the original API for in-app purchases is deprecated. It's recommended to update your app to use StoreKit 2, which offers improvements such as automatic cryptographic validation, access to customer transaction history, and modern language features like Swift's async/await pattern. StoreKit 2 also supports back deployment, allowing you to access new features even on older OS versions. For more details, you can refer to the session What’s new in StoreKit and In-App Purchase (21:06).
-
Testing: You can test in-app purchase flows using Xcode's transaction manager. This includes testing purchase intents and billing issue messages directly in your app. For more information on testing, see the session What’s new in StoreKit and In-App Purchase (15:35).
-
App Store Server APIs: These APIs allow you to manage transactions from your server, including querying transaction history and handling refunds. This can enhance your app's in-app purchase capabilities beyond what is possible with on-device code alone. For more on this, check out the session Explore App Store server APIs for In-App Purchase (0:07).
By using these tools and updates, you can provide a robust in-app purchase experience in your iOS app.

What’s new in StoreKit and In-App Purchase
Learn how to build and deliver even better purchase experiences using the App Store In-App Purchase system. We’ll demo new StoreKit views control styles and new APIs to improve your subscription customization, discuss new fields for transaction-level information, and explore new testability in Xcode. We’ll also review an important StoreKit deprecation.

Implement App Store Offers
Learn how to engage customers with App Store Offers using App Store Connect, as well as the latest StoreKit features and APIs. Discover how you can set up win-back offers (a new way to re-engage previous subscribers) and generate offer codes for Mac apps. And find out how to test offers in sandbox and Xcode to make sure they work smoothly.

Explore App Store server APIs for In-App Purchase
Learn how to leverage your server to build great In-App Purchase experiences with the latest updates to the App Store Server API, App Store Server Notifications, and the open source App Store Server Library. After a recap of current APIs, we’ll introduce updated endpoint functionality, new transaction fields, and a new notification type. We’ll also discuss best practices for the purchase lifecycle, delivering content, and targeting offers, so you can become a server power user.