Mobile in-app subscriptions are the most popular monetization method for most non-gaming apps these days. Yet implementing and testing in-app subscriptions in iOS is a complicated task.
Luckily Apple has presented a set of new convenient features for StoreKit testing in their Introducing StoreKit Testing in Xcode session during WWDC 2020. We have summarized the key changes for you.
- StoreKit Configuration File – allows you to set up the in-app products for testing directly in Xcode. No need to create them in App Store Connect anymore.
- StoreKit Transaction Manager – transaction manager allows you to see all in-app purchases locally and manage their statuses;
- StoreKitTest Framework – a new framework for running tests in Xcode that provides full control over them;
- Sandbox subscription management on devices.
StoreKit Configuration File
StoreKit Configuration File allows you to set up a local environment for in-app purchases testing without creating in-app products in App Store Connect.
To create StoreKit Configureation file just go File → New → File
You can use three product types:
- Consumable In-App Purchase
- Non-Consumable In-App Purchase
- Auto-Renewable Subscription
Now it is possible to change the rate at which time passes for auto-renewable subscriptions in a test environment using the Time Rate configuration:
StoreKit Transaction Manager
StoreKit Transaction Manager is a very useful tool for local development and in-app subscription testing.
StoreKit Transaction Manager allows to:
- cancel a subscription
- refund a subscription
- reset a subscription (as if a purchase never happened)
- set a billing retry state for a subscription
To access the StoreKit Transaction Manager you need to choose your StoreKit Configuration File and click on the icon in the debugging area(field/bar).
New StoreKitTest framework works together with StoreKit Configuration File and allows creating Unit and UI tests. It allows testing automation for in-app purchases. The state is managed by SKTestSession. You can test:
- Successful purchases
- Failed purchases
- Interrupted purchases
- External transactions
- Subscription offers
Managing Sandbox subscriptions
Sandbox subscription can be canceled or changed to another subscription within the same subscription group on a device.
There is also a new Reset Eligibility setting that resets the introductory offer. You no longer need to create a new sandbox account for testing.
New features provide developers with a flexible environment and in-app transaction management tools. New capabilities of in-app test automation will help ship faster to the App Store and implement a more reliable in-app subscription.
To the best of my knowledge, it is the most significant update of testing capabilities for in-app purchases on iOS. I am sure it will improve the developer experience with in-apps and reduce the problems of in-app product implementation.
Qonversion.io is the mobile subscription tool that gets the data from both SDK on the devices and through integrations with the App Stores. Qonversion handles the subscription revenue data, interprets it, and uses out-of-the-box integrations to send that information to marketing and analytics platforms like Facebook Ads, Appsflyer, or Amplitude.