#Retrieve the expiration date of the current subscription

1 messages · Page 1 of 1 (latest)

ocean linden
#

Greetings, I am creating this post regarding the following topic => "Retrieve the expiration date of the current subscription".
I tried searching for the topic using the keywords "IAP," "Expire," "Date," "Subscription," but found nothing :/

Unity version => 6.1 (6000.1.9f1)
IAP version => 5.0.1
Context => Test conducted with an iOS device on TestFlight

Currently, I am using this code to retrieve the subscription expiration date after purchase validation:

`public DateTime GetSubscriptionDate(string id)
{
if (m_StoreController == null)
return DateTime.MinValue;

SubscriptionInfo subscriptionInfo = new SubscriptionInfo(id);
if (subscriptionInfo == null)
    return DateTime.MinValue;

return subscriptionInfo.GetExpireDate();

}`

After several debug sessions, I noticed that I correctly reach return subscriptionInfo.GetExpireDate();, but the date returned is => 01/01/0001 00:00:00.
Is this because I am in a test environment (in testFlight)? If this is not normal, do you have any information that could help me, please?

fast cape
#

Can you go in to your iOS settings and find the subscription? If you can't I would guess that yeah it's probably due to it being a TestFlight.

ocean linden
#

After my purchase and its validation, when I go to my settings, the subscription is indeed visible, but only for a maximum of 3 seconds before it disappears.
When I try to resubscribe through my application, it says that I already have a subscription. I can go to manage this subscription, but nothing happens when I try to cancel it or perform any other action.

fast cape
#

Yeah that does sound like some test envionment quirks.

#

Just to double check, are you confirming the purchase?

ocean linden
#

Yes, I confirm the purchase. I do get the Apple confirmation popup indicating that the purchase was successful.

fast cape
#

Taking a second look at things, I'm unsure if this will do what you want it to do:
SubscriptionInfo subscriptionInfo = new SubscriptionInfo(id);

#

I would fetch all purchases, find the Order with the ID you want to check the subscription for and then access SubscriptionInfo through that Order.

#

Small example from Unity staff given there

ocean linden
#

Oh! After all my searches, I never came across this discussion :/ Sorry, I’ll test it and get back to you as soon as possible! Thank you!

fast cape
#

I'm just getting started with IAP in the last week and a bit, so I've gotten pretty good at digging up discussion posts about it 😛