What's new in StoreKit 2 and StoreKit Testing in Xcode
Description: Get to know the latest enhancements to StoreKit 2 and StoreKit Testing in Xcode. Discover API updates for promoted in-app purchases, StoreKit messages, the Transaction model, the RenewalInfo model, and the App Store sheet for managing subscriptions. Learn how to upgrade to SHA-256 for on-device receipt validation and use APIs to create SwiftUI views. We'll also help you get started with StoreKit Testing in Xcode so that you can debug and test your in-app purchases and subscriptions. Meet the Transaction Inspector, explore the latest updates to the StoreKit configuration editor, and find out how you can simulate StoreKit errors to test your app's error handling.
API Updates
- Promoting of In App Purchases possible in Connect
- Receive promotion purchases with
PurchaseIntent.intents
- Need to call
.purchase
after checking.canProcessPurchase
- You can chang eorder of promotions locally
- You can also change visibility in App Store
- New fields
.storefront
,.storeFrontCountryCode
, andreason
(customer purchase vs. recurring) field inTransaction
- New field
renewalDate
onRenewalInfo
- New fields above are back-deployed to iOS 15!
- New message reason "billingIssue" added in Messages API
- Signing receipts migrates from SHA1 to SHA256 starting June 20, migration complete by August 24
- If you're using StoreKit, nothing to do, StoreKit uses SHA256 already
Build SwiftUI apps
- New
ProductView
for showing exactly 1productID
(like non-consumable) - New
StoreView
for showing many ids in a list - New
SubsriptionStoreView
for showing all subsriptions in a subscription group in a list - Many customization options for these views
- Use `.manageSubscriptionSheet(isPresented:groupID:)
StoreKit Testing in Xcode
- Transaction manager shows all apps and devices now
- Open manager via "Debug" menu in Xcode
- Purchases can be created directly on the Mac in transaction manager via + button
- Lots of customizability when creating purchases, supoprts offers/promotions/reneweable or not/purchase date etc.
- No debug session required
- New "Configuration Settings" in StoreKit configuration file: Change Storefront/Localization, pass Options, simulate Failures
- Set also a "renewal rate" with from 15 minutes down to just 2 seconds
SKTestSession
with purchase APIs allows the same adjustments as listed above in unit tests via.setSimulatedError
,.timeRate
, etc.