IAP Plugin Methods and Events
This document gives an overview of the available methods and events for the In-App Purchasing (IAP) v2.0 plugin for all the supported cross-platform engines.
Plugin Methods
Requests are initiated by the developer as method calls. The following table describes the available methods. Methods with return type of RequestOutput
will receive an asynchronous Event (a system-generated message). Parameters and events are described in the Supporting Data Objects table below.
Return Type | Method | Method Summary | Event |
---|---|---|---|
RequestOutput | GetUserData() | Initiates a request to retrieve the user ID and marketplace of the currently logged-in user. | GetUserDataResponse |
RequestOutput | Purchase(SkuInput input) | Initiates a purchase-flow for a product. | PurchaseResponse |
RequestOutput | GetProductData(SkusInput input) | Initiates a request to retrieve item data for up to one hundred SKUs. | GetProductDataResponse |
RequestOutput | GetPurchaseUpdates(ResetInput input) | Initiates a request to retrieve updates about items the customer has purchased and/or cancelled. | GetPurchaseUpdatesResponse |
void | NotifyFulfillment(NotifyFulfillmentInput input) | Notifies Amazon about the purchase fulfillment. | None |
Supporting Data Objects
Objects used as method and event parameters are described in the following table.
Object | Members | Description |
---|---|---|
AmazonUserData | string userId |
The user ID. |
string marketplace |
The two-character ISO 3166-1 Alpha-2 code denoting the marketplace of the user. Can be null if the marketplace information is not available; this may happen with previous versions of the Amazon Appstore. | |
GetProductDataResponse | string requestId |
The request ID originally returned by GetProductData . |
ProductDataMap productDataMap |
See ProductDataMap. | |
List < string > unavaliableSkus |
The list of SKUs provided in the original request for which product data is not available. | |
string status |
One of SUCCESSFUL, NOT_SUPPORTED, or FAILED. SUCCESSFUL indicates a successful request. NOT_SUPPORTED indicates this call is not supported. FAILED indicates an unsuccessful request. | |
GetPurchaseUpdatesResponse | string requestId |
The request ID originally returned by GetPurchaseUpdates . |
AmazonUserData amazonUserData |
See AmazonUserData. | |
List <PurchaseReceipt> receipts |
Returns a list of receipts, or an empty list if status is not SUCCESSFUL or there are no receipts. | |
string status |
One of SUCCESSFUL, NOT_SUPPORTED, or FAILED. SUCCESSFUL indicates a successful request. NOT_SUPPORTED indicates this call is not supported. FAILED indicates an unsuccessful request. | |
boolean hasMore |
True if more results are available. | |
GetUserDataResponse | string requestId |
The request ID originally returned by GetUserData . |
AmazonUserData amazonUserData |
See AmazonUserData. | |
string status |
One of SUCCESSFUL, NOT_SUPPORTED, or FAILED. SUCCESSFUL indicates a successful request. NOT_SUPPORTED indicates this call is not supported. FAILED indicates an unsuccessful request. | |
NotifyFulfillmentInput | string receiptId |
A receipt ID is a unique identifier of a purchase and is returned as part of the purchase response. |
string fulfillmentResult |
Either FULFILLED or UNAVAILABLE. FULFILLED means the app successfully fulfilled the purchase. Calling with this status forces the Amazon Appstore to mark this purchase as successfully completed. UNAVAILABLE means the purchase can never be fulfilled by the app. Calling with this status forces the Amazon Appstore to cancel the purchase. | |
ProductData | string sku |
The SKU of the purchase. |
string productType |
The type of product. Can be CONSUMABLE, ENTITLED or SUBSCRIPTION. See Understanding In-App Purchasing for more information. | |
string price |
The price of the product, including the currency symbol and the numerical value. In the case of a subscription parent product, this is null. | |
string title |
The localized title of the product. If no title for the locale, returns the default (English). | |
string description |
The localized description of the product. If no description for the locale, returns the default (English). | |
string smallIconUrl |
The URL of the small icon. | |
ProductDataMap | key: string sku |
A map using a SKU as the key and a ProductData object as the value. |
value: ProductData productData |
||
PurchaseReceipt | string receiptId |
A receipt ID, which is a unique identifier of a purchase. |
long cancelDate |
The cancel date for the purchase, in milliseconds since January 1, 1970, 00:00:00 GMT, or 0 if it is not canceled. | |
long purchaseDate |
The purchase date for the purchase, in milliseconds since January 1, 1970, 00:00:00 GMT. | |
string sku |
The SKU of the purchase. In the case of subscriptions, this SKU represents the subscription, not a specific term. Examine the PurchaseDate and CancelDate to determine the start and end dates of the subscription. |
|
string productType |
The type of product. Can be CONSUMABLE, ENTITLED or SUBSCRIPTION. See Understanding In-App Purchasing for more information. | |
PurchaseResponse | string requestId |
The request ID originally returned by Purchase . |
AmazonUserData amazonUserData |
See AmazonUserData. | |
PurchaseReceipt purchaseReceipt |
See PurchaseReceipt. | |
string status |
One of SUCCESSFUL, NOT_SUPPORTED, FAILED, INVALID_SKU, or ALREADY_PURCHASED. SUCCESSFUL indicates a successful request. NOT_SUPPORTED indicates this call is not supported. FAILED indicates an unsuccessful request. INVALID_SKU indicates that the SKU originally provided to the Purchase operation is not valid. ALREADY_PURCHASED indicates that the customer already owns the provided SKU. |
|
RequestOutput | string requestId |
A unique ID of an in-app purchasing request. |
ResetInput | boolean 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. |
SkuInput | string sku |
A SKU is a unique identifier for a purchasable product. A SKU is unique to each developer account with the Amazon Appstore. It is a case-sensitive string containing only alphanumerics, underscores, periods, and dashes. It must be 150 characters or less. |
SkusInput | List <string> skus |
A list of SKUs. |