-
public class InAppPurchaseLibrary
-
-
Method Summary
Modifier and Type Method Description static voidonReady(Context context, DaemonRequest.Callback callback)Sets a callback to be triggered when Payments operations are available. static voidgetCatalog(Context context, DaemonRequest.Callback callback)Fetches the game's product catalog. static voidgetPurchases(Context context, DaemonRequest.Callback callback)Fetches all of the player's unconsumed purchases. static voidpurchase(Context context, String productID, @Nullable() String developerPayload, DaemonRequest.Callback callback)Begins the purchase flow for a specific product. static voidconsumePurchase(Context context, String purchaseToken, DaemonRequest.Callback callback)Consumes a specific purchase belonging to the current player. static voidgetSubscribableCatalog(Context context, DaemonRequest.Callback callback)Fetches the game's catalog for subscribable products. static voidpurchaseSubscription(Context context, String productID, DaemonRequest.Callback callback)Begins the purchase flow for a specific subscribable product. static voidgetSubscriptions(Context context, DaemonRequest.Callback callback)Fetches all of the player's subscriptions. static voidcancelSubscription(Context context, String purchaseToken, DaemonRequest.Callback callback)Starts the asynchronous process of cancelling an existing subscription. -
-
Method Detail
-
onReady
static void onReady(Context context, DaemonRequest.Callback callback)
Sets a callback to be triggered when Payments operations are available.
- Parameters:
context- the application contextcallback- callback for success and error
-
getCatalog
static void getCatalog(Context context, DaemonRequest.Callback callback)
Fetches the game's product catalog.
- Parameters:
context- the application contextcallback- callback for success and error
-
getPurchases
static void getPurchases(Context context, DaemonRequest.Callback callback)
Fetches all of the player's unconsumed purchases. The game must fetch the current player'spurchases as soon as the client indicates that it is ready to perform payments-relatedoperations, i.e. at game start. The game can then process and consume any purchases that arewaiting to be consumed.
- Parameters:
context- the application contextcallback- callback for success and error
-
purchase
static void purchase(Context context, String productID, @Nullable() String developerPayload, DaemonRequest.Callback callback)
Begins the purchase flow for a specific product.
- Parameters:
context- the application contextproductID- the productID of the item to be purchased, obtained from the catalogdeveloperPayload- the optional string payload to be associated with the purchasecallback- callback for success and error
-
consumePurchase
static void consumePurchase(Context context, String purchaseToken, DaemonRequest.Callback callback)
Consumes a specific purchase belonging to the current player. Before provisioning a product'seffects to the player, the game should request the consumption of the purchased product. Oncethe purchase is successfully consumed, the game should immediately provide the player with theeffects of their purchase.
- Parameters:
context- the application contextpurchaseToken- the purchase token associated with a transactioncallback- callback for success and error
-
getSubscribableCatalog
static void getSubscribableCatalog(Context context, DaemonRequest.Callback callback)
Fetches the game's catalog for subscribable products.
- Parameters:
context- the application contextcallback- callback for success and error
-
purchaseSubscription
static void purchaseSubscription(Context context, String productID, DaemonRequest.Callback callback)
Begins the purchase flow for a specific subscribable product.
- Parameters:
context- the application contextproductID- the productID of the item to be purchased, obtained from the catalogcallback- callback for success and error
-
getSubscriptions
static void getSubscriptions(Context context, DaemonRequest.Callback callback)
Fetches all of the player's subscriptions.
- Parameters:
context- the application contextcallback- callback for success and error
-
cancelSubscription
static void cancelSubscription(Context context, String purchaseToken, DaemonRequest.Callback callback)
Starts the asynchronous process of cancelling an existing subscription. This operation willonly work if the subscription entitlement is active. If the promise is resolved, this is onlyan indication that the cancellation has been kicked off and NOT that it has necessarilysucceeded. The subscription's deactivationTime and isEntitlementActive properties should bequeried for the latest status.
- Parameters:
context- the application contextpurchaseToken- the purchase token associated with a transactioncallback- callback for success and error
-
-
-
-