Search code examples
iosswiftin-app-purchasestorekitrenewal

Cancel auto-renewal subscriptions with Swift


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?


Solution

  • 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")!)