RoutexClient

Kotlin client for the YAXI Open Banking interactive services: accounts, balances, collectPayment, transactions, transfer, plus the discovery endpoints info and search.

Every service call returns a typed Response. A Response.Result holds an Authenticated JWT carrying the typed payload; the other variants (Response.Dialog, Response.Redirect, Response.RedirectHandle) are interrupts the caller resolves before the flow can complete (see Handling interrupts). Each call is authorized by a typed Ticket (for example Ticket.Accounts) minted by the caller's backend (see Getting started); the bank-side identification uses a Credentials envelope (see Providing Credentials).

Resolving interrupts

Loop until a Response.Result is returned.

Handling the result

Shared parameters

Service methods share these optional inputs (omitted from each method's KDoc; see Handling sessions for the broader picture):

  • session: opaque Session returned by a previous call in the same flow.

  • recurringConsents: when true, request a long-lived consent with the maximum permissions the bank grants for this ticket's service so the returned ConnectionData carries it. Subsequent RoutexClient calls that reuse that ConnectionData (via Credentials.connectionData) and non-interactive refreshes on RoutexRefreshClient skip the interrupt loop until the consent expires or is revoked. Persist the resulting ConnectionData alongside the user's credentials, since it gates downstream refreshes. Default false requests a one-shot consent scoped to this call.

Errors

Service methods are suspend and throw on failure. Expected exceptions:

Lifecycle

Instances are safe to share across coroutines; create one per backing HttpTransport and reuse it. Java callers should use RoutexAsyncClient.

Samples

client.accounts(
    accountsTicket,
    credentials,
    fields = listOf(
        AccountField.Iban,
        AccountField.Bic,
        AccountField.Name,
        AccountField.DisplayName,
        AccountField.OwnerName,
        AccountField.Currency,
    ),
    filter = AccountField.Iban.notEq(null)
        .and(AccountField.Type.eq(AccountType.CURRENT)
            .or(AccountField.Type.eq(null)))
        .and(Account.supports(SupportedService.COLLECT_PAYMENT)),
)

Constructors

Link copied to clipboard
constructor(baseUrl: Url = DEFAULT_BASE_URL, httpTransport: HttpTransport = defaultHttpTransport())

Construct a client.

constructor(baseUrl: String, httpTransport: HttpTransport = defaultHttpTransport())

Convenience overload that parses baseUrl as a Ktor Url.

Properties

Link copied to clipboard

Trace identifier returned with the most recent request, if any.

Functions

Link copied to clipboard
suspend fun accounts(ticket: Ticket.Accounts, credentials: Credentials, fields: List<AccountField<*>>, filter: AccountFilter? = null, session: Session? = null, recurringConsents: Boolean = false): Response<AccountsResult>

Invoke the accounts service: list accounts (and selected fields) reachable through credentials.

Link copied to clipboard
suspend fun balances(ticket: Ticket.Balances, credentials: Credentials, accounts: List<AccountReference>, session: Session? = null, recurringConsents: Boolean = false): Response<BalancesResult>

Invoke the balances service: fetch current balances for accounts.

Link copied to clipboard
suspend fun collectPayment(ticket: Ticket.CollectPayment, credentials: Credentials, account: DebtorAccountReference? = null, session: Session? = null, recurringConsents: Boolean = false): Response<CollectPaymentResult>

Invoke the collect-payment service: identify the debtor and prepare a payment-initiation flow.

Link copied to clipboard

Continue an accounts flow paused on a confirmation Response.Dialog, Response.Redirect, or Response.RedirectHandle.

Link copied to clipboard

Continue a balances flow paused on a confirmation Response.Dialog, Response.Redirect, or Response.RedirectHandle.

Link copied to clipboard

Continue a collect-payment flow paused on a confirmation Response.Dialog, Response.Redirect, or Response.RedirectHandle.

Link copied to clipboard

Continue a transactions flow paused on a confirmation Response.Dialog, Response.Redirect, or Response.RedirectHandle.

Link copied to clipboard

Continue a transfer flow paused on a confirmation Response.Dialog, Response.Redirect, or Response.RedirectHandle.

Link copied to clipboard
suspend fun info(ticket: Ticket, connectionId: ConnectionId): ConnectionInfo

Fetch metadata for a single service connection.

Link copied to clipboard
suspend fun registerRedirectUri(ticket: Ticket, handle: String, redirectUriValue: String): String

Finalize a Response.RedirectHandle by registering redirectUriValue as the landing URI for handle.

Link copied to clipboard
suspend fun respondAccounts(ticket: Ticket.Accounts, context: InputContext, response: String): Response<AccountsResult>

Continue an accounts flow by submitting the user's answer to a Response.Dialog.

Link copied to clipboard
suspend fun respondBalances(ticket: Ticket.Balances, context: InputContext, response: String): Response<BalancesResult>

Continue a balances flow by submitting the user's answer to a Response.Dialog.

Link copied to clipboard

Continue a collect-payment flow by submitting the user's answer to a Response.Dialog.

Link copied to clipboard

Continue a transactions flow by submitting the user's answer to a Response.Dialog.

Link copied to clipboard
suspend fun respondTransfer(ticket: Ticket.Transfer, context: InputContext, response: String): Response<TransferResult>

Continue a transfer flow by submitting the user's answer to a Response.Dialog.

Link copied to clipboard
suspend fun search(ticket: Ticket, filters: List<SearchFilter>, ibanDetection: Boolean = false, limit: UInt? = null, details: List<ConnectionDetails> = emptyList()): List<ConnectionInfo>

Search for service connections (banks and other providers).

Link copied to clipboard

Set the redirect URI for subsequent service requests, or pass null to clear it.

Link copied to clipboard

Authenticated TEE system version learned during settlement of ticket's key-settlement session.

Link copied to clipboard
suspend fun trace(ticket: Ticket, traceId: TraceId): String

Retrieve raw trace data for a traceId emitted by a prior request.

Link copied to clipboard
suspend fun transactions(ticket: Ticket.Transactions, credentials: Credentials, session: Session? = null, recurringConsents: Boolean = false): Response<TransactionsResult>

Invoke the transactions service: fetch the booked-and-pending transaction list authorized by credentials.

Link copied to clipboard
suspend fun transfer(ticket: Ticket.Transfer, credentials: Credentials, product: PaymentProduct, details: List<TransferDetails>, debtorAccount: AccountReference? = null, debtorName: String? = null, requestedExecutionDate: IsoDateTimeOrDate? = null, session: Session? = null, recurringConsents: Boolean = false): Response<TransferResult>

Invoke the transfer service: initiate a credit transfer for product with the given details.