OneEntry Platform 2.1.0 Help

Payment accounts

The payment account is set up in the CMS and acts as a payment system. For example, you can connect options such as Stripe or cash payment.

Kotlin Multiplatform

Get all payment accounts

A list of all accounts can be useful for displaying payment options in client applications.

val accounts = PaymentsService.accounts()

Get a payment account by its identifier

val accountId: Int = //... val accounts = PaymentsService.account(accountId)

Stripe

To connect the Stripe SDK to the application, it can be helpful to know the public keys of the CMS-connected account.

val accounts = PaymentsService.accounts() val stripe = accounts.firstNotNullOf { it as? PaymentAccount.Stripe } val settings = if (stripe.testMode) stripe.testSettings else stripe.settings when (settings) { is PaymentAccount.Stripe.Settings.Connected -> { println(settings.stripeAccountId) println(settings.stripePublishableKey) } PaymentAccount.Stripe.Settings.NotConnected -> { println("The stripe account is not configured for making payments") } }

Swift

Get all payment accounts

A list of all accounts can be useful for displaying payment options in client applications.

let accounts = try await PaymentsService.shared.accounts()

Get a payment account by its identifier

let accountId: Int = //... let accounts = try await PaymentsService.shared.account(id: accountId)

Stripe

To connect the Stripe SDK to the application, it can be helpful to know the public keys of the CMS-connected account.

let accounts = accounts.compactMap { account in switch account { case .stripe(let stripe): return stripe case .custom: return nil } } guard let stripe = accounts.first else { print("Stripe account not found"); return } let settings = account.testMode ? account.testSettings : account.settings let connected = try settings.connected print(connected.stripeAccountId) print(connected.stripePublishableKey)
19 February 2025