Configuration Guide
Complete guide to configuring the Reachu Kotlin SDK for your Android application or backend service.
Configuration File
The SDK uses a JSON configuration file (reachu-config.json) that can be placed in:
- Android:
src/main/assets/reachu-config.json - JVM/Backend:
src/main/resources/reachu-config.json
Basic Configuration
reachu-config.json
{
"contexts": {
"app": {
"defaultEnvironment": "production",
"environments": {
"production": {
"apiKey": "YOUR_API_KEY",
"baseUrl": "https://graph-ql-prod.reachu.io/graphql",
"marketFallback": {
"countryCode": "NO",
"currencyCode": "NOK"
}
}
}
}
}
}
Multiple Environments
You can configure multiple environments for different stages:
reachu-config.json
{
"contexts": {
"app": {
"defaultEnvironment": "development",
"environments": {
"development": {
"apiKey": "YOUR_DEV_API_KEY",
"baseUrl": "https://graph-ql-dev.reachu.io/graphql",
"marketFallback": {
"countryCode": "NO",
"currencyCode": "NOK"
}
},
"staging": {
"apiKey": "YOUR_STAGING_API_KEY",
"baseUrl": "https://graph-ql-staging.reachu.io/graphql",
"marketFallback": {
"countryCode": "SE",
"currencyCode": "SEK"
}
},
"production": {
"apiKey": "YOUR_PROD_API_KEY",
"baseUrl": "https://graph-ql-prod.reachu.io/graphql",
"marketFallback": {
"countryCode": "NO",
"currencyCode": "NOK"
}
}
}
}
}
}
Payment Configuration
Stripe
{
"payment": {
"stripe": {
"publishableKey": "pk_test_your_key"
}
}
}
Klarna
{
"payment": {
"klarna": {
"mode": "native",
"clientToken": "YOUR_KLARNA_CLIENT_TOKEN"
}
}
}
Modes: - "native" - Use Klarna Mobile SDK (recommended)
"web"- Use web-based payment flow
Environment Variables
You can override configuration using environment variables:
export REACHU_API_TOKEN="your-api-key"
export REACHU_BASE_URL="https://graph-ql-prod.reachu.io/graphql"
export REACHU_CONFIG_TYPE="app"
export REACHU_ENVIRONMENT="production"
Loading Configuration
Android Application
Application.kt
import android.app.Application
import io.reachu.ReachuCore.configuration.ConfigurationLoader
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
ConfigurationLoader.loadConfiguration(context = this)
}
}
Backend Service
Main.kt
import io.reachu.sdk.core.SdkClient
import java.net.URL
fun main() {
val sdk = SdkClient(
baseUrl = URL(System.getenv("REACHU_BASE_URL") ?: "https://graph-ql-prod.reachu.io/graphql"),
apiKey = System.getenv("REACHU_API_TOKEN") ?: "your-api-key"
)
}
Next Steps
- Getting Started - Installation guide
- Payment Integration - Payment setup