Skip to main content

Installation

The Kotlin SDK is available via JitPack based on the GitHub repository.

Gradle (Kotlin DSL)

Add the JitPack repository and the dependency to your build.gradle.kts:
build.gradle.kts
repositories {
    mavenCentral()
    maven { url = uri("https://jitpack.io") }
}

dependencies {
    implementation("com.github.solifyn:solifyn-kotlin:main-SNAPSHOT")
}

Gradle (Groovy DSL)

build.gradle
repositories {
    mavenCentral()
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'com.github.solifyn:solifyn-kotlin:main-SNAPSHOT'
}

Quickstart

Set the access token on the ApiClient companion object and then instantiate API classes directly.
main.kt
import com.solifyn.infrastructure.ApiClient
import com.solifyn.api.ProductsApi
import com.solifyn.infrastructure.ClientException
import com.solifyn.infrastructure.ServerException

// Set the global access token
ApiClient.accessToken = "YOUR_API_KEY" // Replace with your actual Solifyn API key

// Instantiate the API class
val apiInstance = ProductsApi()

try {
    // Fetch products list
    val result = apiInstance.productsList()
    println(result)
} catch (e: ClientException) {
    println("Client error: ${e.message}")
} catch (e: ServerException) {
    println("Server error: ${e.message}")
}

API Classes

APIs are separated into distinct classes within the com.solifyn.api package:
  • com.solifyn.api.ProductsApi - Manage products and addons
  • com.solifyn.api.LicenseApi & com.solifyn.api.LicenseKeysApi - Administer software license keys
  • com.solifyn.api.LicenseKeysClientApi - Public validation and activation endpoints for client software
  • com.solifyn.api.CheckoutApi - Generate checkout sessions
  • com.solifyn.api.CheckoutLinksApi - Generate checkout links
  • com.solifyn.api.CustomersApi - Customer profiles
  • com.solifyn.api.CollectionsApi - Group products in collections
  • com.solifyn.api.SubscriptionsApi - Manage subscription plans
  • com.solifyn.api.DiscountsApi - Administer discounts and coupon codes
  • com.solifyn.api.MetersApi - Ingest metered usage billing events
  • com.solifyn.api.DeveloperApi - Retrieve API keys and webhooks
  • com.solifyn.api.DigitalFileApi - Handle digital delivery links
  • com.solifyn.api.DisputesApi - Handle dispute evidence files
  • com.solifyn.api.OrdersApi - Invoices and customer purchases