WWDC23 and What’s New in StoreKit 2
Let’s have a quick look at the highlights from WWDC23 related to in-app purchases and subscriptions. There were new features announced to enable developers to create compelling paywalls, to enhance transaction management, and to streamline receipt validation processes.
New StoreKit 2 fields
Let’s explore the enhanced functionality of the Transaction and Renewal Info data models.
The Transaction model introduces a new field called storefront, which is accompanied by storefrontCountryCode. These fields provide information about what country a transaction occurred from. Additionally, a new field called reason is included in the Transaction model. It tells you whether the transaction was initiated by a customer or whether it represents an automatic subscription renewal.
There is a new field called nextRenewalDate introduced in the RenewalInfo model, specifically under Product.SubscriptionInfo. This field indicates the date when the subscription renewal will be processed.
These new fields are available for apps developed using Xcode 15. While they were initially released with iOS 17, most of them are compatible with previous versions of iOS that utilize StoreKit 2.
Deprecation of Verify Receipt
Apple is moving to more comprehensive cryptography from sha1 to sha256. If you’re validating your receipts on your server, make sure that you support this format.
According to Apple’s documentation, the verifyReceipt web service endpoint has been marked as deprecated, but it still works. However, consider moving to the new endpoints.
StoreKit 2 Message API: reason BillingIssue
Apple introduced the new message reason called “billingIssue”, and it is accessible from iOS 16.4 onwards. This message is triggered when a subscription fails to renew due to a billing problem. When this occurs, StoreKit presents a Billing Problem message within your app, allowing customers to address and resolve the issue without leaving the app.
Apple’s Native Paywalls with SubscriptionStoreView
There are new APIs which allow you to create SwiftUI views for individual in-app purchases, entire product stores, and even custom views tailored specifically for the specific subscription. This means that you can easily create your custom paywall with just a few lines of code. Use the collection of SwiftUI views called ProductView, StoreView, and SubscriptionStoreView.
Watch this session to see a how-to guide on creating an Apple Native Paywall.
New Swift API for Managing Promoted In-App Purchases
Apple introduced a new Swift API for managing promoted In-App Purchases. This feature empowers developers to merchandise their subscription products on their App Store product page. With promoted In-App Purchases, developers can highlight their subscription offerings and engage potential users right from the moment they discover the app.
When a customer selects and purchases a promoted product by tapping on the promoted in-app purchases, the App Store transmits the purchase data to your app. Within your app, you can listen for this information and prompt the customer to finalize the purchase.
To listen for promoted purchases, you can utilize the Swift async sequence, which allows your app to receive a new purchase intent each time a customer initiates a purchase for a promoted product within the App Store.
If your app is not prepared to finalize a purchase, you have the option to store the attempt locally and postpone its processing.
Local Order of Promoted In-App Purchases
You can personalize the local display of your products on the user’s device. For instance, once a customer purchases one of these products, you have the option to hide it, preventing it from appearing again in the App Store when they browse or search. Moreover, you have the flexibility to adjust the product order or highlight a specific subset of products based on the current state of your app. For instance, in the context of a game, you can modify the product display according to the player’s level of advancement.
Once you’ve imported StoreKit, you can utilize the Product.PromotionInfo.currentOrder method to check the current promotion order. This method returns a sequence of PromotionInfo objects that are currently set, arranged in their specific order. If this sequence is empty, it indicates that no local overrides have been set for the device, and the products displayed in the App Store follow the order you configured in App Store Connect. Each object within this sequence provides information about a promoted product in your app.
To establish a custom order for promotions, you can employ the Product.PromotionInfo.updateProductOrder API. By passing a list of product identifiers in the desired order, you can define how they appear in the App Store specifically for that device. It’s also possible to hide or show products individually without altering the entire order. This can be achieved by modifying the visibility property associated with the promoted in-app purchases.
The Visibility of Promoted In-App Purchases
The visibility state of promoted in-app purchases can be categorized as visible, hidden, or default. The visibility state follows the settings you configure in App Store Connect and is applicable to all devices that do not have a local override defined by your app. In other words, if you haven’t specified a custom visibility state for a particular device, it will adhere to the default visibility settings established in App Store Connect.
Alternatively, you have the option to modify the visibility value by assigning a member property to each PromotionInfo object. To apply these modifications, simply invoke the update() method on the corresponding object.
The announcements made at WWDC23 regarding StoreKit 2 for in-app purchases and subscriptions have opened up new opportunities for developers to manage in-app purchases and subscriptions, and enhance the user experience.
However, it’s worth noting that effectively implementing and managing subscriptions can still be a complex task. This is where subscription management tools like Qonversion come into play. Qonversion offers a comprehensive solution for developers, simplifying subscription management, analytics, A/B Experimentation, and more. By leveraging Qonversion’s robust features, you can streamline the implementation of in-app purchases and subscriptions, track key metrics, and gain insights into optimizing monetization strategies.