To activate Hive IAP v4, request IAP initialization before purchase. If you request to initialize IAP, Game Client returns available store information.
Store information is defined as IAPV4Type
enum, and details in field are as following;
Market information
Field Name | Description |
APPLE_APPSTORE | Apple App Store |
GOOGLE_PLAYSTORE | Google Play Store |
HIVE_LEBI | Hive Lebi Store |
ONESTORE | ONE Store |
AMAZON_APPSTORE | Amazon App Store (Available with SDK v4 only) |
SAMSUNG_GALAXYSTORE | Samsung Galaxy Store |
HUAWEI_APPGALLERY | Huawei App Gallery |
HIVESTORE | PG Payment (for Windows, Unity only) |
HIVESTORE
(PG Payment) only supports Product Search and Purchase, and the client-based receipt verification is not supported.
Soft currency market in game should be available for users who enjoy the gameplay even after the game stops download service. Therefore, each game studio is required to code hard currency market and soft currency market separately. The result value sent by initializing IAP v4 is not for access to in-game market, so do not use the result value in different ways. Implement marketConnect()
in the IAPV4 class to initialize Hive IAP v4.
Initialize Hive IAPv4
Followings are sample codes to initialize Hive IAP v4.
API Reference: hive.IAPV4.marketConnect
1 2 3 4 5 6 7 |
using hive; IAPV4.marketConnect((ResultAPI result, List marketIdList) => { if (result.isSuccess()) { // call successful } }); |
API Reference: IAPV4::marketConnect
1 2 3 4 5 6 7 8 9 |
#include <HIVE_SDK_Plugin/HIVE_CPP.h> using namespace std; using namespace hive; IAPV4::marketConnect([=](ResultAPI const & result, vector const & marketIdList) { if (result.isSuccess()) { // call successful } }); |
API Reference: IAPV4.marketConnect
1 2 3 4 5 6 7 8 9 10 |
import com.hive.IAPV4 import com.hive.ResultAPI IAPV4.marketConnect(object : IAPV4.IAPV4MarketInfoListener { override fun onIAPV4MarketInfo(result: ResultAPI, iapV4TypeList: ArrayList<IAPV4.IAPV4Type>?) { if (result.isSuccess) { // call successful } } }) |
API Reference: com.hive.IAPV4.marketConnect
1 2 3 4 5 6 7 8 |
import com.hive.IAPV4; import com.hive.ResultAPI; IAPV4.INSTANCE.marketConnect((result, iapV4TypeList) -> { if (result.isSuccess()) { // call successful } }); |
API Reference: IAPV4Interface .marketConnect
1 2 3 4 5 6 7 |
import HIVEService IAPV4Interface.marketConnect() { result, marketIdList in if result.isSuccess() { // call successful } } |
API Reference: HIVEIAPV4::marketConnect
1 2 3 4 5 6 7 |
#import <HIVEService/HIVEService-Swift.h> [HIVEIAPV4 marketConnect: ^(HIVEResultAPI *result, NSArray<NSNumber *> *marketIdList) { if ([result isSuccess]) { // call successful } }]; |
Notes for initialization
From Hive SDK v4 Unity Windows 23.0.0, Windows apps for Google Play are supported, and the GOOGLE_PLAYSTORE
market can be used. In this case, please note the following during development:
- Initialization (
IAPV4.marketConnect
) must be executed only after the IdP login withAuthV4
. - When
IAPV4.marketConnect
is called for the first time, a Google account login screen for product payment, which allows the app user to select a Google account for payment in the market, will appear. This login process is not a feature that the app developer implements, but is automatically performed by the Hive SDK. - The Google account login for product payment is different from the Google IdP login provided by the Hive SDK authentication module (
AuthV4
). If a user previously logged in with any IdP (AuthV4
) including Google IdP logs out, the Google account for product payment will also be automatically logged out.