Jetpack Compose SDK for displaying Trusted Shops trust widgets (Trustbadge) and handling buyer‑protection checkout on Android.
- Requirements
- Installation
- Quick Start
- Trustbadge
- Checkout Integration
- Configuration
- API Reference
- License
- Android 10 (API level 29) or higher
- A Jetpack Compose app (the SDK's UI is Compose‑based)
- Kotlin, JVM/Java 17
The SDK is published to Maven Central. Make sure mavenCentral() is in your repositories, then add the
dependency:
// settings.gradle.kts (or your root build) — repositories
dependencyResolutionManagement {
repositories {
mavenCentral()
}
}
// app/build.gradle.kts — dependencies
dependencies {
implementation("com.trustedshops.android.sdk:trustedshops-sdk:1.1.0")
}The SDK declares the INTERNET permission itself, so no manifest changes are required.
Initialize once, e.g. in your Application.onCreate():
import com.trustedshops.android.sdk.TrustedShopsSDK
import com.trustedshops.android.sdk.shared.config.TrustedShopsConfigs
import com.trustedshops.android.sdk.shared.models.TargetMarket
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
TrustedShopsSDK.start(
context = this,
configs = TrustedShopsConfigs(
defaultMarket = TargetMarket.DEU,
integrationIds = mapOf(TargetMarket.DEU to "your-integration-id"),
),
)
}
}TrustbadgeView is a composable — place it in any Compose UI:
import androidx.compose.runtime.Composable
import com.trustedshops.android.sdk.trustbadge.ui.TrustbadgeView
import com.trustedshops.android.sdk.trustbadge.ui.TrustbadgeType
@Composable
fun MyScreen() {
TrustbadgeView(type = TrustbadgeType.HORIZONTAL)
}// Compact horizontal banner
TrustbadgeView(type = TrustbadgeType.HORIZONTAL)
// Larger card layout with more detail
TrustbadgeView(type = TrustbadgeType.CARD)Tapping the badge opens a detail sheet (reviews + trustmark) automatically.
TrustbadgeView accepts a Modifier and follows standard Compose layout:
TrustbadgeView(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
type = TrustbadgeType.HORIZONTAL,
)import com.trustedshops.android.sdk.shared.models.OrderData
import com.trustedshops.android.sdk.shared.models.Product
import com.trustedshops.android.sdk.shared.models.Currency
val orderData = OrderData(
email = "buyer@example.com",
shopOrderId = "ORDER-123",
amount = 59.99,
currency = Currency.EUR,
paymentType = "CREDIT_CARD",
estimatedDeliveryDate = "2026-04-01", // yyyy-MM-dd
products = listOf(
Product(name = "Wireless Headphones", sku = "WH-001"),
),
)Only shopOrderId is required; every other field is optional.
Call initiateCheckout from an Activity to start the buyer‑protection flow. The SDK presents the
Trustcard itself — you don't build any UI:
TrustedShopsSDK.getInstance().initiateCheckout(
activity = this,
orderData = orderData,
)Note: checkout relies on the shop's Trustbadge data being loaded first. Make sure a
TrustbadgeViewhas been shown (or otherwise given the SDK a chance to load) before callinginitiateCheckout; otherwise the call is a no‑op and logs a warning.
CHF, EUR, GBP, PLN, NOK, SEK, DKK, RON, CZK
Pass an integrationIds map to support multiple markets. The SDK resolves the integration ID from the
device region, falling back to defaultMarket:
TrustedShopsSDK.start(
context = this,
configs = TrustedShopsConfigs(
defaultMarket = TargetMarket.DEU,
integrationIds = mapOf(
TargetMarket.DEU to "integration-id-de",
TargetMarket.AUT to "integration-id-at",
TargetMarket.GBR to "integration-id-gb",
),
),
)Resolution order: exact match for the device region → EUO (European‑Other) fallback if present →
defaultMarket / first entry.
Switch the active market at runtime (only relevant with integrationIds):
// Override to a specific market
TrustedShopsSDK.getInstance().setTargetMarket(context, TargetMarket.AUT)
// Revert to automatic device-region resolution
TrustedShopsSDK.getInstance().setTargetMarket(context, null)environment defaults to TrustedShopsEnvironment.PROD, which is the environment integrators should use:
TrustedShopsConfigs(
integrationIds = mapOf(TargetMarket.DEU to "your-integration-id"),
environment = TrustedShopsEnvironment.PROD,
)Logging is off by default. Enable it for debugging via SDKLoggingConfig:
import com.trustedshops.android.sdk.shared.logging.api.SDKLoggingConfig
import com.trustedshops.android.sdk.shared.logging.api.SDKLogLevel
TrustedShopsConfigs(
integrationIds = mapOf(TargetMarket.DEU to "your-integration-id"),
logging = SDKLoggingConfig(
enabled = true,
minLevel = SDKLogLevel.DEBUG,
),
)| Property | Type | Default | Description |
|---|---|---|---|
enabled |
Boolean |
false |
Enable/disable logging |
minLevel |
SDKLogLevel |
WARN |
Minimum log level |
tagPrefix |
String |
"TrustedSDK" |
Prefix applied to log tags |
logger |
SDKLogger? |
null |
Custom log sink |
redactSensitiveData |
Boolean |
true |
Redact PII in logs |
Log levels: VERBOSE, DEBUG, INFO, WARN, ERROR, NONE.
You can also update logging at runtime with TrustedShopsSDK.updateLogging(config).
| Symbol | Type | Description |
|---|---|---|
TrustedShopsSDK.start(context, configs) |
Function | Initialize the SDK (call once) |
TrustedShopsSDK.getInstance() |
Function | The SDK singleton (after start) |
TrustedShopsSDK.getInstance().initiateCheckout(activity, orderData) |
Function | Start buyer‑protection checkout |
TrustedShopsSDK.getInstance().setTargetMarket(context, market?) |
Function | Override active market; null reverts to auto |
TrustedShopsSDK.updateLogging(config) |
Function | Update logging config at runtime |
TrustbadgeView |
Composable | Displays the Trustbadge widget |
TrustbadgeType |
Enum | HORIZONTAL, CARD |
TrustedShopsConfigs |
data class | SDK initialization configuration |
TrustedShopsEnvironment |
Enum | PROD |
TargetMarket |
Enum | Supported markets (DEU, AUT, GBR, …) |
OrderData |
data class | Order information for checkout |
Product |
data class | A product in an order |
Currency |
Enum | Supported currencies |
SDKLoggingConfig |
data class | Logging configuration |
SDKLogLevel |
Enum | Log levels (VERBOSE … NONE) |
The Trusted Shops Android SDK is proprietary and closed source. See the LICENSE file for details.