Hi guys,
We’re having issues with the purchase
callback never being called for some users. This post came closest to the same issue, but didn’t have a clear answer to how to resolve or what the cause could be.
The annoying this is that I can’t reproduce the issue. What happens for certain users, is that they hit our “Subscribe” button, and the loading icon that’s shown gets stuck because the callback never returns. This issue has to have to do with the call to func purchase(package: Package, completion: @escaping PurchaseCompletedBlock)
, since in all other cases the loading icon would disappear.
Relevant Code
PurchasesManager
PurchasesManager is a wrapper Singleton class for called RevenueCat’s Purchases.
/// Purchase the given package and call completion upon result
func purchase(package: Package, completion: @escaping (StoreTransaction?, CustomerInfo?, PublicError?, Bool, Bool) -> Void) {
if (configured) {
Purchases.shared.purchase(package: package) { (transaction, customerInfo, error, userCancelled) in
completion(transaction, customerInfo, error, userCancelled, true)
}
} else {
completion(nil, nil, nil, false, /* PurchasesManager was not configured with user email yet: */ false)
}
}
And where the loading icon hangs when purchase
is called:
func purchasePremium(package: Package?) {
if let package = package {
showLoader = true
PurchasesManager.shared.purchase(package: package) { transaction, customerInfo, error, userCancelled, configured in
showLoader = false
// Do other stuff (setting variables, success/error messages etc)
}
}
}
Other relevant info
I’m using SPM to install RevenueCat from Github, “Up To Next Major Version” Dependency rule set to 4.0.0 < 5.0.0
Any help on this would be greatly appreciated, since this is obviously affecting our conversion rates for getting people to subscribe.
Hope to hear back soon!