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.

Oscar de la Hera Gomez
Written by Oscar de la Hera Gomez
First published on 03/25/2023 at 16:42
Last Updated on 03/27/2023 at 15:57
Three flowers that represent StoreKit, Swift and XCode side by side. Beneath them sits the text “Test StoreKit Interrupted Purchases.”

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.

SubscribeFree Open-Source Apple StoreKit 2 Swift Project

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.

How to setup StoreKit in XcodeHow to create a StoreKit offering in XCode or App Store ConnectHow to code and test StoreKit purchases in Swift and XCodeFree iOS e-commerce Figma design file

Step One: Enable Interrupted Purchases

A screenshot of Xcode highlighting the location of the Editor tab in the Xcode menu and Enable Interrupted Purchases. If Interrupted Purchases is already enabled, this will say Disable Interrupted Purchases.

In XCode, enable interrupted purchases.

How to enable and disable StoreKit Interrupted Purchases in XCode

Step Two: Make a purchase

A screenshot of an iOS app showing a non-consumable in-app purchase in a pending state.

Run the app and attempt to make a purchase.

Interrupted purchases will behave in the same way as pending purchases.

How to code and test StoreKit pending purchases in Swift and XCode

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.

Read Apple StoreKit 2 Development Guide

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
SubscribeContact UsVisit our BlogView our ServicesView our Work

Partner with us

We would love to get to know you and see how we can help your organization with its goals and needs.
Let's Talk

Stay Informed

Get occasional updates about our company, research, and product launches.
Subscribe