What’s new in Apphud: Facebook Integration now supports AEM (Aggregated Event Measurement)Let’s see
Apphud
Why Apphud?PricingContact
Ren
Ren
June 09, 2022
7 min read

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

Let’s take a look at what’s new with in-app purchases this year.

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

Every June, Apple holds an annual developer conference where it announces the next iOS version and updates to the frameworks.

This year, Apple introduced iOS 16 and some major updates, like Lock Screen widgets, animations, and more. However, we are mostly interested in updates to in-app purchases and related APIs.


StoreKit 2

Last year we talked about StoreKit 2 which is significantly different from traditional StoreKit. Today, Apple added some more features to this framework.

AppTransaction API

This class should be mostly used to get the original purchase date of your paid app. It is also useful when you switch from a paid to a freemium business model. In this case you would want to maintain premium access to users who purchased a paid app as well as those who subscribed in a freemium app version.

In the original StoreKit, it is the same as the JSON receipt's originalPurchaseDate field.

In Apphud SDK, you can fetch raw receipt with the same info like this:

Apphud.fetchRawReceiptInfo { receipt in
  guard let date = receipt?.originalPurchaseDate else {
    return
  }
  ...
}

StoreKit Message API

The new method lets you defer a StoreKit message sheet, for example, a price increase consent screen. Nothing really interesting here.

Defer StoreKit Message Sheet, WWDC 2022Defer StoreKit Message Sheet, WWDC 2022

SwiftUI APIs

There are two minor new methods to present an offer code redemption sheet and request an App Store review within your app.

New properties

Two minor properties were added to StoreKit 2. Nothing special.

environment - whether the subscription was purchased in a sandbox or production environment. This property already exists in legacy receipt, so this is not an important update to Apphud.

recentSubscriptionStartDate - documentation says that it is the earliest start date of a subscription that ignores all lapses shorter than 60 days. And if there is no 60 days gap — the recentSubscriptionStartDate will be the same as the originalPurchaseDate. Simply speaking, this is the date of subscription reactivation.


In-App Purchases Testing Updates

There are a few enhancements for in-app purchases testing in Xcode. 

Sync in Xcode

You will be able to sync your App Store Connect products to Xcode, which seems to be a pretty cool feature. Would be great if that worked vice-versa, i.e. Products created in Xcode appeared in App Store Connect.

Test in Xcode

More test cases have been added to Local StoreKit testing, like offer code redemptions, refund requests, and so on. This is a nice improvement, but not commonly used across app developers.

Fortunately, Apphud does support purchases made in iOS Simulator using StoreKit configuration file:

Sandbox

Apple says that developers will be able to create sandbox users and test sandbox purchases much easier. Looks really interesting, since creating a new sandbox user is annoying – it requires you to log in to ASC. What will it look like? We will update you shortly.


App Store Server Notifications V2

A TEST notification type has been added, which lets you confirm that your server is ready to receive notifications. Google Play Console already has this feature in its Real-Time Notifications.


App Store Server API

Apple continues to improve App Store Server API by adding some new endpoints, like getting notifications history, sort and filter options, and provides an API for requesting a test notification.

Currently, Apphud does not currently support Notifications V2 for the following reasons:

  • Since Apphud has its own set of events, Apple’s notification names themselves are not important but the base64 receipt. Once notification has arrived, Apphud operates with the included receipt, but not with the notification name.
  • Notifications V2 require authorization with an App Store key that must be generated in App Store Connect and uploaded to Apphud, which makes the onboarding process more complicated. Notifications V1 require a shared secret instead of App Store key, which is far easier to provide.
  • Apphud already handles all the edge cases.

Request test notification

Apple added an API for requesting a test notification:

POST https://api.storekit.itunes.apple.com/inApps/v1/notifications/test 

Google Play has a button in its console for requesting a test notification which seems more convenient to me.

Get notification history

You can get the history of notifications which can be helpful to restore updates in case of your server outage:

POST https://api.storekit.itunes.apple.com/inApps/v1/notifications/history

If your server is down for a long period of time, all notifications retry attempts may fail, and the only way to retrieve notifications will be via this new API.

Server Notifications Retry Logic, WWDC 2022Server Notifications Retry Logic, WWDC 2022

In-app purchase history

Apple added sort and filter options to their "get notifications history" endpoint. Okay, but not exciting.


Conclusion

Apple added some enhancements to their APIs and frameworks, but actually nothing breakthrough.

The only thing we are excited about is syncing App Store Connect products to Xcode. At Apphud we handle all subscription updates for you so you don’t have to worry about implementing Server Notifications V2.

We will continue to update you with the new frameworks and improvements at WWDC 2022. Stay tuned!

Ren
Ren
Co-founder at Apphud
Ex iOS app and game developer. 11 years in the industry since iOS 3. More than 50 apps are in the background with 4 exits. Entrepreneur and traveler.