Skip to main content
Samsung Developer Program

IAP Helper API Methods

IAP Helper provides methods to instantiate a SamsungIapHelper object, get in-app items offered for sale in your Android app, get items purchased by the current end user, and initiate the purchase and payment processing of in-app items.

SamsungIAP_v5_Architecture_IapHelper.png

 

getInstance( )

Instantiates theIapHelper object as a singleton, which enables the processing of IAP API calls.

public static IapHelper getInstance(Context _context)

 

Request Parameters

_context

Context

Required  Android™ context

 

Response

IapHelper object name

 

 

setOperationMode( )

Starting with Samsung IAP v5.0.0.

Implements the IAP operating mode that controls the processing of all IAP Helper API requests.

public void setOperationMode(OperationMode _mode)

 

Request Parameters

_mode

OperationMode

Required  The IAP operating mode that controls the processing of IAP Helper API requests.

OPERATION_MODE
_PRODUCTION

Production Mode

IAP Helper startPayment() requests are processed as specified, financial transactions do occur for successful requests, and actual results are returned (successful or failed).

All other IAP Helper requests requests are processed as specified, and actual results are returned (successful or failed).

Set IAP to this operating mode after you have completed development and testing and before you submit your Android app and its in-app items for validation.

After your Android app is being distributed in Samsung app stores, successful purchase requests will result in financial transactions (for example, end-user credit cards will be billed).

Caution: Setting production mode before validation submission will block all IAP Helper requests and will result in the "Product does not exist" popup. 
SamsungIAP_Overview_ProductDoesNotExistPopup_Screenshot.png

OPERATION_MODE
_TEST

Developer Test Mode (Success)

IAP Helper startPayment() requests are processed as specified, except financial transactions do not occur and successful results are always returned.

All other IAP Helper requests requests are processed as specified, except successful results are always returned.

Caution: You must change to production mode before submitting your Android app for validation, or actual financial transactions will not occur after distribution and will result in the "Payment processing errors may occur" popup.
Popup_PaymentProcessingErrors.png

OPERATION_MODE
_TEST_FAILURE

Developer Test Mode (Failure)

IAP Helper startPayment() requests are not processed, financial transactions do not occur, and failure results are always returned.

All other IAP Helper requests are not processed, and failure results are always returned.

Caution: You must change to production mode before submitting your Android app for validation or actual financial transactions will not occur after distribution and will result in the "Payment processing errors may occur" popup.
Popup_PaymentProcessingErrors.png

 

Response

None

 

getOwnedList( )

Starting with Samsung IAP v5.0.0.

Returns the user-purchased in-app items that have not been consumed (consumable items) or not yet expired (subscription items).  Returns item data and processing results specified by the OnGetOwnedListListener interface.

public void getOwnedList
(
    String _productType, 
    OnGetOwnedListListener _onGetOwnedListListener
)

 

Requests

_productType

String

Required Type of in-app items to be returned:

Item                 Consumable items

Subscription   Auto-recurring subscription items

All                    Both consumable and auto-recurring subscription items

_onGetOwnedListListener

OnGet
OwnedList
Listener

Required  Name of the OnGetOwnedListListener() interface that specifies the item data and processing results to be returned

 

Returns

Item data and processing results specified by OnGetOwnedListListener.

 

 

getProductsDetails( )

Starting with Samsung IAP v5.0.0.

Returns information for one, more, or all in-app items that you registered to the Android app through Seller Office. Returns item data and processing results specified by the OnGetProductsDetailsListener interface.

public void getProductsDetails
(
    String _productIds,
    OnGetProductsDetailsListener _onGetProductDetailsListener
)

 

Request Parameters

_productIds

String

Required One or more in-app item IDs specified by either:

  • Empty string ("") that designates all in-app items
    or
  • One or more unique in-app item ID values, comma delimited (for example, "coins,blocks,lives")

You can get the IDs from Seller Office (Applications > My Applications > [Android app status] > In App Purchase tab > Item ID).

InAppItem_ID.png

_onGetProductDetailsListener

OnGet
ProductDetails
Listener

Required Name of the OnGetProductDetailsListener() interface that specifies the item data and processing results to be returned

 

Response

Item data and processing results specified by OnGetProductsDetailsListener.

 

 

startPayment( )

Initiates purchase and payment transaction of the specified in-app item and can notify the end user of a successful purchase. Returns the item data and transaction results and data specified in theOnPaymentListener interface.

Starting with IAP version 5.0, you can specify a passThroughParam parameter value to enhance purchase security. During purchases with passThroughParam values created and passed by an IAP-integrated application are returned in the responses.

Caution: When in IAP production mode and the Android app is being distributed in Galaxy Apps, successful processing results in actual financial transactions (for example, end-user credit cards will be billed).

public void startPayment
(
    String _itemId, 
    String _passThroughParam,
    boolean _showSuccessDialog, 
    OnPaymentListener _onPaymentListener
)

 

Request Parameters

_itemId

String

Required Unique identifier value of the in-app item to be purchased

_passThroughParam

String

Optional Unique identifier (maximum: 255 bytes) assigned by your Android app to the purchase and payment transaction

When specified, the value will be returned by the IAP Server API call getPurchaseReceipt().

When not specified, "" or null will be returned.

_showSuccessDialog

Boolean

Required After successful purchase and payment transactions, whether or not to display a dialog box that notifies the end user:

true         Display the dialog box.

false        Do not display the dialog box.

_onPaymentListener

OnPayment
Listener

Required  Name of the OnPaymentListener() interface that specifies the purchase and payment transaction data, item data, and processing results to be returned

 

Response

In-app item data and purchase and payment transaction results and data specified by OnPaymentListener.

 

 

consumePurchasedItems( )

Starting with Samsung IAP v5.0.0.

Reporting one or more previously purchased consumable items as consumed makes the items available for another purchase. The end-user may or may not have used the items. Returns item data and processing results specified by the OnConsumePurchasedItemsListener interface.

Note: We recommend that you report purchased consumable items immediately after verifying their purchase was successful, and that you report all items in one consumePurchasedItem() method call in order to avoid system overload or malfuction.  

public void consumePurchasedItems
(
    String _purchaseIds,
    OnConsumePurchasedItemsListener _onConsumePurchasedItemsListener
)

 

Request Parameters

_purchaseIds

String

Required One or more unique identifier values (comma delimited) of the purchase and payment transactions of consumable in-app items that are to be reported as consumed

You can specify IDs that were assigned by Samsung or assigned by you (_passThroughParam).

Caution: Although you can specify one or more in-app items in one or more API calls, we recommend that you specify multiple purchase IDs in one API call to avoid degrading system performance or causing the system to malfunction.

_onConsumePurchased
ItemsListener

OnConsume
PurchasedItems
Listener

Required 
Name of the OnConsumePurchasedItemsListener() interface that specifies the item data and processing results to be returned

 

Response

Item data and processing results specified by OnConsumePurchasedItemsListener.

 

  • Was this article helpful?