docs.unity3d.com
    Show / Hide Table of Contents

    Class SubscriptionManager

    Use to query in-app purchasing subscription product information, and upgrade subscription products. Supports the Apple App Store, Google Play store, and Amazon AppStore. Note Amazon support offers no subscription duration information. Note expiration dates may become invalid after updating subscriptions between two types of duration.

    Inheritance
    Object
    SubscriptionManager
    Namespace: UnityEngine.Purchasing
    Syntax
    public class SubscriptionManager

    Constructors

    SubscriptionManager(String, String, String)

    Construct an object that allows inspection of a subscription product.

    Declaration
    public SubscriptionManager(string receipt, string id, string intro_json)
    Parameters
    Type Name Description
    String receipt

    A Unity IAP unified receipt from Product.receipt.receipt

    String id

    A product identifier.

    String intro_json

    From IAppleExtensions.GetIntroductoryPriceDictionary.GetIntroductoryPriceDictionary

    SubscriptionManager(Product, String)

    Construct an object that allows inspection of a subscription product.

    Declaration
    public SubscriptionManager(Product product, string intro_json)
    Parameters
    Type Name Description
    Product product

    Subscription to be inspected

    String intro_json

    From IAppleExtensions.GetIntroductoryPriceDictionary.GetIntroductoryPriceDictionary

    Methods

    getSubscriptionInfo()

    Convert my Product into a SubscriptionInfo. My Product.receipt must have a "Payload" JSON key containing supported native app store information, which will be converted here.

    Declaration
    public SubscriptionInfo getSubscriptionInfo()
    Returns
    Type Description
    SubscriptionInfo
    Exceptions
    Type Condition
    NullProductIdException

    My Product must have a non-null product identifier

    StoreSubscriptionInfoNotSupportedException

    A supported app store must be used as my product

    NullReceiptException

    My product must have

    UpdateSubscription(Product, Product, String, Action<Product, String>, Action<String, String>)

    Performs subscription updating, migrating a subscription into another as long as they are both members of the same subscription group on the App Store.

    Declaration
    public static void UpdateSubscription(Product newProduct, Product oldProduct, string developerPayload, Action<Product, string> appleStore, Action<string, string> googleStore)
    Parameters
    Type Name Description
    Product newProduct

    Destination subscription product, belonging to the same subscription group as oldProduct

    Product oldProduct

    Source subscription product, belonging to the same subscription group as newProduct

    String developerPayload

    Carried-over metadata from prior call to SubscriptionManager.UpdateSubscription.UpdateSubscription

    Action<Product, String> appleStore

    Triggered upon completion of the subscription update.

    Action<String, String> googleStore

    Triggered upon completion of the subscription update.

    UpdateSubscriptionInAppleStore(Product, String, Action<Product, String>)

    Performs subscription updating, migrating a subscription into another as long as they are both members of the same subscription group on the App Store.

    Declaration
    public static void UpdateSubscriptionInAppleStore(Product newProduct, string developerPayload, Action<Product, string> appleStoreUpdateCallback)
    Parameters
    Type Name Description
    Product newProduct

    Destination subscription product, belonging to the same subscription group as oldProduct

    String developerPayload

    Carried-over metadata from prior call to SubscriptionManager.UpdateSubscription.UpdateSubscription

    Action<Product, String> appleStoreUpdateCallback

    Triggered upon completion of the subscription update.

    UpdateSubscriptionInGooglePlayStore(Product, Product, Action<String, String>)

    Performs subscription updating, migrating a subscription into another as long as they are both members of the same subscription group on the App Store.

    Declaration
    public static void UpdateSubscriptionInGooglePlayStore(Product oldProduct, Product newProduct, Action<string, string> googlePlayUpdateCallback)
    Parameters
    Type Name Description
    Product oldProduct

    Source subscription product, belonging to the same subscription group as newProduct

    Product newProduct

    Destination subscription product, belonging to the same subscription group as oldProduct

    Action<String, String> googlePlayUpdateCallback

    Triggered upon completion of the subscription update.

    See Also

    GetIntroductoryPriceDictionary()
    UpdateSubscription(Product, Product, String, Action<Product, String>, Action<String, String>)
    In This Article
    • Constructors
      • SubscriptionManager(String, String, String)
      • SubscriptionManager(Product, String)
    • Methods
      • getSubscriptionInfo()
      • UpdateSubscription(Product, Product, String, Action<Product, String>, Action<String, String>)
      • UpdateSubscriptionInAppleStore(Product, String, Action<Product, String>)
      • UpdateSubscriptionInGooglePlayStore(Product, Product, Action<String, String>)
    • See Also
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023