public final class PurchasingService
extends java.lang.Object
PurchasingListener
instance via
registerListener(Context, PurchasingListener)
before using any other API.Modifier and Type | Field and Description |
---|---|
static boolean |
IS_SANDBOX_MODE
If true, the SDK is running in Sandbox mode, which only allows
interactions with the Amazon AppTester.
|
static java.lang.String |
SDK_VERSION
Indicates the release version of the API for making in-app purchases.
|
Modifier and Type | Method and Description |
---|---|
static RequestId |
getProductData(java.util.Set<java.lang.String> skus)
Initiates a request to retrieve item data of up to one-hundred
SKUs.
|
static RequestId |
getPurchaseUpdates(boolean reset)
Initiates a request to retrieve updates about items the customer has
purchased and/or canceled.
|
static RequestId |
getUserData()
Initiates a request to retrieve the user ID of the currently logged-in user.
|
static void |
notifyFulfillment(java.lang.String receiptId,
FulfillmentResult fulfillmentResult)
Notifies Amazon about the purchase fulfillment.
|
static RequestId |
purchase(java.lang.String sku)
Initiates a purchase-flow for a product.
|
static void |
registerListener(android.content.Context appContext,
PurchasingListener listener)
Before invoking operations in this class, register a
PurchasingListener and its Context. |
public static final java.lang.String SDK_VERSION
public static final boolean IS_SANDBOX_MODE
public static void registerListener(android.content.Context appContext, PurchasingListener listener)
PurchasingListener
and its Context. After registering your
PurchasingListener implementation, you can receive callbacks from the
in-app purchasing SDK after you invoke operations on PurchasingService.listener
- PurchasingListener
to register.appContext
- application context.public static RequestId getUserData()
PurchasingListener.onUserDataResponse(com.amazon.device.iap.model.UserDataResponse)
gets called when a response is available.public static RequestId purchase(java.lang.String sku)
PurchasingEventListener#onPurchaseResponse(PurchaseResponse)
gets called.sku
- Vendor SKU for which to initiate a purchase.PurchaseResponse
received by the
PurchasingListener.onPurchaseResponse(PurchaseResponse)
callback.public static RequestId getProductData(java.util.Set<java.lang.String> skus)
PurchasingListener.onProductDataResponse(com.amazon.device.iap.model.ProductDataResponse)
gets called.skus
- Set of SKUs. If the size of the set is greater than 100,
an IllegalArgumentException is thrown.ProductDataResponse
received
by the
PurchasingListener.onProductDataResponse(com.amazon.device.iap.model.ProductDataResponse)
callback.public static RequestId getPurchaseUpdates(boolean reset)
PurchasingListener.onPurchaseUpdatesResponse(com.amazon.device.iap.model.PurchaseUpdatesResponse)
(PurchaseUpdatesResponse) gets called.reset
- Set to true to get a list of all purchases. Set to false to
get a list of all purchases made since the last invocation.PurchaseUpdatesResponse
received
by the
PurchasingListener.onPurchaseUpdatesResponse(com.amazon.device.iap.model.PurchaseUpdatesResponse)
callback.public static void notifyFulfillment(java.lang.String receiptId, FulfillmentResult fulfillmentResult)
receiptId
- Receipt ID of the purchase.fulfillmentResult
- Result of the fulfillment.