Skip to main content
Samsung Developer Program

Integrate IAP Functions into Your Android App

IAP Helper API call information and example code to help guide you in integrating IAP into your Android app, and to facilitate development and testing

 

To integrate IAP into your Android app and sell its in-app items:

Your Android app must support these functions (for example, by directing the user to select an item for purchase). 

The procedures in this section include example logic and code, object names, and explanations in order to help guide you in integrating IAP into your Android app, and to facilitate development and testing of your IAP integration. However, other options may be more appropriate for the release version of your Android app. For details about options other than those presented in this section, see the sample app code in the IAP SDK.

 

Example Code Options for Your Android App

The IAP operating mode changes betweens the two developer test modes in order to meet the requirements of development and testing.

Before validation submission (during testing), setting production mode will block all IAP Helper requests.

When your app is being distributed, the IAP operating mode must be set to production mode in order to support actual financial payment for paid Android apps and in-app items.

Example in-app item IDs are hard-coded.

You may find that hard-coding item IDs is advantageous when testing your app, but you may or may not want to hard-code them in production mode.

Item IDs registered in Seller Office to your Android app must be used.

Some item details are hard-coded

In-app item details may be hard-coded; but they must be correct for your items.

getProductsDetails() returns the item details registered in Seller Office.

A UI button click initiates retrieval of in-app items purchased by the user, and offered in-app item details.

Initiate retrieval:

  • During app initialization
  • After item updates in Samsung Seller Office
  • After a set amount of time (to keep item data current)
  • After every startup
  • In response to a user action, such as selecting a purchase item screen

After getting details about one or more in-app items, details are displayed in an alert dialog box without the user able to select or purchase an item.

In-app item details:

  • Display the offered items in a purchase screen.
  • Enable user selection of an item and initiation of an IAP purchase and payment transaction.