Class UnityIAPServices
Unity IAP Services Entry Point
Inherited Members
Namespace: UnityEngine .Purchasing
Assembly: Unity.Purchasing.dll
Syntax
public static class UnityIAPServices
Methods
AddNewCustomStore(IStoreWrapper)
Add a new custom store which can then be referenced by name to get its services. This will register the store with IAP. If no custom services are added via the other functions, a generic StoreService, ProductService and PurchaseService will be created to drive the custom store with no extended features.
Declaration
public static void AddNewCustomStore(IStoreWrapper customStoreWrapper)
Parameters
Type | Name | Description |
---|---|---|
IStore |
customStoreWrapper | The implementation of the store wrapper for the custom store, |
AddNewExtendedProductService(string, Func<IProductService, ExtensibleProductService>)
Add a function for a new custom Product Service, the result of which will be retained and maintained by the API.
This function assumes that the interface of IProductService will be the SDK's generic once and that extension and configuration implementations will be added to the derived version of ExtensibleProductService
.
Declaration
public static void AddNewExtendedProductService(string storeName, Func<IProductService, ExtensibleProductService> createProductService)
Parameters
Type | Name | Description |
---|---|---|
string | storeName | |
Func<IProduct |
createProductService | A function to return an instance of the custom |
AddNewExtendedPurchaseService(string, Func<IPurchaseService, ExtensiblePurchaseService>)
Add a function for a new custom Purchase Service, the result of which will be retained and maintained by the API.
This function assumes that the interface of IPurchaseService will be the SDK's generic once and that extension and configuration implementations will be added to the derived version of ExtensiblePurchaseService
.
Declaration
public static void AddNewExtendedPurchaseService(string storeName, Func<IPurchaseService, ExtensiblePurchaseService> createPurchaseService)
Parameters
Type | Name | Description |
---|---|---|
string | storeName | |
Func<IPurchase |
createPurchaseService | A function to return an instance of the custom |
AddNewExtendedStoreService(string, Func<IStoreService, ExtensibleStoreService>)
Add a function for a new custom StoreService, the result of which will be retained and maintained by the API.
This function assumes that the interface of IStoreService will be the SDK's generic once and that extension and configuration implementations will be added to the derived version of ExtensibleStoreService
.
Declaration
public static void AddNewExtendedStoreService(string storeName, Func<IStoreService, ExtensibleStoreService> createStoreService)
Parameters
Type | Name | Description |
---|---|---|
string | storeName | |
Func<IStore |
createStoreService | A function to return an instance of the custom |
AddNewProductService(string, Func<IProductService>)
Add a function for a new custom Product Service, the result of which will be retained and maintained by the API. This function assumes that all of the interface of IProductService has been implemented from scratch.
Declaration
public static void AddNewProductService(string storeName, Func<IProductService> createProductService)
Parameters
Type | Name | Description |
---|---|---|
string | storeName | |
Func<IProduct |
createProductService | A function to return an instance of the Product Service. Normally this will be called only once upon first reference and calling Store(storeName) will always return the same instance. |
AddNewPurchaseService(string, Func<IPurchaseService>)
Add a function for a new custom Purchase Service, the result of which will be retained and maintained by the API. This function assumes that all of the interface of IPurchaseService has been implemented from scratch.
Declaration
public static void AddNewPurchaseService(string storeName, Func<IPurchaseService> createPurchaseService)
Parameters
Type | Name | Description |
---|---|---|
string | storeName | |
Func<IPurchase |
createPurchaseService | A function to return an instance of the Purchase Service. Normally this will be called only once upon first reference and calling Store(storeName) will always return the same instance. |
AddNewStoreService(string, Func<IStoreService>)
Add a function for a new custom StoreService, the result of which will be retained and maintained by the API. This function assumes that all of the interface of IStoreService has been implemented from scratch.
Declaration
public static void AddNewStoreService(string storeName, Func<IStoreService> createStoreService)
Parameters
Type | Name | Description |
---|---|---|
string | storeName | |
Func<IStore |
createStoreService | A function to return an instance of the Store Service. Normally this will be called only once upon first reference and calling Store(storeName) will always return the same instance. |
DefaultProduct()
A service responsible for fetching and storing products available for purchase from the default store.
Declaration
public static IProductService DefaultProduct()
Returns
Type | Description |
---|---|
IProduct |
DefaultPurchase()
A service responsible for ordering products, fetching previous purchases from the default store and validating product entitlements.
Declaration
public static IPurchaseService DefaultPurchase()
Returns
Type | Description |
---|---|
IPurchase |
DefaultStore()
A service responsible for connecting to the default store and its extensions.
Declaration
public static IStoreService DefaultStore()
Returns
Type | Description |
---|---|
IStore |
Product(string)
A service responsible for fetching and storing products available for purchase.
Declaration
public static IProductService Product(string storeName)
Parameters
Type | Name | Description |
---|---|---|
string | storeName | The name of the store for which to get the service. |
Returns
Type | Description |
---|---|
IProduct |
Purchase(string)
A service responsible for ordering products, fetching previous purchases from the store indicated and validating product entitlements.
Declaration
public static IPurchaseService Purchase(string storeName)
Parameters
Type | Name | Description |
---|---|---|
string | storeName | The name of the store for which to get the service. |
Returns
Type | Description |
---|---|
IPurchase |
SetStoreAsDefault(string)
Sets a different store as the default. Useful for using custom stores.
Declaration
public static void SetStoreAsDefault(string storeName)
Parameters
Type | Name | Description |
---|---|---|
string | storeName | The name of the store and therefore services to be referenced by default by internal and external calls. |
Store(string)
A service responsible for connecting to a store and its extensions.
Declaration
public static IStoreService Store(string storeName)
Parameters
Type | Name | Description |
---|---|---|
string | storeName | The name of the store for which to get the service. |
Returns
Type | Description |
---|---|
IStore |