Class ExtensiblePurchaseService
An abstract store service to extend an existing Purchase Service which will handle all of the basic IPurchaseService implementations The main purpose of this is to allow a custom store to add implementations of extended features to this service. The calls to IPurchaseService are kept virtual so that the derivations of the base store implementing them can be added to or overridden.
Implements
Inherited Members
Namespace: UnityEngine .Purchasing
Assembly: Unity.Purchasing.dll
Syntax
public abstract class ExtensiblePurchaseService : IPurchaseService
Constructors
ExtensiblePurchaseService(IPurchaseService)
Constructor to be used by derived classes
Declaration
protected ExtensiblePurchaseService(IPurchaseService basePurchaseService)
Parameters
Type | Name | Description |
---|---|---|
IPurchase |
basePurchaseService | The base service implementation which implements IProductService |
Properties
Apple
Apple Specific Purchase Extensions
Declaration
public virtual IAppleStoreExtendedPurchaseService Apple { get; }
Property Value
Type | Description |
---|---|
IApple |
Google Specific Purchase Extensions
Declaration
public virtual 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
public virtual 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
public virtual 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
public virtual 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
public virtual void AddFetchedPurchasesAction(Action<Orders> updatedAction)
Parameters
AddPendingOrderUpdatedAction(Action<PendingOrder>)
Add an action to be called when products are ordered.
Declaration
public virtual 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
public virtual 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
public virtual 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
public virtual void ConfirmOrder(PendingOrder order)
Parameters
Type | Name | Description |
---|---|---|
Pending |
order | The pending order to confirm. |
FetchPurchases()
Fetch pre-existing purchases.
Declaration
public virtual void FetchPurchases()
GetPurchases()
Gets an observable collection of the purchases fetched, confirmed and ordered.
Declaration
public virtual 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
public virtual void IsProductEntitled(Product product)
Parameters
Type | Name | Description |
---|---|---|
Product | product | The Product to check for entitlements. |
Purchase(ICart)
Purchase a cart.
Declaration
public virtual void Purchase(ICart cart)
Parameters
Type | Name | Description |
---|---|---|
ICart | cart | The cart to purchase. |
PurchaseProduct(Product)
Purchase a product.
Declaration
public virtual 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
public virtual 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
public virtual 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
public virtual 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
public virtual 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
public virtual 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
public virtual 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
public virtual void RestoreTransactions(Action<bool, string> callback)
Parameters
Type | Name | Description |
---|---|---|
Action<bool, string> | callback | Action will be called when the request to restore transactions comes back. The bool will be true if it was successful or false if it was not. The string is an optional error message. |