Core API Reference
Complete reference for the Reachu Kotlin SDK core functionality.
SdkClient
Main entry point for SDK operations.
class SdkClient(
baseUrl: URL,
apiKey: String,
headers: Map<String, String> = emptyMap()
)
Properties
cart: CartRepository- Cart operationscheckout: CheckoutRepository- Checkout operationspayment: PaymentRepository- Payment operationsmarket: MarketRepository- Market operationschannel: ChannelRepository- Channel operationsdiscount: DiscountRepository- Discount operations
Example
val sdk = SdkClient(
baseUrl = URL("https://graph-ql-prod.reachu.io/graphql"),
apiKey = "your-api-key"
)
// Use repositories
val markets = sdk.market.getAvailable()
val cart = sdk.cart.create(...)
CartRepository
Create Cart
suspend fun create(
customerSessionId: String,
currency: String,
shippingCountry: String
): CartDto
Add Item
suspend fun addItem(
cartId: String,
items: List<LineItemInput>
): CartDto
Get Line Items by Supplier
suspend fun getLineItemsBySupplier(
cartId: String
): List<LineItemsBySupplierDto>
CheckoutRepository
Create Checkout
suspend fun create(
cartId: String
): CheckoutDto
Update Checkout
suspend fun update(
checkoutId: String,
update: UpdateCheckoutDto
): CheckoutDto
PaymentRepository
Get Available Methods
suspend fun getAvailableMethods(): List<PaymentMethodDto>
Stripe Intent
suspend fun stripeIntent(
checkoutId: String,
returnEphemeralKey: Boolean = true
): PaymentIntentStripeDto
Klarna Native Init
suspend fun klarnaNativeInit(
checkoutId: String,
input: KlarnaNativeInitInputDto
): InitPaymentKlarnaNativeDto
Klarna Native Confirm
suspend fun klarnaNativeConfirm(
checkoutId: String,
input: KlarnaNativeConfirmInputDto
): ConfirmPaymentKlarnaNativeDto
Vipps Init
suspend fun vippsInit(
checkoutId: String,
email: String,
returnUrl: String
): InitPaymentVippsDto
MarketRepository
Get Available Markets
suspend fun getAvailable(): List<MarketDto>
Error Handling
All repository methods throw SdkException on error:
try {
val cart = sdk.cart.create(...)
} catch (e: SdkException) {
when (e) {
is AuthException -> { /* Handle auth error */ }
is ValidationException -> { /* Handle validation error */ }
is RateLimitException -> { /* Handle rate limit */ }
else -> { /* Handle other errors */ }
}
}
Next Steps
- Payment API - Payment methods reference
- UI Components - UI components guide