Skip to main content
Samsung Developer Program

Integrate IAP Client

In your IDE, you must create an Android app project and add IAP Client to it.

 

Starting with IAP v3.0, apps are sorted by their package name. You must specify the app's package name that is registered in Seller Office in order to test IAP and prevent processing errors, because the Android app is separated by PackageName instead of ItemGroupId. 

Note: Samsung IAP Client was previously known as Samsung IAP Helper.

 

To create a new Android project:

  • Android Studio 2.3.3 is the IDE used in this procedure and throughout this guide.
  1. In Android Studio, click File > New > Project.
  2. Specify the app name and its package name, and click Next.
    In the SDK example, the app name is IAP5Sample, and its package name is iap5helper.sample.example.
     
  3. Set Minimum SDK: (API 14 or higher), and click Next.
  4. Select an Empty Activity, and click Next.
  5. Use the default Activity and Layout names, and click Finish.

 

To add IAP Client to your Android app project:

  • Your Android app must specify that its minimum SDK is API 14 or higher. 
  • In the procedure, you must specify the package name registered to your Android app.
     
  1. In Project Explorer:
    1. Right-click [Project name] > New > Module.
      In the SDK example, the project name is IAP5Sample.
    2. Select Import Gradle Project, and click Next.
       
  2. In a local browser, navigate to the IAP5Helper folder in the Source Directory, then click Finish to add the project.
  3. In Project Explorer:
    1. Select [Project name].
    2. Right-click [Project name], then select Open Module Settings.
       
  4. In the Project Structure screen:
    1. Select IAP5Sample Modules, and click the Dependencies tab.
    2. Click the + button.
       
  5. In the Choose Modules screen, select IAP5Helper, and click OK.

 

Modify the AndroidManifest.xml File 

When integrating Samsung IAP functionality, the following privilege and activity additions must not be changed from what is presented in this section. We recommend that you copy and paste and  included as annotations in the IAP Client project within the AndroidManifest.xml file.

  • Privileges:
    • com.samsung.android.iap.permission.BILLING privilege to link to IAP functionality in Samsung Billing.
    • android.permission.INTERNET privilege, because IAP uses network communication.
       
  • Transparent activities:
    • com.samsung.android.sdk.iap.lib.activity.OwnedProductActivityto request the owned items list.
    • com.samsung.android.sdk.iap.lib.activity.ProductActivity to request in-app item details.
    • com.samsung.android.sdk.iap.lib.activity.PaymentActivity to request an in-app item purchase.
    • com.samsung.android.sdk.iap.lib.activity.ConsumePurchasedItemsActivity to request the consumption of an in-app item.
       

To add privileges and activities to the Android app manifest

Caution: Privileges and activities must not be altered. Copy and paste them the comments in the IAP Client AndroidManifest.xml file in the SDK.

  1. In Android Studio, open the AndroidManifest.xml file.
  2. Add the following privilege code:
<uses-permission android:name="com.samsung.android.iap.permission.BILLING"/>
<uses-permission android:name="android.permission.INTERNET"/>

 The “com.samsung.android.iap.permission.BILLING” privilege is required is connect to IAP. Because IAP uses network communication, the “android.permission.INTERNET” privilege is also needed.

  1. Add the following activity code: 
    Caution: Due to the transparency requirements, the activities must be set to android:theme="@style/Theme.Empty"or these activities conceal your application.
<activity    
android:name="com.samsung.android.sdk.iap.lib.activity.PaymentActivity"     
android:theme="@style/Theme.Empty"    
android:configChanges="orientation|screenSize"/> 
 
<activity    
android:name="com.samsung.android.sdk.iap.lib.activity.ProductActivity"     
android:theme="@style/Theme.Empty"    
android:configChanges="orientation|screenSize"/> 
 
<activity     
android:name="com.samsung.android.sdk.iap.lib.activity.OwnedProductActivity"     
android:theme="@style/Theme.Empty"    
android:configChanges="orientation|screenSize"/> 
 
<activity     
android:name="com.samsung.android.sdk.iap.lib.activity.ConsumePurchasedItemsActivity"     
android:theme="@style/Theme.Empty"    
android:configChanges="orientation|screenSize"/>