Cancel auto-renewal subscriptions with Swift

18.3k Views Asked by At

I want to create a button where a user can cancel a auto-renewal subscription (or get redirected to App Store).

Is that possible without the user having to go through the whole purchase process first? If it is, how would you go about doing it?

5

There are 5 best solutions below

5
Paulw11 On BEST ANSWER

From the Apple In-App Purchase Programming Guide -

Rather than needing to code your own subscription management UI, your app can open the following URL:

https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/manageSubscriptions Opening this URL launches iTunes or iTunes Store, and then displays the Manage Subscription page.

So, simply create a button that launches that URL.

UIApplication.shared.openURL(URL(string: "https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/manageSubscriptions")!)
0
Joseph On

As mentioned in the documentation: https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Subscriptions.html#//apple_ref/doc/uid/TP40008267-CH7-SW19

So for Swift 3/4 just use this

UIApplication.shared.openURL(URL(string: "https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/manageSubscriptions")!)
0
daviddna On

iOS 10 and above

UIApplication.shared.open(URL(string: "https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/manageSubscriptions")!, options: [:], completionHandler: nil)
2
vfxdev On

December 2019

The correct URL is now https://apps.apple.com/account/subscriptions according to Apple's Handling Subscriptions Billing Documentation.

So just use:

UIApplication.shared.open(URL(string: "https://apps.apple.com/account/subscriptions")!)
1
Nikhil Lihla On

April 2021

According to the Apple Document, the URL has been updated to

https://apps.apple.com/account/subscriptions

So the following code can be used to redirect the user to manage subscriptions page.

DispatchQueue.main.async {
      UIApplication.shared.open(URL(string: "https://apps.apple.com/account/subscriptions")!, options: [:], completionHandler: nil)
    }