Package-level declarations

Types

Link copied to clipboard

Bridges HostedWebViewGateway.pay (a suspending call with no UI of its own) to the Compose WebView screen that actually renders the checkout and detects the return-URL. One relay instance is shared (Koin single) across every hosted-webview config, keyed by GatewayId rather than single-slot like a per-gateway relay — many configs share this one module.

Link copied to clipboard
data class HostedCheckoutRequest(val gatewayId: GatewayId, val checkoutUrl: String)

One hosted gateway asking to be shown as a checkout WebView.

Link copied to clipboard
data class HostedGatewayConfig(val gatewayId: GatewayId, val displayName: String, val region: String, val docsPath: String, val blurb: String, val capabilities: Set<Capability> = setOf(Capability.ONE_TIME_PAYMENT, Capability.CARDS), val status: GatewayStatus = GatewayStatus.MOCK_MODE, val buildCheckoutUrl: (Map<String, String>) -> String, val matchReturn: (String) -> HostedReturnOutcome?)

One hosted-checkout gateway's shape. provider:hosted-webview is a single archetype-C module that takes N of these instead of a module per gateway (dozens of hosted gateways would otherwise blow up the build graph).

Link copied to clipboard
sealed interface HostedReturnOutcome

The terminal outcome detected from a return-URL redirect inside the hosted checkout WebView.

Link copied to clipboard

The archetype-C PaymentGateway: renders a hosted checkout page in a Compose WebView and resolves on return-URL redirect, per HostedGatewayConfig. One instance is created per configured gateway (see di/HostedWebViewModule.kt), all sharing the one HostedCheckoutRelay.

Link copied to clipboard

Common return-URL shapes seen across hosted gateways: a success/failure path or query marker, optionally carrying a payment id. Most configs can be expressed with this alone; gateways with a stranger return contract supply a custom matchReturn.

Link copied to clipboard
class SslFailClosedWebViewClient(onSslError: () -> Unit) : AccompanistWebViewClient

SECURITY: SSL/certificate errors on a hosted checkout page fail closed. compose-webview-multiplatform's AccompanistWebViewClient does not override onReceivedSslError at all, so without this subclass the platform default (handler.cancel()) silently cancels the load with no signal to the payment flow — the WebView would just sit blank. This override makes the failure explicit and reports it through onSslError so the orchestrator can settle the payment as com.siddharth.kmp.paymentsapi.PaymentResult.Failure.

Functions

Link copied to clipboard

Subscribes to HostedCheckoutRelay.requests and renders HostedCheckoutScreen for whichever hosted gateway is currently mid-checkout; reports the outcome back through the same relay so HostedWebViewGateway.pay resumes. configs is the app's assembled list of HostedGatewayConfig.

Link copied to clipboard
fun HostedCheckoutScreen(checkoutUrl: String, matchReturn: (String) -> HostedReturnOutcome?, onResult: (HostedReturnOutcome) -> Unit, modifier: Modifier = Modifier)

Renders one hosted gateway's checkout page and watches every navigation for the return-URL pattern. docs: https://github.com/KevinnZou/compose-webview-multiplatformstate.lastLoadedUrl is the interception point; the moment matchReturn recognizes a redirect as terminal, onResult fires exactly once (the reported guard survives re-navigation inside the same page load).

Link copied to clipboard
actual fun sslFailClosedWebViewParams(onSslError: () -> Unit): PlatformWebViewParams?

Builds the platform SSL-fail-closed hook for HostedCheckoutScreen's WebView, or null on platforms where PlatformWebViewParams has nothing to attach a client to.

actual fun sslFailClosedWebViewParams(onSslError: () -> Unit): PlatformWebViewParams?

Builds the platform SSL-fail-closed hook for HostedCheckoutScreen's WebView, or null on platforms where PlatformWebViewParams has nothing to attach a client to.

expect fun sslFailClosedWebViewParams(onSslError: () -> Unit): PlatformWebViewParams?

Builds the platform SSL-fail-closed hook for HostedCheckoutScreen's WebView, or null on platforms where PlatformWebViewParams has nothing to attach a client to.