

There are two huge changes from the previous (original) version of StoreKit ( StoreKit1 hereafter): Receipt validation
What's changed from the original StoreKit? Testing purchases locally using StoreKit configuration files Handling canceled and failed transactionsĮxploring detailed transaction information and history for non-consumables and subscriptions Handling pending ("ask to buy") transactions where parental permission must be obtained before a purchase is completed How to purchase a product and validate the transaction Requesting localized product information from the App Store subscription (VIP plant home care: scheduled home visits to water and care for house plants)Ĭreating a StoreHelper that encapsulates StoreKit2 in-app purchase functionality and makes it easy to work with the App Store.non-consumable (cut flowers, potted plants, chocolates, etc.).consumable (VIP plant installation service: lasts for one day).How to create a multi-platform SwiftUI app that allows users to purchase a range of products, including: Specifically, in building the app we'll cover: The basic premise for the demo is that we're creating an app for an on-line florist that sells a range of flowers, chocolates and other related services like home visits to water and care for house plants. This SwiftUI app will demonstrate how to use Apple's new StoreKit2 framework to provide in-app purchases to your users. Purchasing Products - Designing the UI - Adding support to StoreHelper.Enable StoreKit Testing via the Project Scheme.What's changed from the original StoreKit?.However, you do so entirely at your own risk. You may freely reuse and amend this code for use in your own apps. The source code presented here is for educational purposes. See StoreHelperDemo on GitHub for source code.ĭisclaimer. Product.request(with:) is now Product.products(for:).Transaction.listener is now Transaction.updates.The use of detach in StoreHelper.handleTransactions() has been replaced with tached.The detach keyword for creating detached tasks has been deprecated.The return type for StoreHelper.handleTransactions() changed from Task.Handle to Task.The StoreHelper transaction listener now has a type of Task.The use of Task.Handle has been deprecated.VerificationError that is provided by StoreKit2 when the unwrapped transaction is unverified Modified StoreHelper.checkVerificationResult(result:) to return UnwrappedVerificationResult.See In-App Purchases with Xcode 12 and iOS 14 for details of working with the original StoreKit1 in iOS 14 and lower. This app requires StoreKit2, Swift 5.5, Xcode 13 and iOS 15.

Implementing and testing In-App Purchases with StoreKit2 in Xcode 13, Swift 5.5, iOS 15 and macOS 12. See also In-App Purchases with Xcode 12 and iOS 14 for details of working with the StoreKit1 in iOS 14 and lower. Implementing and testing In-App Purchases with StoreKit2 in Xcode 13, Swift 5.5, iOS 15.
