How to allow users to manage a Subscription in an app in Swift

Oscar de la Hera Gomez
Three flowers that represent StoreKit, Swift and XCode side by side. Beneath them sits the text “Manage StoreKit Subscriptions.”

A step by step guide on implementing and testing code that enables customers to upgrade, downgrade or cancel an Auto-Renewable Subscription in an App.

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, have developed a UI that allows an app to display and buy products and have already made at least one successful Auto-Renewable Subscription purchase.

Please consult the guides below to learn how to setup StoreKit, create a StoreKit offering, design a UI that considers all StoreKit scenarios or make StoreKit product purchases.

Step One: Implement the Utility

A screenshot of Xcode showing the code snippet that's available below.

In XCode, create a new file and paste in the code below.

We recommend that you place it under Utils/StoreKit.

Step Two: Implement the code

A screenshot of Xcode showing the code snippet that’s available below.

In your app, wherever you wish to allow users to manage their subscriptions, add the code below.

Step Three: Verify

A screenshot of an iOS app showing the users ability to manage subscription preferences.

Run the app and test the functionality. It should pop up a modal similar to the one above.

The changes that you make should appear in the StoreKit Transaction manager.

Looking to simulate a change in subscription outside of an app?

For a guide on simulating a change in a subscription plan outside of an app, please consult the guide below.

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.

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.
delasign logo

Book a Free Consultation.

An icon of an email.

Click here to email us.

Fill in the details below to book a free consultation or to let us know about something else. Whatever it is, we are here to help.

How can we help you ?

Contact Details