Validate ExpirationDate and isPurchase
josueruiz7 opened this issue · 1 comments
I have an issue implementing the follow validation:
RMStoreKeychainPersistence *persistence = [RMStore defaultStore].transactionPersistor;
BOOL purchased = [persistence isPurchasedProductOfIdentifier:productID];
RMStoreUserDefaultsPersistence *persistence2 = [RMStore defaultStore].transactionPersistor;
BOOL purchased2= [persistence2 isPurchasedProductOfIdentifier:productID];
Both always return "YES", for recently users sandbox created, I just did the login and the isPurchasedProductOfIdentifier return YES
And the expiration date always return "0" and appReceipt.expirationDate = null
[[RMStore defaultStore] refreshReceiptOnSuccess:^{
//Validate if Expire Date for subscriptions
RMAppReceipt* appReceipt = [RMAppReceipt bundleReceipt];
NSLog(@"Is subscription 1 active: %d --- %@", [appReceipt containsActiveAutoRenewableSubscriptionOfProductIdentifier:productID forDate:[NSDate date]],appReceipt.expirationDate); } failure:^(NSError *error) {
// Verification failed
}];
I am trying with the same demo project, just changing my provisioning profile, bundleID, and app version, and seeting my auto-renewable subscriptions product code.
Thanks.
I Have found the solution for this issue, I had to clear the transactions and after refresh them.
To clear the transactions:
RMStoreKeychainPersistence *persistence = [RMStore defaultStore].transactionPersistor;
[persistence removeTransactions];
to refresh:
[[RMStore defaultStore] restoreTransactionsOnSuccess:^(NSArray *transactions){
NSLog(@"Transactions restored");
[[RMStore defaultStore] refreshReceiptOnSuccess:^{
NSLog(@"Receipt refreshed");
} failure:^(NSError *error) {
NSLog(@"Something went wrong");
}];
} failure:^(NSError *error) {
NSLog(@"Something went wrong");
}];
Regards