Is there an API to cancel an auto-renewable subscription?
Asked Answered
H

4

21

I don't currently use any apps that have an in app subscription, so I am not sure what the UI looks like in iTunes when do an in app renewable subscription.

I assumed there was an api, given a receipt id or original transaction id, to cancel the auto-renewable subscription from within the application. It doesn't look like this exists.

Am I missing something or do users cancel auto-renewable subscription through their iTunes account settings? This just isn't the developer's responsibility?

Heisler answered 7/4, 2011 at 1:59 Comment(2)
How to get notified if the user cancel an auto renewable subscription?I want to cancel this on my server as well.Coverture
You should ping Apple occasionally (say once a day with cron job) and obtain current status of currently active Apple subscriptions. Once Apple responds and you see the subscription has been canceled, you can perform your own cancellation logic on the server. Also this same process can be done when your App sends you the latest receipt. Do both and don't rely only on App informing you the subscription has been canceled (in case that fails for any reason).Hamlett
B
1

Starting from iOS 15, there is new api for that: static func showManageSubscriptions(in scene: UIWindowScene)

or even easier with SwiftUI: manageSubscriptionsSheet(isPresented:)

Documentation here: https://developer.apple.com/documentation/storekit/appstore/3803198-showmanagesubscriptions

For SwiftUI: https://developer.apple.com/documentation/swiftui/view/managesubscriptionssheet(ispresented:)

Ballet answered 5/6, 2023 at 22:52 Comment(0)
G
31

There is no API for this.

The only way to cancel a auto-renewable subscription is from Settings > Store > View my account > Manage my subscription on you iPhone.

Grandchild answered 15/4, 2011 at 18:1 Comment(3)
Thanks for the confirmation. I suspected as much.Heisler
Can we test ios in app purchase on production?Right now I dont find much useful documentation about this.Coverture
The reason they don't allow this is because they don't want developers moving customers over to other payment methods and cancelling Apple subscriptions.Dwt
R
18

Update (as this is fairly old by now): There is no API to cancel an auto-renewable subscription. Apple's documentation suggests that the app links to:

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."

Rosaline answered 8/12, 2014 at 20:33 Comment(7)
I believe this is meant to be used from within an app, but I'm not sure why it would not work in mobile Safari as well.Rosaline
How to get notified if the user cancel an auto renewable subscription?I want to cancel this on my server as well.Coverture
@abhi1992 I have the same problem. Apple doesn't offer any webhook that would inform you about this significant event "subscription canceled". Basically we need to setup some backend cron job which would periodically check all active subscriptions (contact Apple) and verify they're not being canceled. That sounds ridiculous, so I'm also looking for correct pattern. Please share your thoughts.Hamlett
@ManInTheBox, you can check the App Store receipt on the device whenever the app is used, and let your server know about any changes in the subscription status of the user. So your server would know about any cancelation the next time the app is used.Chambless
@Chambless correct but that implies that the app will be used again. What happens if they purchase, get their content, then they contact Apple support and cancel it and immediately uninstall the app and never launch it again? Your server would then never receive updated receipt from the app, because it wouldn't be launched anymore. You're getting out of sync. The solution is to NOT rely on the app sending you receipt, but you periodically check receipt on the server.Hamlett
What if i have to delete(block permanently) user with his account and he has auto-renewable subscription? The only option i think is to prompt the user when he'll launch app after being deleted. Apple should enable option to cancel, bc there're so many cases when it could be handyLegislate
Just to back up and elaborate on @kam.voick point... what if the end user subscribes to a service, and then performs an action that is against the rules (or TOS)? In this case, the service (application) would have to have a way to cancel the end users subscription (i.e. kick them out or ban them; hence cancel their subscription & stop charging them)... is there a way to perform this programmatically?Andresandresen
B
1

Starting from iOS 15, there is new api for that: static func showManageSubscriptions(in scene: UIWindowScene)

or even easier with SwiftUI: manageSubscriptionsSheet(isPresented:)

Documentation here: https://developer.apple.com/documentation/storekit/appstore/3803198-showmanagesubscriptions

For SwiftUI: https://developer.apple.com/documentation/swiftui/view/managesubscriptionssheet(ispresented:)

Ballet answered 5/6, 2023 at 22:52 Comment(0)
H
-5

Recently Apple introduced their new service called "Status Update Notifications" which in essence is simple webhook that's being called when certain events occur on Apple servers. One of these events can be "CANCEL" when Apple's customer support cancels user's subscription. You setup a webhook and they send you a notification with details about this event. More information can be found here: https://help.apple.com/itunes-connect/developer/#/dev0067a330b

I added this reply because this is what Apple recently introduced.

Hamlett answered 31/10, 2017 at 15:26 Comment(2)
To be clear, this question is asking for an API to cancel a subscription (allowing the developer to initiate the cancelation via an API). The notifications API you mention is the other direction: it notifies the developer of a user-initiated cancelation.Weimaraner
Just to back up and elaborate on @delrox point... what if the end user subscribes to a service, and then performs an action that is against the rules (or TOS)? In this case, the service (application) would have to have a way to cancel the end users subscription (i.e. kick them out or ban them; hence cancel their subscription & stop charging them)... is there a way to perform this programmatically?Andresandresen

© 2022 - 2024 — McMap. All rights reserved.