How to test interrupted purchases in Swift and XCode


A two step guide on testing interrupted StoreKit product purchases for In-App Purchases and Subscriptions.
The guide was made using our Free iOS StoreKit 2 Open Source project which is recommended for developers or business folk wishing to learn about how In-App Purchases or Subscriptions work and the code behind them.
The following walkthrough assumes that you have already setup StoreKit with an offering and developed a UI that allows an app to display products and buy them.
Please consult the guides below to learn how to setup StoreKit, create a StoreKit offering, setup your app to be able to purchase StoreKit products or design a UI that considers all StoreKit scenarios.
Step One: Enable Interrupted Purchases

In XCode, enable interrupted purchases.
Step Two: Make a purchase

Run the app and attempt to make a purchase.
Interrupted purchases will behave in the same way as pending purchases.
Looking to learn more about developing apps with StoreKit 2?
Read our comprehensive development guide linked below to learn about all the secrets behind developing In-App Purchases and Subscriptions with StoreKit 2.