Skip to content

🖥 JVM Setup

SnorSnor edited this page May 26, 2023 · 2 revisions

Document for setup Android Project

📔 Maven Central

repositories {
    google()
    mavenCentral()
}

dependencies {
    //RM SDK 
    implementation("io.revenuemonster.sdk:rm-kotlin-sdk:2.0.1")
    //Coroutine
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
    //Kotlinx Datatime
    implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")
}

For SDK you can more specific

implementation("io.revenuemonster.sdk:rm-kotlin-sdk-jvm:2.0.1")

Example

    runBlocking {

        val config = Config(
            clientID = "",
            clientSecret = "",
            privateKey = "",
            sandbox = true
        )

        try {
            val auth = RevenueMonsterAuth(config).getAccessToken()
            val sdk = RevenueMonsterSDK(auth)

            val result = sdk.payment.getTransactions()
            println(result)
        }catch (e: RMException){
            //Raw format
            println(e.message)
            //RM Exception
            println(e.errorCode)
            println(e.errorMessage)
        }catch (e: Throwable){
            e.printStackTrace()
        }

    }
Clone this wiki locally