-
public class InAppPurchaseLibrary
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringPRODUCT_IDpublic final static StringPURCHASE_TOKENpublic final static StringDEVELOPER_PAYLOAD
-
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 voidonReady(Context context, @Nullable() JSONObject parameters, DaemonRequest.Callback callback)Sets a callback to be triggered when Payments operations are available. static voidgetCatalog(Context context, @Nullable() JSONObject parameters, DaemonRequest.Callback callback)Fetches the game's product catalog. static voidgetPurchases(Context context, @Nullable() JSONObject parameters, DaemonRequest.Callback callback)Fetches all of the player's unconsumed purchases. static voidpurchase(Context context, JSONObject parameters, DaemonRequest.Callback callback)Begins the purchase flow for a specific product. static voidconsumePurchase(Context context, JSONObject parameters, DaemonRequest.Callback callback)Consumes a specific purchase belonging to the current player. -
-
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
-
onReady
static void onReady(Context context, @Nullable() JSONObject parameters, DaemonRequest.Callback callback)
Sets a callback to be triggered when Payments operations are available.
- Parameters:
context- the application contextparameters- {}callback- callback for success and error
-
getCatalog
static void getCatalog(Context context, @Nullable() JSONObject parameters, DaemonRequest.Callback callback)
Fetches the game's product catalog.
- Parameters:
context- the application contextparameters- {}callback- callback for success and error
-
getPurchases
static void getPurchases(Context context, @Nullable() JSONObject parameters, 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 contextparameters- {}callback- callback for success and error
-
purchase
static void purchase(Context context, JSONObject parameters, DaemonRequest.Callback callback)
Begins the purchase flow for a specific product.
- Parameters:
context- the application contextparameters- { PRODUCT_ID: , DEVELOPER_PAYLOAD (optional):callback- callback for success and error
-
consumePurchase
static void consumePurchase(Context context, JSONObject parameters, 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 contextparameters- { PURCHASE_TOKEN: }callback- callback for success and error
-
-
-
-