iOS Subscription not appearing as renewed within app

Hello!

I’m having some trouble implementing auto-renewable subscriptions on iOS. It seems that the behaviour is inconsistent as I have seen the subscription renew and not renew on different occasions. It’s entirely possible that this is an iOS problem, but I’m hoping to confirm that suspicion.

Set-up:

  • In-game store with three different subscription types
  • UI displaying current subscription, DateTime bought and DateTime it should renew
  • A dimming effect on the currently purchased subscription
  • Users can only buy one subscription at a time

What I have seen:

  • The in-game store’s UI does not pick up on the user’s current subscription when reentering the store after it should have renewed

Reproduction Steps

  • Buy a subscription, the app will automatically close the store and place the user back at the main menu with a purchase complete confirmation popup
  • Wait 5 minutes until the subscription should have renewed
  • Reenter store
  • UI will display no evidence of the subscription
  • Pressing on the subscription button for the previously bought subscription brings up a iOS window (similar to the purchase window) stating that we user is already subscribed using the subscription
  • The in-game store’s UI does pick up on the current subscription when restarting the app entirely

Reproduction Steps

  • Buy a subscription, the app will automatically close the store and place the user back at the main menu
  • Close the app entirely
  • Wait 5 minutes until the subscription should have renewed
  • Open app and reenter store
  • UI will update accordingly
  • It appears as if the purchase is processed again (perhaps the purchase is restored?), as the user is placed back at the main menu, with the aforementioned purchase complete popup

Question:
Is there something I’m missing when it comes to reading the user’s subscriptions for iOS? The code currently works as expected on Android, so I’m thinking either iOS works slightly differently, or I’m being a bit oblivious. I have seen something about refreshing the App Receipt in the Unity documentation, and I’ve also read some older threads but my understanding was that SubscriptionManager was introduced to unify the two platforms on this front.

Any and all help would be greatly appreciated! Thanks for your time!

Upon some more testing, I’m finding that some code that was specifically used to help determine what the previous subscription an Android user was on (in order to swap subscriptions) may have been interfering with my loop that determines what subscription the user is on. However, now I believe that there is no evidence of subscriptions when opening the app after it should have renewed, which I believe means that I do need to make sure I’m refreshing receipts.

Going to keep investigating down that path now, if anyone knows anything else, please let me know!

EDIT (so I don’t keep bumping my thread): So I’ve found in this thread , ap-unity states that in order to continue to check for subscriptions, I would need to parse the receipt. This appears to be a fairly old thread, and I’m wondering whether SubscriptionManager would now be taking care of this parsing of the receipt. I’ve seen that my script that checks whether the subscription is still valid on the store appears to not get any receipt data, which I believe is why it doesn’t appear to renew within that app. Mostly just clarifying as it’s difficult for me to get time with a machine that is able to make iOS builds where I’m currently working…

A lot of this has very inconsistent results, which constantly makes me feel like I’m hitting a wall as soon as I seem to pick up any steam. It’s a little frustrating! :sweat_smile:

Yes, you’ll want to use the SubscriptionManager. Note that subscriptions expire very fast during testing.

Thanks for the reply @JeffDUnity3D . I am using SubscriptionManager at the moment, and I do know that subscriptions expire quicker. However this seems to be an issue of the subscriptions not actually renewing at all. I’ll get past the 5 minute mark (monthly subscriptions) and then there is no evidence of a subscription still existing via SubscriptionManager, and thus in my app’s UI.

Please keep us posted on your debugging. It would be expected to that you would see the subscription after restarting your app, and initializing IAP. Please provide the output of your debugging, and what you are seeing for the product via SubscriptionManager. https://discussions.unity.com/t/700551 . Not sure what you mean by “re-enter store”. You won’t see a subscription renew info until you restart the app and initialize IAP. There is no realtime callback for renewing subscriptions. SubscriptionInfo is populated when you launch your app only.

Thanks @JeffDUnity3D . I’ve just now managed to see a subscription through to it’s end. I see what you mean by the SubscriptionInfo is only populated when the app is launched. This proves to be fairly troublesome however, as if someone has the app open when their subscription renews, and they enter the app’s store, the app will check and process that they don’t have one, and will strip them of their subscription. It should be rectified the next time they start their app, but it does seem like bad UX design and I imagine users would be worried that their subscription no longer exists.

Is there definitely no way around this on the Unity side? Or should I just stop any subsequent checks from occurring after the initial one at startup?

EDIT: Hmm, so I just tried to buy a new subscription, and now for some reason, it’s not renewing. My logs appear to state that no subscription could be found based on the products given, and it’s not a matter of the SubscriptionInfo not being updated, because upon startup of the app, my subscription checking script states that the subscription has been cancelled/cannot be found.

EDIT 2: A third subscription still seems like it’s not renewing. I have a theory that perhaps due to Apple’s test environment, only the first subscription on new installs renew to their full extent. Going to test this theory and report back.

EDIT 3: Theory debunked.

Bizarre. I’ve had a bit of a break for about close to 2 hours, and I’ve just tried a new subscription. It appears that now the renewals are working as expected. I think this is completely to blame on Apple’s test environment, and there is some weirdness when trying to test subscriptions close together, as I’ve noticed while working on subscriptions that the very first one of my work day will normally work correctly. I assume it won’t impact the app at production.

I will continue to do further investigation and report back, so that hopefully other developers can gain a bit of clarity if they’re experiencing the same issues while testing.

EDIT: So yeah, seems to be a case of the sandbox environment not liking me trying to subscribe to something else so soon after the first subscription has finished. Waited about 30 minutes and tried again, and it has a problem. Waited about an hour and tried again, subscription is renewing as normal. Very frustrating behaviour but I suppose there’s nothing that can really be done there.