Hi,
I'm developing my first app with in-app purchase and I'm having this problem:
a tester in testFlight is buy the auto renewal annual subscription
the purchase process ends correctly
the expiration date of the receipt has the actual year and not the next one!
What I'm wrong? Whay the expiration date isn't 2025 instead of 2024 as aspected?
This is the code that verify the receipt:
func verifySubscription() -> Bool {
guard let receiptData = fetchReceipt() else { return false }
do {
let receipt = try InAppReceipt.receipt(from: receiptData)
let purchases = receipt.purchases
for purchase in purchases {
if purchase.productIdentifier == productID {
if let expirationDate = purchase.subscriptionExpirationDate { UserDefaults.standard.set(expirationDate.formattedStringWithTimeZone(withFormat: "yyyy-MM-dd HH:mm:ss"), forKey: K.userDefault.subscriptionExpirationDate)
return expirationDate > Date()
}
}
}
} catch {
}
return false
}
Thanks a lot in advance.