ONE store IAP SDK Upgrade Guide

In v17 SDK, isBillingSupportedAsyn, which had to be called first after connecting to the payment module, has been removed.

In v19 SDK, it is not necessary for the developer to check the support status anymore.

Perform the support status feature after the connection with the payment module is successful in PurchaseClient.

You can check the response through PurchaseClientStateListener.onSetupFinished().

Overview

This document describes changes made in ONE store IAP library V5(SDK V17) and in ONE store IAP library V6(SDK V19) and provides procedures for version upgrade.

If you refer to examples of Before and After, you can more easily apply the changes.

Changes in PurchaseClient API

V5 (SDK V17)

V6(SDK V19)

Connect to billing module

connect

startConnection

Disconnect with billing module

terminate

endConnection

Check support status

isBillingSupportedAsync

X

Purchase in-app

launchPurchaseFlowAsync

launchPurchaseFlow

Consume in-app

consumeAsync

consumeAsync

Acknowledge in-app purchase

X

acknowledgeAsync

Purchase history of unconsumed in-app

(including monthly automatic payment)

queryPurchasesAsync

queryPurchasesAsync

In-app product details

queryProductsAsync

queryProductDetailsAsync

Change monthly automatic payment status

manageRecurringProductAsync

manageRecurringProductAsync

Update or install billing module

launchUpdateOrInstallFlow

launchUpdateOrInstallFlow

Call ONE store login

launchLoginFlowAsync

launchLoginFlowAsync

Check market identification code

X

getStoreInfoAsync

Upgrade ONE store IAP Version

Remove meta-data

Now, you do not need to add IAP APA version in the appโ€™s manifest. API Version meta-data will be added to IAP SDK V19.

Remove <meta-data android:name="iap:api_version" android:value="5"/> application billing API Version from the existing appโ€™s manifest.

<application> ... <meta-data android:name="iap:api_version" android:value="5"/> ...</application>

Add IAP V19 SDK library

  1. Download the IAP SDK library file, and then export this file into the โ€˜libsโ€™ folder within the developerโ€™s app project. Download In-App SDK

  2. Export the global-appstores.json file into the โ€˜assetsโ€™ folder.

  3. 3. Add the following line to the dependency section of the app's build.gradle file.

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

Initialize & connect ONE store IAP

Generate the PurchaseClient object through Builder and implement PurchaseClientStateListener to process the response result when connecting to the payment module.

In the previous, the response result was the function call format that fits the error, however in v19 SDK, you can determine the response result through IapResult.getResponseCode().

Before

Java

After

Kotlin

Java

Enter the code for terminating PurchaseClient in onDestroy() when Activity ends. Without cutting the connection, problems might occur in the application performance as the generated connection maintains.

Before

Java

After

Kotlin

Java

Check support status

In v17 SDK, isBillingSupportedAsyn, which had to be called first after connecting to the payment module, has been removed.

In v19 SDK, it is not necessary for the developer to check the support status anymore. Perform the support status feature after the connection with the payment module is successful in PurchaseClient.

You can check the response through PurchaseClientStateListener.onSetupFinished().

Check in-app product details

To check the in-app product information, call up PurchaseClient.queryProductDetailsAsync().

Generate the ProductDetailsParams instance when calling this method, and specify the in-app IDs in the form of ArrayList at setProductIdList(). Furthermore, you must enter the in-app type to search the in-app product information. There are two types of in-app: Managed product (INAPP) and Monthly auto-renewal product (AUTO). Enter ProductType.ALL to search both types of in-app.

If you want to process the result of checking the in-app product information, you must implement the ProductDetailsListener interface. When the in-app product information is successfully received, IapResult.getResponseCode() becomes ResponseCode.RESULT_OK and sends the response in the ProductDetail list format.

Before

Java

After

Kotlin

Java

Request purchase

In v17 SDK, you had to request parsing through onActivityResult after requesting purchase and through PurchaseClient.handlePurchaseData, and then you were able to receive the processed data through PurchaseFlowListener.

To request the purchase, you just need to generate the PurchaseFlowParams, enter the required value and send it.

In v19 SDK and above, you do not need to do the task that you had implemented in onActivityResult.

Before

Java

After

Kotlin

Java

Receive response result for purchase

The response result value for purchase is transmitted through the PurchaseUpdatedListener interface implemented through setListener() when initializing PurchaseClient.

Kotlin

Java

Kotlin

Java

Acknowledge purchase

If ONE store IAP library v6 (SDK V19) and above is used, purchase must be acknowledged within 3 days. Otherwise, the purchase amount will be refunded.

You can acknowledge the purchase by using one of the following methods.

  • If the in-app is consumable, use PurchaseClient.consumeAsync().

  • If the in-app is not consumable, use PurchaseClient.acknowledgeAsync().

As for Monthly auto-renewal product, you need to acknowledge the purchase only for the first billing.

The PurchaseData object includes the isAcknowledged() method, which shows if the purchase is acknowledged. If you use this method before acknowledging the purchase, you can figure out if the purchase has already been acknowledged.

Consume Managed product

Managed product cannot be re-purchased until the purchased in-app is consumed.

Before

Java

After

Kotlin

Java

Change Monthly auto-renewal product status

The action value received from onRecurringResponse() transmits the currently-applied value. You can check it in PurchaseClient.RecurringAction.

In addition, PurchaseData transmitted as the response result is the data received at the time of request, and therefore you need to receive once again the changed data through โ€˜Check purchase historyโ€™ and then you can check the changed RecurringState value.

Before

Java

After

Kotlin

Java

Request ONE store login

In v17 SDK, you were able to receive the value with LoginFlowListener only by performing PurchaseClient.handLoginData() again with the value, which has been delivered with onActivityResult after the login request.

In v19 SDK and above, you do not need to do the task that you had implemented in onActivityResult.

Before

Java

After

Kotlin

Java

Install ONE store service (OSS)

In v17 SDK, the flow was disconnected after having executed AppInstaller.launchUpdateOrInstallFlow. However, in v19 SDK and above, you can receive the response when the installation of OSS is completed.

Before

Java

After

Kotlin

Java

Obtain market identification code

For IAP library V6 and above, the market identification code is necessary to use Server API.

You can obtain the market identification code through getStoreInfoAsync().

The following example shows how to obtain the market identification code.

Kotlin

Java

Last updated