If a user subscribes to a free trial, cancels that free trial, and then later attempts to initiate a free trial again for the same product, they are immediately (and unexpectedly) charged by Apple. Our app has language around free trials, and we’d love to find a way to dynamically update this language to no longer mention the free trial once the user is no longer eligible under these conditions. Is there any way for us to know whether a user is, according to Apple, eligible for a free trial?
Is there a way to know if a user previously had a free trial on iOS?
Best answer by matthew_l
While the Quickstart guide, documentation, and sample app all suggest the above should work, I didn’t want to submit an app that I knew didn’t show offers properly, so I kept on digging for a working solution.
This thread made me aware of the checkTrialOrIntroductoryPriceEligibility method, so I played with that and found it did exactly what I needed. Here is the basic idea of how I used it my SwiftUI app:
class SubscriptionManager: ObservableObject {
@Published var packages: [Purchases.Packages]? = nil
@Published var trialEligibility: [String: RCIntroEligibility]?
/// Sets the RevenueCat current offerings to the @Published packges property.
func loadPackages() {
// clear any existing values to make sure we're using the latest from RC
packages = nil
trialEligibility = nil
var productIDs: [String] = []
Purchases.shared.offerings { offerings, error in
if let packages = offerings?.current?.availablePackages {
for package in packages {
productIDs.append(package.product.productIdentifier)
}
Purchases.shared.checkTrialOrIntroductoryPriceEligibility(productIDs) { eligibility in
self.trialEligibility = eligibility
}
self.packages = packages
}
}
}
}
In my SwiftUI views, I pass each purchase button a package to process and ask it check to see if the offer is eligible for intro pricing.
private var introEligible: Bool {
subscriptionManager.trialEligibility?[package.product.productIdentifier]?.status == .eligible
}
If the product is eligible, then I parse the pricing similar to the approach in the sample app.
This has worked as expected in sandbox testing, including when I reset purchase history (and thus intro offer eligibility) in App Store Connect.
in an attempt to minimize waiting for offers to load in when the user hits the paywall, I call loadPackages() when the app launches as well as when the paywall sheet pops up (where it’ll hopefully load quickly from cache).
Hopefully this helps. If anyone notices anything I’m doing incorrectly, please let me know :)
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.