I'm working on implementing the new StoreKit 2 api in my iOS app. I offer auto-renewing subscriptions to my users. I have lots of different product levels each that come with yearly or monthly charging options.
Let's say a user has a yearly auto-renewing subscription that is paid through April 2024. In Sept 2023, they decide to downgrade to a monthly product. Their yearly product stays in place until it expires and then when the subscription auto-renews in April 2024, it will renew as monthly instead.
How do I look up what product id they downgraded to? When I look in the renewalInfo struct, it will give me info on if they will renew, when they will renew, and it'll give me their currentProductId
... but I need the next product id. The one that they downgraded to, the monthly one. When their subscription to the yearly product expires, they'll renew as a different (monthly) product.
if let status = try? await self.subscriptionProducts.first?.subscription?.status.first {
if let renewalInfo = try? self.checkVerified(status.renewalInfo) {
// ...
}
}
I can't figure out how to access that info so that I can properly present the info in their Account screen. If my users were on a yearly product and last week they chose to downgrade to a monthly product, I need to show them that they are finishing their yearly sub and will auto-renew as monthly. I can't just show them that they are on the yearly sub, because they'll get confused because they know they downgraded to monthly.