In China, Google Play Store is not available so that Hive creates an in-app purchase module, Hive Lebi Store. Users in China, therefore, can purchase items by charging Lebi, the virtual currency.
Depending on the types of device, Android-based devices are available to select Google Play Store or Hive Lebi Store. Preparing for user choice, build a payment system paid by Lebi by following the below. Note that iOS does not support Hive Lebi market.
Flowchart to Connect with Hive Lebi Store
Store Selecting Screen
If you can provide both the Google Play Store and the Hive Lebi Store, you should call the showMarketSelection()
method to display a screen allowing the user to select a store between them, after receiving both the Google Play Store and Hive Lebi Market codes as a result of the marketConnect()
method call (the Hive IAP v4 initialization).
- A sample screen when an Android-based device has two stores available; Google Play Store and Hive Lebi Store
Followings are sample codes to request a screen to select a store.
API Reference: hive .IAPV4.showMarketSelection
1 2 3 4 5 6 7 |
using hive; IAPV4.showMarketSelection((ResultAPI result, List<IAPV4Type> typeList) => { if (result.isSuccess()) { // call successful } }); |
API Reference: IAPV4 ::showMarketSelection
1 2 3 4 5 6 7 8 9 |
#include <HIVE_SDK_Plugin/HIVE_CPP.h> using namespace std; using namespace hive; IAPV4::showMarketSelection([=](ResultAPI const & result, vector<IAPV4Type> const & marketIDs) { if (result.isSuccess()) { // call successful } }); |
API Reference: IAPV4.showMarketSelection
1 2 3 4 5 6 7 8 9 10 |
import com.hive.IAPV4 import com.hive.ResultAPI IAPV4.showMarketSelection(object : IAPV4.IAPV4MarketInfoListener { override fun onIAPV4MarketInfo(result: ResultAPI, iapV4TypeList: ArrayList<IAPV4.IAPV4Type>?) { if (result.isSuccess) { // call successful } } }) |
API Reference: IAPV4 .INSTANCE.showMarketSelection
1 2 3 4 5 6 7 8 |
import com.hive.IAPV4; import com.hive.ResultAPI; IAPV4.INSTANCE.showMarketSelection((result, iapV4TypeList) -> { if (result.isSuccess()) { // call successful } }); |
Lebi Balance Search
When user selects Hive Lebi Store, call getBalanceInfo()
method of IAPV4 class to request and display the Lebi balance. You can receive the value as balance
from getBalanceInfo()
.
Followings are sample codes to request the balance of Lebi.
API Reference: hive .IAPV4.getBalanceInfo
1 2 3 4 5 6 7 |
using hive; IAPV4.getBalanceInfo((ResultAPI result, int balance) => { if (result.isSuccess()) { // call successful } }); |
API Reference: IAPV4 ::getBalanceInfo
1 2 3 4 5 6 7 8 9 |
#include <HIVE_SDK_Plugin/HIVE_CPP.h> using namespace std; using namespace hive; IAPV4::getBalanceInfo([=](ResultAPI const & result, int balance) { if (result.isSuccess()) { // call successful } }); |
API Reference: IAPV4.getBalanceInfo
1 2 3 4 5 6 7 8 9 10 |
import com.hive.IAPV4 import com.hive.ResultAPI IAPV4.getBalanceInfo(object : IAPV4.IAPV4BalanceInfoListener { override fun onIAPV4Balance(result: ResultAPI, balance: Int) { if (result.isSuccess) { // call successful } } }) |
API Reference: IAPV4 .INSTANCE.getBalanceInfo
1 2 3 4 5 6 7 8 |
import com.hive.IAPV4; import com.hive.ResultAPI; IAPV4.INSTANCE.getBalanceInfo((result, balance) -> { if (result.isSuccess()) { // call successful } }); |
Lebi Charging Screen
When Lebi is lack of its balance, call showCharge()
from IAPV4 class to show the charging screen. After charging Lebi, you can check the balance with the variable named balance
, from the result of showCharge()
.
Followings are sample codes to call the page of charging Lebi.
API Reference: hive .IAPV4.showCharge
1 2 3 4 5 6 7 |
using hive; IAPV4.showCharge((ResultAPI result, int balance) => { if (result.isSuccess()) { // call successful } }); |
API Reference: IAPV4 ::showCharge
1 2 3 4 5 6 7 8 9 |
#include <HIVE_SDK_Plugin/HIVE_CPP.h> using namespace std; using namespace hive; IAPV4::showCharge([=](ResultAPI const & result, int balance) { if (result.isSuccess()) { // call successful } }); |
API Reference: IAPV4.showCharge
1 2 3 4 5 6 7 8 9 10 |
import com.hive.IAPV4 import com.hive.ResultAPI IAPV4.showCharge(object : IAPV4.IAPV4BalanceInfoListener { override fun onIAPV4Balance(result: ResultAPI, balance: Int) { if (result.isSuccess) { // call successful } } }) |
API Reference: IAPV4 .INSTANCE.showCharge
1 2 3 4 5 6 7 8 |
import com.hive.IAPV4; import com.hive.ResultAPI; IAPV4.INSTANCE.showCharge((result, balance) -> { if (result.isSuccess()) { // call successful } }); |