Interface IProductService
A service responsible for fetching and storing products available for purchase. Tasks requiring a connection to Stores (Apple App Store or Google Play Store for example) executed without ConnectionState.Connected will throw a StoreConnectionException.
Namespace: UnityEngine .Purchasing
Assembly: Unity.Purchasing.dll
Syntax
public interface IProductService
Properties
Amazon
Amazon Specific Product Extensions
Declaration
IAmazonAppsExtendedProductService? Amazon { get; }
Property Value
Type | Description |
---|---|
IAmazon |
Apple
Apple Specific Product Extensions
Declaration
IAppleStoreExtendedProductService? Apple { get; }
Property Value
Type | Description |
---|---|
IApple |
Methods
AddProductsFetchFailedAction(Action<ProductFetchFailed>)
Add an action to be called when an attempt to fetch products has failed.
Declaration
void AddProductsFetchFailedAction(Action<ProductFetchFailed> failedAction)
Parameters
Type | Name | Description |
---|---|---|
Action<Product |
failedAction | The action to be added to the list of callbacks. |
AddProductsUpdatedAction(Action<List<Product>>)
Add an action to be called when products are successfully fetched.
Declaration
void AddProductsUpdatedAction(Action<List<Product>> updatedAction)
Parameters
Type | Name | Description |
---|---|---|
Action<List<Product>> | updatedAction | The action to be added to the list of callbacks. |
FetchProducts(List<ProductDefinition>?, IRetryPolicy?)
Fetches products matching the set of definitions passed as input.
Declaration
void FetchProducts(List<ProductDefinition>? productDefinitions, IRetryPolicy? retryPolicy)
Parameters
Type | Name | Description |
---|---|---|
List<Product |
productDefinitions | The definitions of the products to be fetched. |
IRetry |
retryPolicy | A custom retry policy that can be used for the fetch products query. If unspecified, an exponential backoff retry policy will be used. |
FetchProductsWithNoRetries(List<ProductDefinition>?)
Fetches products matching the set of definitions passed as input.
Declaration
void FetchProductsWithNoRetries(List<ProductDefinition>? productDefinitions)
Parameters
Type | Name | Description |
---|---|---|
List<Product |
productDefinitions | The definitions of the products to be fetched. |
GetProducts()
Gets the collection of all products that have been fetched successfully.
Declaration
ReadOnlyObservableCollection<Product> GetProducts()
Returns
Type | Description |
---|---|
Read |
An observable collection of the products already fetched. |
RemoveProductsFetchFailedAction(Action<ProductFetchFailed>)
Remove an action to be called when an attempt to fetch products has failed.
Declaration
void RemoveProductsFetchFailedAction(Action<ProductFetchFailed> failedAction)
Parameters
Type | Name | Description |
---|---|---|
Action<Product |
failedAction | The action to be removed from the list of callbacks. |
RemoveProductsUpdatedAction(Action<List<Product>>)
Remove an action to be called when products are successfully fetched.
Declaration
void RemoveProductsUpdatedAction(Action<List<Product>> updatedAction)