Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Detect subscription

Discussion in 'Unity IAP' started by SebGM2019, Dec 4, 2018.

  1. SebGM2019

    SebGM2019

    Joined:
    Aug 3, 2018
    Posts:
    34
    I want to get the subscription state in my Unity3D project (I'm using Unity IAP), so if the subscription has ended or cancelled I could just remove the exclusive subscription rewards. I made this pseudocode so you can have an idea of it:

    Code (CSharp):
    1. if (Subscription.HasEnded || Subscription.IsCancelled)
    2. {
    3. RemoveRewards();
    4. }
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
  3. SebGM2019

    SebGM2019

    Joined:
    Aug 3, 2018
    Posts:
    34
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Did you use the code provided? It's ok if it's null

    string intro_json = (dict == null || !dict.ContainsKey(item.definition.storeSpecificId)) ? null : dict[item.definition.storeSpecificId];

    dict is created previously:

    Dictionary<string, string> dict = m_AppleExtensions.GetIntroductoryPriceDictionary();