Skip to content

Android

This page guides how to setup the Hive SDK Android payment feature.

Hive Console configuration

To use Hive SDK billing, you need to first configure Payment Provider Setup such as key value registration and market linkage in the Hive Console Billing.

Note

For more details, please refer to Google Market Account Registration.

Add market

You need to add the corresponding external library to the module level build.gradle file. Only add the market (payment provider) you will use.

Below is an example of adding an external library to the module level build.gradle file.

dependencies {
   // IapV4, will be automatically included when adding the Market below.
   implementation "com.com2us.android.hive:hive-iapv4"

   // IapV4 Market, add only the Market you are using.

   // Amazon
   implementation "com.com2us.android.hive:hive-iapv4-market-amazon"

   // Google
   implementation "com.com2us.android.hive:hive-iapv4-market-google"

   // Huawei
   implementation "com.com2us.android.hive:hive-iapv4-market-huawei"

   // Lebi
   implementation "com.com2us.android.hive:hive-iapv4-market-lebi"

   // ONEStore
   implementation "com.com2us.android.hive:hive-iapv4-market-onestore"

   // Samsung
   implementation "com.com2us.android.hive:hive-iapv4-market-samsung"

   // Hive Store
   implementation "com.com2us.android.hive:hive-iapv4-market-hivestore"
}

Additional settings by market

Additional settings are required depending on the market.

Huawei payment setup

This section provides setup instructions for using Huawei payments.


  1. Add agconnect-services.json
    • Add the agconnect-services.json file downloaded from the Huawei console to the Project folder.
  2. Project - build.gradle file configuration
    • Add the AppGallery Connect plugin and Maven address.
      buildscript {
          repositories {
              google()
              jcenter()
              // Huawei HMS Core SDK.
              maven {url 'https://developer.huawei.com/repo/'}
          }
          dependencies {
              ...
              // Huawei AppGallery Connect plugin
              classpath 'com.huawei.agconnect:agcp:1.9.1.301'
          }
      }
      allprojects {
          repositories {
              google()
              jcenter()
              /// Huawei HMS Core SDK.
              maven {url 'https://developer.huawei.com/repo/'}
          }
      }  
      
  3. App - build.gradle file configuration
    • Add Huawei library and plugin.
      dependencies {
          // Huawei market
          implementation "com.com2us.android.hive:hive-iapv4-market-huawei"
      }
      apply plugin: 'com.huawei.agconnect'
      

Samsung Galaxystore payment setup

Set the dependency on the libs folder in the module level build.gradle file.

dependencies {
   implementation fileTree(include: ['*.jar'], dir: 'libs')
   implementation fileTree(include: ['*.aar'], dir: 'libs')
}

Add external libraries (.aar / .jar) in the libs folder at the module level to the Hive SDK distribution version. The following is a list of external libraries included in the distribution version.

  • samsung_iap_sdk-v6.1.aar (Add this file when supporting Samsung GalaxyStore billing)

One store payment setup

Set the following in the project level build.gradle.

allprojects {
    repositories {
        ...
        // only for OneStore
        maven { url 'https://repo.onestore.co.kr/repository/onestore-sdk-public' }
        ...
    }
}
Note

If you are using ONE Store SDK V21, you can distribute your app on the ONE Store Global Platform. For more information, please refer to the ONE Store Global Deployment Guide and Test Option Settings for Global Store Deployment.