I've an iOS app which uses Glassfy for purchasing subscriptions.
The initial app release was accepted in AppStore, but after I added a new Sku, Glassfy process started showing errors - initially while fetching products and later on while verifying the purchased subscription.
I was able to go around the fetching products issue by removing all Skus from offering and adding again, but the verification of permission seems to fail all the time now.
private func verifyPermission(_ permission: Glassfy.Permission) {
log(
"Permission verified and it is \(permission.isValid ? "valid ✅" : "invalid ⛔️")"
)
DispatchQueue.main.async {
self.isSubscribed = permission.isValid
}
}
public func purchaseMonthlySubscription() async -> SubscriptionResult? {
do {
log("Purchasing subscription..")
guard let monthlySku = monthlySku else {
return .error(
message: "Product cannot be fetched.\nPlease check your internet connection and try again."
)
}
let transaction = try await Glassfy.purchase(sku: monthlySku)
let subscriberId = transaction.permissions.subscriberId ?? ""
await StorageManager.shared.saveSubscriberId(subscriberId)
if let permission = transaction.permissions[pmpPermissions] {
checkHasPurchases(permission)
verifyPermission(permission)
if permission.isValid {
return .success
}
}
return .error(
message: "Permission cannot be granted.\nPlease try again later."
)
} catch {
if let error = error as? SKError {
switch error.code {
case .paymentCancelled:
log("Payment cancelled 💸")
return nil
default:
print("")
log(error)
}
}
return .error(
message: "Something went wrong while subscribing.\nPlease try again later."
)
}
}
Please note - the issue started appearing after adding a new SKU; the initial app worked fine.
Please advise.