PaymentGateway

interface PaymentGateway

The single contract every payment provider implements. Deliberately tiny and platform-agnostic: the messy, Activity-callback-era SDK reality is confined to each provider's androidMain impl and bridged back into a coroutine by PaymentHost.

prepare does the server round-trip (order creation → session token); pay launches the SDK/UI and suspends until a terminal PaymentResult. Splitting them keeps the network step testable and the launch step host-driven.

Inheritors

Properties

Link copied to clipboard
abstract val id: GatewayId
Link copied to clipboard
abstract val meta: GatewayMeta

Functions

Link copied to clipboard
abstract suspend fun pay(host: PaymentHost, prepared: PreparedPayment): PaymentResult

Launch the provider UI/intent and suspend until the user reaches a terminal state.

Link copied to clipboard
abstract suspend fun prepare(created: CreatedOrder): PreparedPayment

Transform a backend-created order into this provider's session shape. The network round-trip already happened (the orchestrator owns PaymentBackend); most providers just repackage CreatedOrder.providerParams, but the call is suspend for providers that need an extra hop. Throws PaymentPreparationException on failure.