Can an App detect a subscription's cancellation in itself?

StoreKit2 provide great API AppStore.showManageSubscription(in:) to downgrade, upgrade or cancel the user's subscription, however, can the App detect the cancellation in App? (without server to server notification)

I understand the upgrade and downgrade can be detected in Transaction.updates, but I'm not sure about the cancellation.

I want to update my label's text from Next billing date: \(date) to Expires \(date) if the user cancels the subscription in showManageSubscription(in:) sheet.

Can I implement that?

Replies

Hi, I'm in the same situation as you. did you find a solution?

Fortunately, I found a solution! A @MainActor static func showManageSubscriptions(in scene: UIWindowScene) async throws suspends the task until the user selects "Done" or "Cancel" in the manage subscription screen, so you can manually check the updated state in the next line.

Task {

    do {

        // The method suspends the execution until the user selects "Done" or "Cancel"
        try await AppStore.showManageSubscriptions(in: view.window!.windowScene!)

        // The line is executed after dismissing the screen. You can check the latest state of your app's subscription, then update your UI.
        await checkAndUpdateAppSubscriptionStateI()

     } catch let storeKitEerror as StoreKitError {

      // Error handling

     }

}