BlogRight arrowTrends & insightsRight ArrowWhat’s new with in-app purchases: WWDC 2022
BlogRight arrowTrends & insightsRight ArrowWhat’s new with in-app purchases: WWDC 2022

What’s new with in-app purchases: WWDC 2022

What’s new with in-app purchases: WWDC 2022
Listen to the episode
What’s new with in-app purchases: WWDC 2022

Another annual Apple WWDC is over, and Apple presented a lot of improvements across the board. Here are all the important updates to in-app purchases!

App Transaction API

App Transaction is a new API that replaces old receipts. Transaction presents verified information for a purchase of your app, and it’s signed using JWT. If you wish, you can also perform your own validation. StoreKit automatically updates the App Transaction, but it can be refreshed manually by providing UI to the user.

App Transaction has more uses than preventing fraud. You can use the new Transaction History component to look into the user's purchase history on the device. All this information is also available via App Store Server API.

One of the potential use cases of App Transaction is handling changes in the pricing model of your app. For example, your app was paid and then you introduced in-app purchases in v8.0, making the app free. You want to keep access to the paid features for all users who bought your app before v8.0.

With App Transaction, all you have to do is write this piece of code:

If you get an unverified transaction, you should present a UI to refresh the transaction and restore access.

If you get a verified transaction, you can easily extract all the necessary information from it and grant access to the users who bought your app before v8.0.

As you can see, App Transaction API is a new powerful tool that can simplify some edge cases.

New properties

There are also new properties in StoreKit models. They are available on all devices running iOS 15+, but you have to build your app with Xcode 14.

Price locale is a property for displaying derived numbers, like how much your annual subscription costs per month. It’s a great addition, simply because of how popular this kind of mechanic is on paywalls.

Environment property shows whether a transaction was processed in a production or a sandbox environment. This new property is useful to filter sandbox transactions.

Recent Subscription Start Date gives you the most recent period of the continuous subscription. Continuous means there was no more than 60 days gap between any two subscribed periods. This is useful to determine customer loyalty and award your users. But keep in mind, this property is not meant to be used to determine the total number of days your customer was subscribed.

The other important thing here is Sentinel Values. If you’re using StoreKit testing in Xcode and testing iOS 15, you’ll receive placeholder values for all new properties.

Here are the sentinel values you may receive:

SwiftUI APIs

There are also new APIs for SwiftUI.

Offer Code Redemption is a new modifier for SwiftUI Views that opens the same Offer Code sheet as in UIKit. Available on iOS 16+.

When a customer redeems the offer code for your app, the resulting transaction is sent to the transaction listener. So, be sure to set up a transaction listener at your app launch to receive new and updated transactions while your app is running.

Now you can also request an App Store review in SwiftIU.

Best practices are the same as in UIKit:

  • Request review max 3 times within 365 day period
  • Ask sparingly, don’t ask to review same version of your app several times
  • Don’t interrupt your customer interactions
  • Review can’t be a necessary step in any mechanics of your app

StoreKit Messages

StoreKit Messages is a new API to present a message sheet over your app to display important information to the user. All messages are from the App Store and received when your user opens the app.

The best example is a subscription price increase prompt. By default, StoreKit messages appear over your app when the user brings your app to the foreground. But you can implement a listener so these messages won’t interrupt any important flow in your app. There is also a message type property, so you can tailor your app logic even further based on this.

Application Username

The applicationUsername is a string that you create to associate a transaction with the user account on your service. You should pass the UUID of your user so that StoreKit could preserve this information in every StoreKit Transaction. You’ll also receive it as appAccountToken in App Store Server Notifications v2.

To sum up

It’s great to see how Apple continues to develop in-app purchases infrastructure. Last year was huge, with StoreKit 2 and new server APIs. This year does not bring any groundbreaking changes but there are also some welcome ones.

Our team at Adapty is always willing to implement all new features from Apple, so you can leverage them in your apps. If you have any questions about in-app purchases, feel free to join our community!

Further reading

Why is everyone wrong about unit economics
Why is everyone wrong about unit economics
August 4, 2022
56 min listen
The first time hackers attacked our servers
The first time hackers attacked our servers
December 23, 2020
2 min read
Is the App Store revenue cut too high?
Is the App Store revenue cut too high?
June 25, 2020
5 min read