@bizz84 Please help asap.
ℹ 0.5.0
In SwiftyStorekit framework, is there any way i can identify that trial period is over in sandbox/production environment for auto-renewable subscription. also is there any need that i should store receipt at my side. i just want to show to user in my application that your trial period is over & it is renewed. how can i check that user cancel subscription in auto-renewable? subscription.
1.Please share solution to all my question , i am completely confused.
@cwinUser apologies for the very late reply, this has not been fixed until recently.
Starting from version 0.9.0, you can now verify if a subscription is within the trial period or not.
The result returned when you call verifySubscription will tell you if the subscription is purchased or expired:
// Verify subscription result
public enum VerifySubscriptionResult {
case purchased(expiryDate: Date, items: [ReceiptItem])
case expired(expiryDate: Date, items: [ReceiptItem])
case notPurchased
}
You can read the latest subscription period like this:
switch result {
case .purchased(let expiryDate, let items):
if let mostRecent = items.first {
print("Active, isTrial: \(mostRecent.isTrialPeriod)")
}
case .expired(let expiryDate, let items):
if let mostRecent = items.first {
print("Expired, isTrial: \(mostRecent.isTrialPeriod)")
}
case .notPurchased:
}
You don't need to store the receipt yourself, it is already done automatically by StoreKit.
SwiftyStoreKit treats a cancelled product as if the product was never purchased (see https://github.com/bizz84/SwiftyStoreKit/pull/164). This is in accord with Apple guidelines:
Treat a canceled receipt the same as if no purchase had ever been made.
Hope this answers your questions.
I'm going to close this for now, however feel free to reopen if you need more clarifications.
Hi, How does it handle multiple subscription options? What does "VerifySubscriptionResult" represent exactly?