My app has auto renewable subscription. I tried to test the correct workflow of the subscription. According to WWDC 2018:
I created a new subscription with one week duration. I created a new sandbox user, and tried to activate my new subscription. Here is the code:
guard let httpResponce = responce as? HTTPURLResponse,
let contentType = httpResponce.allHeaderFields["Date"] as? String,
let expirationDate = self.parcedReceipt?.inAppPurchaseReceipt?.subscriptionExpirationDate,
let serverDate = self.parseDateAndTime(getResDate: contentType) else {
result(false, ReceiptError.unexpectedError.localizedDescription)
return
}
self.saveDateAndTime(dateForSave: serverDate)
self.ls.pmsg("serverTime:\(serverDate), receiptDate:\(expirationDate)")
I verify date and time with server. The result is the same - I always get receiptDate like: current time + one hour:
XXX.swift validateTimeWithServer(result:) serverTime:2018-07-11 13:18:16 +0000, receiptDate:2018-07-11 14:18:16 +0000
But my subscription is only one week.
Why is this happened? Is it possible that date of the receipt is one hour but in reality the AppStore renew it after 3 min?