Kotlin SDK for Android

Official vrtx SDK for integrating with Android applications using Kotlin.

Installation

Add the vrtx SDK to your Android project using Gradle:

kotlin
// settings.gradle
repositories {
    mavenCentral()
}

// app/build.gradle
dependencies {
    implementation "com.vrtx:vrtx-sdk:1.0.0"
}

Initialization

kotlin
import com.vrtx.sdk.VRTXClient

val client = VRTXClient(
    clientId = "your-client-id",
    clientSecret = "your-client-secret",
    environment = Environment.SANDBOX  // or Environment.PRODUCTION
)

// Get access token
val token = client.auth.getToken()
println("Access token: ${token.accessToken}")

Mapping to REST

SDK CallREST EndpointPurpose
client.auth.getToken()POST /auth/tokenExchange credentials for access token
client.wallets.get()GET /customers/{customer_id}/walletGet wallet details for a customer
client.cards.issue()POST /cards/issueIssue a virtual or physical card

Error Handling

kotlin
try {
  val wallet = client.wallets.get(
    customerId = "c1d2e3f4-a5b6-7890-c1d2-e3f4a5b6c7d8"
  )
  println("Wallet account ID: ${wallet.accountId}")
} catch (e: Exception) {
  // Inspect error codes and retry when appropriate
  println("Request failed: ${e.message}")
}

Refer to the Errors reference to map SDK exceptions to API error codes.