StoreKit 2: cancellation button

I have auto-renewable subscriptions in my app. I've been using .manageSubscriptionsSheet to present a user with a variety of subscriptions and a possibility to cancel the current subscription. Now, I'm trying out the new StoreKit 2 (available in iOS 17.0+) - and it works great (and also looks nice), but it doesn't seem to support cancellation... I tried different options and couldn't make it show anything related to "unsubscribing".

One of the options I've tried was adding .storeButton(.visible, for: .cancellation) - but it doesn't seem to do anything.

So the question is: is it not possible to let users unsubscribe from within the app with StoreKit 2? And if so, what's the recommended approach?

The .storeButton(.visible, for: .cancellation) does not refer to a button to cancel a subscription -- it is a setting to show or hide the button to cancel the store view. This button is displayed in the upper right corner of the store view and is used to dismiss the view. Depending on your paywall logic you may or may not want to show this button -- hence the option to make it visible or hidden. I had the same misconception for days until I figured it out. Hope this helps.

Great callout Donovan... I actually went into StoreKit to see that this would be the answer, but the code hint for .cancellation for storeButton states "A type of button for cancelling a subscription."

Luckily I wound up here on this thread and gave it a shot and it worked. I guess it's a bug/typo in the autocomplete code hint :)

, thanks for the info!

The DOCs are wrong, as it creasy says "button for cancelling a subscription" where it should be "button for dismissing a subscription sheet".

Did you guys figure out how to set a button for actually "cancelling a subscription"?

I posted on SO about this, but haven't got an answear yet... https://stackoverflow.com/questions/77881622/swiftui-storekit-2-how-to-cancel-a-subscription-using-subscriptionstoreview-on

For iOS, we have this:, which does have a button to cancel the subscription: .manageSubscriptionsSheet( isPresented: $presentingSubscriptionSheet, subscriptionGroupID: "21438486" )

But for MacOS, the only solution I have so far is this:

    Button("Manage Subscriptions") {
                          if let url = URL(string: "macappstore://showAccountPage") {
                              NSWorkspace.shared.open(url)
                          }
                      }

Which makes the UI very bad, as we don't have a way to insert buttons on the SubscriptionStoreView( )

StoreKit 2: cancellation button
 
 
Q