Custom WebView adapter
Use the SDK-owned WebView unless you need custom presentation and can implement the session and callback contract. For initial activation or recovery, implement WalletOnboardingWebView. For account linking, implement WalletAccountLinkingWebView. The SDK still chooses the step, forms the URL and confirms every step with the API; your adapter owns everything that happens inside the WebView.
The interface
fun interface WalletOnboardingWebView {
suspend fun open(url: String, step: WalletOnboardingStep)
}protocol WalletOnboardingWebView: Sendable {
func open(url: URL, step: WalletOnboardingStep) async throws
}open receives the SDK-formed URL and the step (AIS, GRIFFIN or PIS). It must present a WebView and suspend until the form's callback returns control. If the user dismisses the WebView, throw WolletteException(WolletteErrorKind.CANCELLED) on Android or WolletteError(kind: .cancelled) on iOS.
Public adapter limits
The public adapter receives only url and step; it does not receive a consumer token or a session-injection callback. Hosted login keeps its session private and exposes no public token getter. Use SDK-owned presentation with hosted login unless Wollette supplies a supported custom-session mechanism.
A custom adapter needs the current token from an approved host-managed consumer-session integration that your app already owns and renews. Inject it securely on the trusted form origin before scripts run, as described in the session contract. Do not read SDK storage or put tokens in URLs to work around this boundary.
The built-in Griffin saved flow also uses an internal signal that the public adapter cannot emit. A normal open return starts API confirmation; it does not reproduce save-and-return. Use the built-in presenter if you need that behaviour until the SDK exposes a public contract. Do not convert saved into user cancellation: cancellation can clear saved recovery context.
Support account linking
The linking adapter must also expose the new AIS consent ID:
interface WalletAccountLinkingWebView : WalletOnboardingWebView {
suspend fun completedAisConsentId(): String?
}protocol WalletAccountLinkingWebView: WalletOnboardingWebView {
func completedAisConsentId() async -> String?
}Capture data.consentId only from a valid AIS finished message from the trusted main frame. Clear the previous captured value before each new AIS opening. addAccount rejects a missing or previously existing consent ID with INVALID_RESPONSE; the SDK checks completion through the API. The legacy complete string cannot supply this ID.
Call walletOnboarding.addAccount with this adapter. resumePendingRegistration accepts the base adapter because it already has the saved AIS target. Keep the complete SDK entry URL, including flow=add-account and resume=pis on a recovered PIS entry. On a bank return, use the documented continuation URL and preserve flow=add-account; the native continuation does not copy resume=pis or every entry query parameter. See bank returns.
Use it
// Initial activation; check pendingProgress first on a returning session.
val result = sdk.walletOnboarding.start(webViewAdapter, provider)// Initial activation; check pendingProgress first on a returning session.
let result = try await sdk.walletOnboarding.start(
webView: webViewAdapter,
provider: provider
)Ordinary completion, failure and user dismissal feed the same API-confirmation state machine. The built-in draft-save path has the public-adapter limitation above. A callback is only a signal to re-check the API; returning from open does not mark the step as done. If the callback arrives before the server has processed the step, the SDK polls for about 30 seconds and continues through confirmed Griffin states within the same call.
Map valid callbacks explicitly:
| Callback or interruption | Adapter action |
|---|---|
Trusted finished for the active step | Return normally from open; the SDK confirms server state |
Trusted failed | Throw core ONBOARDING_FAILED / .onboardingFailed |
User dismissal or trusted cancelled | Throw core CANCELLED / .cancelled |
| Coroutine/Task cancellation | Preserve native cancellation; do not replace it with a user-dismissal result |
Griffin saved | Not publicly expressible as the built-in save-and-return signal; use SDK-owned presentation |
What your adapter must implement
Everything the SDK-owned host does for you:
| Responsibility | What the SDK-owned host does |
|---|---|
| Session injection | Uses its internal session access to set window.WOLLETTE_SESSION and the matching localStorage entry before page scripts run, on the form origin only |
| Callback capture | Accepts WOLLETTE_NATIVE.postMessage from the form's main frame on the form origin and returns control on a terminal event |
| Bank returns (AIS, PIS) | Detects the backend callback URL for the active step and reloads the hosted continuation page |
| Identity-provider return (Griffin) | Polls the registration while an external page is open and reloads the Griffin form when the status changes |
open_url | Opens an HTTPS link in the device browser without closing the form |
| Storage cleanup | Clears the form origin's storage on clear and on consumer switch |
| Camera (Android) | Requests permission and grants the WebView video capture only |
The exact messages, URLs and paths are in Hosted form contract. The native restoration mechanisms are provided only by the SDK-owned hosts; an adapter has its own storage lifecycle and must reproduce them.