Skip to main content
Samsung Developer Program

IAP Helper API Calls

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).
 

Only 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 that: financial transactions do not occur and successful results are always returned.

All other IAP Helper requests requests are processed as specified, except that 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 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 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  Kind 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 or more 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 consumePurchasedItems
(
    String _purchaseIds,
    OnGetProductsDetailsListener _onGetProductDetailsListener
)

 

Request Parameters

_purchaseIds

String

Required  One or more unique identifier values (comma delimited) of the in-app items

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, can notify the end user of a successful purchase. Returns the item data and transaction results and data specified in theOnPaymentListener interface.

Caution: When in IAP production mode and the Android app is being distributed in Galaxy Apps, successful processing will result in an 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 Anrdoid 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 processing, whether or not to display a dialog box that notifies the end user that purchasing was successful:

true         Display the dialog box.

false        Do not display the dialog box.

Note:  When the dialog box is not displayed, your Android app must inform the end user when the item was successfully purchased.

_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.

Registers one or more consumable in-app items that was previously purchased as being used by the end-user, which makes the items available for another purchase. Returns item data and processing results specified by the OnConsumePurchasedItemsListener interface.

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: While 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?