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.
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 |
String | id | A product identifier. |
String | intro_json | From |
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 |
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 |
Product | oldProduct | Source subscription product, belonging to the same subscription group as |
String | developerPayload | Carried-over metadata from prior call to |
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 |
String | developerPayload | Carried-over metadata from prior call to |
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 |
Product | newProduct | Destination subscription product, belonging to the same subscription group as |
Action<String, String> | googlePlayUpdateCallback | Triggered upon completion of the subscription update. |