com.amazon.InApp.transaction
Class TransactionManager

java.lang.Object
  extended by com.amazon.InApp.transaction.TransactionManager

public final class TransactionManager
extends java.lang.Object

The TransactionManager presents the primary API for interacting with the In-App Transaction SDK. Before using operations in this class, you must first register an TransactionObserver instance via registerObserver(TransactionObserver).


Method Summary
static java.lang.String initiateContentDownloadRequest(java.lang.String sku, java.lang.String location)
          Initiate a request to download content for the given SKU to the given filesystem location.
static java.lang.String initiateItemDataRequest(java.util.Set<java.lang.String> skus)
          Initiate a request to retrieve item data for one or more SKUs.
static java.lang.String initiatePurchaseRequest(java.lang.String sku)
          Initiate a request to purchase a SKU.
static java.lang.String initiateReceiptDataRequest(Offset offset)
           Initiate a request to retrieve receipts for previous transactions, including non-consumable purchases, subscriptions and subscription renewals.
static java.lang.String initiateRevokedSkusDataRequest(Offset offset)
           Initiate a request to retrieve revoked SKUs.
static void registerObserver(TransactionObserver transactionObserver)
          You must register a TransactionObserver before invoking operations in this class.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

registerObserver

public static void registerObserver(TransactionObserver transactionObserver)
You must register a TransactionObserver before invoking operations in this class. Good practice is to do this in your Activity's onStart lifecycle method.

Parameters:
transactionObserver - The TransactionObserver to register

initiatePurchaseRequest

public static java.lang.String initiatePurchaseRequest(java.lang.String sku)
Initiate a request to purchase a SKU. When a response is available, you will be notified with TransactionObserver.notifyPurchaseResponse(PurchaseResponse).

Parameters:
sku - The vendor SKU to initiate a purchase for
Returns:
a request ID that you can use to associate this request with the PurchaseResponse received by the TransactionObserver.notifyPurchaseResponse(PurchaseResponse) callback.

initiateItemDataRequest

public static java.lang.String initiateItemDataRequest(java.util.Set<java.lang.String> skus)
Initiate a request to retrieve item data for one or more SKUs. When a response is available, you will be notified with TransactionObserver.notifyItemDataResponse(ItemDataResponse).

Parameters:
skus - A set of SKUs you wish to retrieve Item data for.
Returns:
a request ID that you can use to associate this request with the ItemDataResponse received by the TransactionObserver.notifyItemDataResponse(ItemDataResponse) callback.

initiateContentDownloadRequest

public static java.lang.String initiateContentDownloadRequest(java.lang.String sku,
                                                              java.lang.String location)
Initiate a request to download content for the given SKU to the given filesystem location.

Parameters:
sku - The SKU to download content for. This should be a SKU that has content, as indicated by Receipt.isContentAvailable().
location - The filesystem location that content should be downloaded to. This location should have enough space for the content and should be publicly writable.
Returns:
a request ID that you can use to associate this request with a ContentDownloadResponse received by the TransactionObserver.notifyContentDownloadResponse(ContentDownloadResponse) callback.

initiateReceiptDataRequest

public static java.lang.String initiateReceiptDataRequest(Offset offset)

Initiate a request to retrieve receipts for previous transactions, including non-consumable purchases, subscriptions and subscription renewals. Does not return receipts for consumable purchases.

This operation works with paginated data. The beginning of the data set is specified by the Offset you provide here. The response will contain an Offset marking the beginning of the next data set, if more is available.

Parameters:
offset - Marks the beginning of the data set
Returns:
a request ID that you can use to associate this request with the ReceiptDataResponse received by the TransactionObserver.notifyReceiptDataResponse(ReceiptDataResponse) callback.

initiateRevokedSkusDataRequest

public static java.lang.String initiateRevokedSkusDataRequest(Offset offset)

Initiate a request to retrieve revoked SKUs. These SKUs represent in-app items such as non-consumables and subscriptions that the customer no longer has access to. Non-consumable items cannot be revoked.

This operation works with paginated data. The beginning of the data set is specified by the Offset you provide here. The response will contain an Offset marking the beginning of the next data set, if more is available.

Parameters:
offset - Marks the beginning of the data set
Returns:
a request ID that you can use to associate this request with the RevokedSkuDataResponse received by the TransactionObserver.notifyRevokedSkuDataResponse(RevokedSkuDataResponse) callback.