Using MKStoreKit for an auto-renewing subscription. Successful purchase in the sandbox. The issue is the purchase date and expiry date always log as the same, or 1hr behind the current date. With accelerated sandbox times I would expect [[MKStoreKit sharedKit] expiryDateForProduct:@"211112"]; to be around 30mins ahead of [NSDate date] on purchase as its a six month purchase. I get the current date exactly 1hr behind for the transaction.
Log for purchase:
Transaction date is 2021-07-30 4:15:07 pm +0000
Subscription end date is Fri Jul 30 17:15:07 2021
On reloading, the logs print that that subscription expiry date and current date are both exactly the same
Log for reloading:
1. Current time and date: Fri Jul 30 17:02:42 2021
2. Expiry date for subscription 6 months = Fri Jul 30 17:02:42 2021
From the code in MKStoreKit, it would seem the purchase date may be returning NULL and returning the current date
-(NSDate*) expiryDateForProduct:(NSString*) productId {
NSNumber *expiresDateMs = self.purchaseRecord[productId];
if ([expiresDateMs isKindOfClass:NSNull.class]) {
return NSDate.date;
} else {
return [NSDate dateWithTimeIntervalSince1970:[expiresDateMs doubleValue] / 1000.0f];
}
}
[[MKStoreKit sharedKit] valueForKey:@"purchaseRecord"] returns <null> on purchase
It was incorrect app secret in
MKStorekitConfigs.plist