Interface IPurchaseService
Public Interface for a service responsible for ordering products, fetching previous purchases and validating product entitlements. 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 IPurchaseService
Properties
Apple
Apple Specific Purchase Extensions
Declaration
IAppleStoreExtendedPurchaseService? Apple { get; }
Property Value
Type | Description |
---|---|
IApple |
Google Specific Purchase Extensions
Declaration
IGooglePlayStoreExtendedPurchaseService? Google { get; }
Property Value
Type | Description |
---|---|
IGoogle |
Methods
AddCheckEntitlementAction(Action<Entitlement>?)
Add an action to be called when a check for product entitlement is complete.
Declaration
void AddCheckEntitlementAction(Action<Entitlement>? checkEntitlementAction)
Parameters
Type | Name | Description |
---|---|---|
Action<Entitlement> | checkEntitlementAction | The action to be added to the list of callbacks. |
AddConfirmedOrderUpdatedAction(Action<ConfirmedOrder>?)
Add an action to be called when product orders are confirmed.
Declaration
void AddConfirmedOrderUpdatedAction(Action<ConfirmedOrder>? updatedAction)
Parameters
Type | Name | Description |
---|---|---|
Action<Confirmed |
updatedAction | The action to be added to the list of callbacks. |
AddFetchPurchasesFailedAction(Action<PurchasesFetchFailureDescription>?)
Add an action to be called when an attempt to fetch previous purchases has failed.
Declaration
void AddFetchPurchasesFailedAction(Action<PurchasesFetchFailureDescription>? failedAction)
Parameters
Type | Name | Description |
---|---|---|
Action<Purchases |
failedAction | The action to be added to the list of callbacks. |
AddFetchedPurchasesAction(Action<Orders>?)
Add an action to be called when previous purchases are fetched.
Declaration
void AddFetchedPurchasesAction(Action<Orders>? updatedAction)
Parameters
AddPendingOrderUpdatedAction(Action<PendingOrder>?)
Add an action to be called when products are ordered.
Declaration
void AddPendingOrderUpdatedAction(Action<PendingOrder>? updatedAction)
Parameters
Type | Name | Description |
---|---|---|
Action<Pending |
updatedAction | The action to be added to the list of callbacks. |
AddPurchaseDeferredAction(Action<DeferredOrder>?)
Add an action to be called when products orders are deferred.
Declaration
void AddPurchaseDeferredAction(Action<DeferredOrder>? deferredAction)
Parameters
Type | Name | Description |
---|---|---|
Action<Deferred |
deferredAction | The action to be added to the list of callbacks. |
AddPurchaseFailedAction(Action<FailedOrder>?)
Add an action to be called when products orders fail.
Declaration
void AddPurchaseFailedAction(Action<FailedOrder>? failedAction)
Parameters
Type | Name | Description |
---|---|---|
Action<Failed |
failedAction | The action to be added to the list of callbacks. |
ConfirmOrder(PendingOrder)
Confirm a pending order.
Declaration
void ConfirmOrder(PendingOrder order)
Parameters
Type | Name | Description |
---|---|---|
Pending |
order | The pending order to confirm. |
FetchPurchases()
Fetch pre-existing purchases.
Declaration
void FetchPurchases()
GetPurchases()
Gets an observable collection of the purchases fetched, confirmed and ordered.
Declaration
ReadOnlyObservableCollection<Order> GetPurchases()
Returns
Type | Description |
---|---|
Read |
The read-only observable collection of all purchases made. |
IsProductEntitled(Product)
Check if a Product has been entitled.
Declaration
void IsProductEntitled(Product product)
Parameters
Type | Name | Description |
---|---|---|
Product | product | The Product to check for entitlements. |
Purchase(ICart)
Purchase a cart.
Declaration
void Purchase(ICart cart)
Parameters
Type | Name | Description |
---|---|---|
ICart | cart | The cart to purchase. |
PurchaseProduct(Product)
Purchase a product.
Declaration
void PurchaseProduct(Product product)
Parameters
Type | Name | Description |
---|---|---|
Product | product | The Product to purchase. |
RemoveCheckEntitlementAction(Action<Entitlement>?)
Remove an action to be called when a check for product entitlement is complete.
Declaration
void RemoveCheckEntitlementAction(Action<Entitlement>? checkEntitlementAction)
Parameters
Type | Name | Description |
---|---|---|
Action<Entitlement> | checkEntitlementAction | The action to be added to the list of callbacks. |
RemoveConfirmedOrderUpdatedAction(Action<ConfirmedOrder>?)
Remove an action to be called when product orders are confirmed.
Declaration
void RemoveConfirmedOrderUpdatedAction(Action<ConfirmedOrder>? updatedAction)
Parameters
Type | Name | Description |
---|---|---|
Action<Confirmed |
updatedAction | The action to be removed from the list of callbacks. |
RemoveFetchPurchasesFailedAction(Action<PurchasesFetchFailureDescription>?)
Remove an action to be called when an attempt to fetch previous purchases has failed.
Declaration
void RemoveFetchPurchasesFailedAction(Action<PurchasesFetchFailureDescription>? failedAction)
Parameters
Type | Name | Description |
---|---|---|
Action<Purchases |
failedAction | The action to be removed from the list of callbacks. |
RemoveFetchedPurchasesAction(Action<Orders>?)
Remove an action to be called when previous purchases are fetched.
Declaration
void RemoveFetchedPurchasesAction(Action<Orders>? updatedAction)
Parameters
Type | Name | Description |
---|---|---|
Action<Orders> | updatedAction | The action to be removed from the list of callbacks. |
RemovePendingOrderUpdatedAction(Action<PendingOrder>?)
Remove an action to be called when products are ordered.
Declaration
void RemovePendingOrderUpdatedAction(Action<PendingOrder>? updatedAction)
Parameters
Type | Name | Description |
---|---|---|
Action<Pending |
updatedAction | The action to be removed from the list of callbacks. |
RemovePurchaseFailedAction(Action<FailedOrder>?)
Remove an action to be called when products orders fail.
Declaration
void RemovePurchaseFailedAction(Action<FailedOrder>? failedAction)
Parameters
Type | Name | Description |
---|---|---|
Action<Failed |
failedAction | The action to be removed from the list of callbacks. |
RestoreTransactions(Action<bool, string?>)
Initiate a request to restore previously made purchases.
Declaration
void RestoreTransactions(Action<bool, string?> callback)