Reachu Kotlin SDK
Native Kotlin/JVM SDK for integrating Reachu's commerce platform from backend servicesor Android applications. Built with coroutines, Jetpack Compose support, and designed for scalability and performance.
Why Choose Kotlin SDK?
- Native Android Performance: Compiled to native code optimized for Android devices
- Coroutines Support: Built-in async/await with Kotlin coroutines
- Jetpack Compose: Modern declarative UI components for Android
- Type Safety: Leverage Kotlin's strong type system for reliable ecommerce operations
- Backend Ready: Works seamlessly in backend services and Android apps
- Modular Architecture: Import only the components you need
Architecture
The Kotlin SDK is designed with a modular approach:
Core Modules - ReachuCore (Required) → Essential ecommerce functionality, models, and business logic
- ReachuNetwork (Internal) → Shared networking layer with GraphQL client
UI Modules - ReachuUI (Optional) → Jetpack Compose components for ecommerce interfaces
- ReachuDesignSystem (Internal) → Design tokens, colors, typography, and base components
Development Modules - ReachuTesting (Internal) → Mock data providers and testing utilities
Quick Installation
Add the Reachu Kotlin SDK to your project using Gradle:
build.gradle.kts
dependencies {
implementation("io.reachu:reachu-kotlin-sdk:1.0.0")
}
For Android Projects
build.gradle.kts
dependencies {
// Core functionality
implementation("io.reachu:reachu-kotlin-sdk:1.0.0")
// Jetpack Compose UI components (optional)
implementation("io.reachu:reachu-ui-compose:1.0.0")
}
Basic Usage
Backend Service Example
Main.kt
import io.reachu.sdk.core.SdkClient
import kotlinx.coroutines.runBlocking
import java.net.URL
fun main() = runBlocking {
val sdk = SdkClient(
baseUrl = URL("https://your-host/graphql"),
apiKey = "<YOUR_TOKEN>",
)
// Get available markets
val markets = sdk.market.getAvailable()
// Create cart
val cart = sdk.cart.create(
customerSessionId = "demo-${System.currentTimeMillis()}",
currency = "NOK",
shippingCountry = "NO",
)
}
Android App Example
MainActivity.kt
import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import io.reachu.ReachuUI.Components.RCheckoutOverlay
import io.reachu.ReachuUI.Managers.CartManager
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val cartManager = CartManager()
val checkoutDraft = CheckoutDraft()
setContent {
MyApp(cartManager, checkoutDraft)
}
}
}
@Composable
fun MyApp(cartManager: CartManager, checkoutDraft: CheckoutDraft) {
val checkoutOverlay = remember {
RCheckoutOverlay(cartManager, checkoutDraft)
}
// Your app UI
Column {
// Product catalog, cart, etc.
}
}
Jetpack Compose Components
The Kotlin SDK includes beautiful, ready-to-use Compose components:
Product Components - RProductCard → Flexible product cards with multiple layout variants
RProductSlider→ Horizontal scrolling product galleriesRProductDetailOverlay→ Full-screen product detail modal
Cart & Checkout Components - CartManager → Global cart state management with reactive updates
RCheckoutOverlay→ Complete checkout flow as modal overlayRFloatingCartIndicator→ Persistent cart indicator across screensRToastNotification→ Elegant notification system
Design System - RButton → Consistent buttons with multiple styles
ReachuColors→ Unified color paletteReachuTypography→ Typography scaleReachuSpacing→ Consistent spacing tokens
Payment Integration
The Kotlin SDK supports multiple payment methods:
- Stripe - Credit/debit cards with PaymentSheet
- Klarna - Buy now, pay later (native and web)
- Vipps - Norwegian mobile payment
- More coming soon - PayPal and more
Payment Flow Example
// Initialize Klarna native payment
val klarnaInit = cartManager.initKlarnaNative(
input = KlarnaNativeInitInputDto(
countryCode = "NO",
currency = "NOK",
returnUrl = "reachu://klarna/callback",
)
)
// Launch Klarna native activity
val intent = Intent(context, KlarnaNativeActivity::class.java).apply {
putExtra("client_token", klarnaInit.clientToken)
putExtra("category", "pay_now")
}
startActivityForResult(intent, KLARNA_REQUEST_CODE)
Documentation Structure
Platform Support
| Platform | Version | Status |
|---|---|---|
| Android | 5.0+ (API 21+) | Fully Supported |
| JVM | 17+ | Backend Services |
| Kotlin | 1.9+ | Required |
Useful Links
- GitHub Repository - Source code and issues
- Getting Started Guide - Step-by-step setup
- UI Components - Compose component library
- API Reference - Complete method documentation
- Support - Technical support
License
This project is licensed under the MIT License - see the LICENSE file for details.
Ready to build amazing Android shopping experiences?