Subscriptions 101: learn how to get +23% app revenue Read more

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

Nikita Maidanov

June 15, 2022

9 min read

Table of Contents

62a9ae422099a79c0b44b95a whats 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.

62a83997d0fc8328672039b7 pvq u1ipw5ru7hmobyw9aouhm lpy6apkxcrxpb04g9n4litk28

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:

62a83997c3da3f3fcc3c7573 t ffyftk6rt9uyvf0kfi3sktqsq9zt7wzt2di4jzuers3dtmnudkpsspp78lbkxbqmaubttc7oz3yxxezajel wd9fcx72d4fbkdlms1lu92q643fudz3ngeofnabegw2tdcycc dppll62vig

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.

62a839972f97f50ce5087623 gq ahxsy1ebacj0yzqrzuat3ye1un08bpjy37bw8rh5n ymeizoq0u8a0n

Here are the sentinel values you may receive:

62a83996b63baa7a53c27900 fyguelwsnf2z1orn75ewhj1vpd4cnjzhe1nqtpg5fnorw6hxcsfe yoz5ksderp8uvo14uocrs6zwcfwrmoxmqbmwwixn6mhieadypndzoko03qv2jrv2q7c dizoz

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+.

62a83997d0fc83284f2039b8 kzax5osd6w5rovwiogeranxnh2g3ass7iyh9obnyjhx5w rg0x8a dtsikemtb8cwvjqn9vht4n b50nwgafgtn45a mjsrgb8lhf zscwnemvvhieaz tyhzgi0zupnwsyi5q0uzfpmgzy8uq

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.

62a83998d0fc831ebb2039cc afuawjpzeqdjmaff5lotdkvstvw7frqqumrbc3ynxtltolzyd2 r s cn p

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

62a839981a34827ffa2e3965 itgprkp7uiek5j rwo79

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.

62a839982bce0cc8f2d001c3 eadwtxyru7lrv84cdf0

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