Class StoreService
Main class for communication between the library and the application's code.It provides methods for in-app billing. You can create one instance of this class for your application and use it to process in-app billing operations. All methods can be called from the UI thread and asynchronous callbacks are returned on the UI thread.
Inherited Members
Namespace: UnityEngine.UDP
Syntax
public class StoreService
Constructors
StoreService()
Declaration
public StoreService()
Properties
StoreName
Return the current store name.
Declaration
public static string StoreName { get; }
Property Value
Type | Description |
---|---|
String |
Methods
ConsumePurchase(List<PurchaseInfo>, IPurchaseListener)
Consume multiple purchases of consumable products.
Declaration
public static void ConsumePurchase(List<PurchaseInfo> purchaseInfos, IPurchaseListener listener)
Parameters
Type | Name | Description |
---|---|---|
List<PurchaseInfo> | purchaseInfos | PurchaseInfo that needs to be consumed |
IPurchaseListener | listener | IPurchaseListener that will be triggered when consuming finishes |
ConsumePurchase(PurchaseInfo, IPurchaseListener)
Consume a purchase of a consumable product. Users must consume the product before they can repurchase the same product.
Declaration
public static void ConsumePurchase(PurchaseInfo purchaseInfo, IPurchaseListener listener)
Parameters
Type | Name | Description |
---|---|---|
PurchaseInfo | purchaseInfo | the purchase information returned by OnPurchase(PurchaseInfo) |
IPurchaseListener | listener | IPurchaseListener that will be triggered when consuming finishes |
EnableDebugLogging(Boolean)
Enable debug log.
Declaration
public static void EnableDebugLogging(bool enable)
Parameters
Type | Name | Description |
---|---|---|
Boolean | enable | if debug log is enabled |
EnableDebugLogging(Boolean, String)
Enable debug log with custom tag.
Declaration
public static void EnableDebugLogging(bool enable, string tag)
Parameters
Type | Name | Description |
---|---|---|
Boolean | enable | if debug log is enabled |
String | tag | Tag will only works on Android part |
Initialize(IInitListener, AppInfo)
Initialize UDP SDK. This method should be called in Awake() or Start().
Declaration
public static void Initialize(IInitListener listener, AppInfo appInfo = null)
Parameters
Type | Name | Description |
---|---|---|
IInitListener | listener | IInitListener that will be triggered when initialization finishes |
AppInfo | appInfo | App information. This is normally automatically retrieved. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the platform is not right |
LicenseCheck(ILicensingListener)
Query the current store at runtime to obtain the licensing status for the current user, then allow or prevent further use as appropriate.
Declaration
public static void LicenseCheck(ILicensingListener licensingListener)
Parameters
Type | Name | Description |
---|---|---|
ILicensingListener | licensingListener |
Purchase(String, String, String, IPurchaseListener)
Purchase API. (Obsolete)
Declaration
[Obsolete("gameOrderId will not be passed and will be generated automatically to make sure of its uniqueness")]
public static void Purchase(string productId, string gameOrderId, string developerPayload, IPurchaseListener listener)
Parameters
Type | Name | Description |
---|---|---|
String | productId | |
String | gameOrderId | |
String | developerPayload | |
IPurchaseListener | listener |
Purchase(String, String, IPurchaseListener)
Purchase API.
Declaration
public static void Purchase(string productId, string developerPayload, IPurchaseListener listener)
Parameters
Type | Name | Description |
---|---|---|
String | productId | The id of the product to be purchased |
String | developerPayload | developer's payload |
IPurchaseListener | listener | Callback triggered when purchase finishes |
QueryInventory(List<String>, IPurchaseListener)
Query inventory with product IDs. This returns the information of queried products and unconsumed purchases.
Declaration
public static void QueryInventory(List<string> productIds, IPurchaseListener listener)
Parameters
Type | Name | Description |
---|---|---|
List<String> | productIds | a list of product IDs |
IPurchaseListener | listener | IPurchaseListener that will be triggered when querying finishes |
QueryInventory(IPurchaseListener)
Returns the information of queried products and unconsumed purchases. Some stores may not return unconsumed purchases.
Declaration
public static void QueryInventory(IPurchaseListener listener)
Parameters
Type | Name | Description |
---|---|---|
IPurchaseListener | listener | IPurchaseListener that will be triggered when querying finishes |