RichUtils / pyxis.uzuki.live.richutilskt.module.iap / RInAppBilling

RInAppBilling

class RInAppBilling

Types

OnInAppBillingCallback

interface OnInAppBillingCallback

OnInAppConsumeCallback

interface OnInAppConsumeCallback

Security

object Security

Security-related methods. For a secure implementation, all of this code should be implemented on a server that communicates with the application on the device. For the sake of simplicity and clarity of this example, this code is included here and is executed on the device. If you must verify the purchases on the phone, you should obfuscate this code to make it harder for an attacker to replace the code with stubs that treat all purchases as verified.

Constructors

<init>

RInAppBilling(activity: Activity, signatureBase64: String)

Functions

bindInAppBilling

fun bindInAppBilling(): Unit

Should be initialized in onCreate

consumePurchase

fun consumePurchase(transaction: Transaction?): Unit

Consume specific item which consumable item

generateDeveloperPayload

fun generateDeveloperPayload(productId: String, type: String): String

generate developerPayload using nonce(UUID)

getAvailableInappPackage

fun getAvailableInappPackage(items: ArrayList<String>): ArrayList<Sku>

get Available 'inapp' package of own package name.

isValidTransaction

fun isValidTransaction(transaction: Transaction): Boolean

Checking transaction is valid.

onActivityResult

fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?): Unit

Purchase Result billingCallback, just pass Activity's onActivityResult.

purchase

fun purchase(productId: String, type: String = "inapp", developerPayload: String = generateDeveloperPayload(productId, type)): Unit

Purchase specific item

setOnInAppBillingCallback

fun setOnInAppBillingCallback(callback: (Int, Transaction?) -> Unit): Unit
fun setOnInAppBillingCallback(callback: F2<Int, Transaction>): Unit

Using when try to purchase un-consumable item

setOnInAppConsumeCallback

fun setOnInAppConsumeCallback(callback: (Int, Transaction?) -> Unit): Unit
fun setOnInAppConsumeCallback(callback: F2<Int, Transaction>): Unit

Using when try to purchase consumable item, within using AppBillingUtils.setOnInAppBillingCallback(OnInAppBillingCallback)

unBindInAppBilling

fun unBindInAppBilling(): Unit

Should be initialized in onDestroy

Companion Object Properties

PURCHASE_FAILED_INVALID

val PURCHASE_FAILED_INVALID: Int

PURCHASE_FAILED_UNKNOWN

val PURCHASE_FAILED_UNKNOWN: Int

PURCHASE_SUCCESS

val PURCHASE_SUCCESS: Int