Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS SDK Auto Renewable subscription with RMStore - how to validate active subscription or not?

I am using RMStore library to work with auto-renewable subscriptions in my iOS app. It works well for purchasing, but I can't find any documentation how to check with RMStore that current subscription is still active?

Code for checking purchased products does not worked here:

 if([persistence isPurchasedProductOfIdentifier:SUBSCRIPTION_1]) { ... }

This code is always show that Subscription was purchased (because it was) but does not check that this subscription already passed by date.

I see method "isActiveAutoRenewableSubscriptionForDate" in RMAppReceipe.h file, but I does not find any documentation how to retrive subscription receipe in my app with RMStore and how to check this receipe with isActiveAutoRenewableSubscriptionForDate method. Please help.

Summary: I just need to check that subscription @"com.fanfun.apptestsubscription1" is still active for TODAY (current date) or not. Please provide sample code for this simple check.

like image 504
Dmitry Avatar asked Feb 14 '23 02:02

Dmitry


1 Answers

I think I found a solution and it work:

RMAppReceipt* appReceipt = [RMAppReceipt bundleReceipt];

NSLog(@"Is subscription 1 active: %d", [appReceipt containsActiveAutoRenewableSubscriptionOfProductIdentifier:SUBSCRIPTION_1 forDate:[NSDate date]]);
like image 182
Dmitry Avatar answered Feb 17 '23 02:02

Dmitry