API reference
Reference

API reference

Consumer wallet reference for Android and iOS. Android uses com.wollette; Swift uses WolletteApp. Merchant APIs are in the POS API reference. Methods wait for completion (suspend / async) and throw WolletteException / WolletteError unless noted. Every protected operation can also throw non-retryable DEVICE_COMPROMISED.

Error kinds are written in Android form; the iOS case is the camel-case equivalent (VALIDATION → .validation). Types are on the Types page.

Entry point

class WolletteSdk(context: Context, config: WolletteConfig)

val onboarding: Onboarding
val walletOnboarding: WalletOnboarding
val profile: Profile
val wollette: Wallet
val payments: Payments
suspend fun login(activity: Activity)
suspend fun applySession(accessToken: String, authorizationId: String, expirySeconds: Int)
suspend fun setRegistrationToken(token: String, provider: ApiContextProvider? = null)
suspend fun clear()

companion object {
    fun completeLogin(uri: Uri?)
}

The constructor throws VALIDATION if apiBaseUrl is not HTTPS or requestTimeoutMillis is not positive. Keep one instance; services cannot be constructed directly.

login

Opens the hosted login page (Chrome Custom Tab / ASWebAuthenticationSession), exchanges the callback for tokens and stores the session. Requires loginBaseUrl and redirectUri. Throws CANCELLED if the user dismisses the page. On iOS, a newer login or session replacement invalidates an unfinished login with VALIDATION; only the current attempt may save. On Android, login, applySession and clear share a lock on one instance, so later calls wait while login is pending. Tokens are never returned. Success does not imply push or tap-to-pay readiness.

iOS: cancelling the calling Task throws CancellationError.

The hosted-login configuration requires loginBaseUrl and a registered redirectUri. Android accepts the foreground Activity; Swift login() is @MainActor. User dismissal is CANCELLED / .cancelled; native coroutine/Task cancellation remains cancellation. Login does not create the consumer device association. See the Android and iOS starter flows.

applySession

Stores a host-managed consumer session. expirySeconds is the remaining lifetime at the time of the call. Your app owns renewal even if a login service is configured. Blank inputs or non-positive lifetime produce VALIDATION; malformed JWT structure/payload produces INVALID_RESPONSE; disallowed consumer/delegation claims produce UNAUTHORIZED. The parser checks claims, not the JWT signature. Does not open a browser or return tokens. If the consumer identity changes, previous form/recovery storage and native consumer payment keys are cleared. Stop the separate iOS Bluetooth client before switching. Handle cleanup failures. In-flight calls for the previous session fail with non-retryable VALIDATION.

setRegistrationToken

Stores the FCM token, then syncs the device association when a session exists. No session: success without HTTP, provider not called. Session with no provider or an invalid first context: VALIDATION, token kept, no HTTP. The read and the create/update use distinct contexts. Blank token: VALIDATION.

clear

On success, deletes the stored session, pending wallet operation and wallet-form storage. Both platforms delete native consumer payment keys; Android also disarms NFC. Your app stops the separate iOS Bluetooth client. No API call. Developer keys, local device identity, in-memory FCM token and registration OTP state remain. Cleanup may stop on a storage error; see Sign out and switch consumers.

completeLogin (Android)

For hosts whose own activity receives the redirect. Does not wait. Prefer the intent filter on LoginRedirectActivity.

Hosted wallet presentation (iOS)

All four wrappers present the SDK-owned WebView from a visible UIViewController:

iOS entry pointAndroid equivalent
startWalletOnboardingwalletOnboarding.start(activity, provider)
resumeWalletRegistrationwalletOnboarding.resumeRegistration(activity, provider)
addWalletAccountwalletOnboarding.addAccount(activity, provider)
resumePendingWalletRegistrationwalletOnboarding.resumePendingRegistration(activity, provider)

See WalletOnboarding below.

ApiContext and ApiContextProvider

data class ApiContext(developerId: String, nonce: String, signature: String)
fun interface ApiContextProvider { suspend fun nextContext(): ApiContext }

One developer proof per Wollette API HTTP attempt. nextContext is called once per attempt, including the retry after a 401 refresh, and never for the login service's /tokens or /refresh. toString() / description omit the signature. Rules: Developer authentication.

Onboarding

Consumer registration by phone OTP. All methods take a provider except state and clearRegistration.

MethodReturnsBehaviourErrors
stateRegistrationStateCurrent step: Idle, OtpRequested(phone), OtpVerified(phone). Memory only; process death resets it. Android: not suspend. iOS: async getter—
checkPhone(phone, provider)AvailabilityWhether the number is free. Does not start an OTP sessionVALIDATION, NETWORK, UNAUTHORIZED, SERVER, INVALID_RESPONSE
requestOtp(phone, provider)—Sends an SMS OTP and stores the phone in memory. Replaces any previous sessionVALIDATION, NETWORK, UNAUTHORIZED, OTP_COOLDOWN, SERVER, INVALID_RESPONSE
resendOtp(provider)—Sends another OTP for the stored phone. Clears a previously verified codeREGISTRATION_STATE, NETWORK, UNAUTHORIZED, OTP_COOLDOWN, SERVER, INVALID_RESPONSE
verifyOtp(code, provider)—Confirms a 6-digit code and stores it for createUserVALIDATION, REGISTRATION_STATE, NETWORK, UNAUTHORIZED, OTP_INVALID, SERVER, INVALID_RESPONSE
checkEmail(email, provider)AvailabilityEmail must be non-blank. Does not change the OTP sessionVALIDATION, NETWORK, UNAUTHORIZED, SERVER, INVALID_RESPONSE
checkUsername(username, provider)AvailabilityUsername must be non-blank. Does not change the OTP sessionVALIDATION, NETWORK, UNAUTHORIZED, SERVER, INVALID_RESPONSE
createUser(request, provider)CreateUserResultCreates the consumer. Requires a requested and verified OTP. Attaches device name and a local serial number. Address required unless appType is NATIVE_WOLLETTE. Clears the session on successVALIDATION, REGISTRATION_STATE, NETWORK, UNAUTHORIZED, SERVER, INVALID_RESPONSE
clearRegistration()—Drops the in-memory session. No API call. Does not throw—

Onboarding.createUser

ContractBehaviour
Before callingRequest and verify the phone OTP on the same SDK instance
RequestCreateUserRequest; use approved terms, gender, locale and address-area IDs
AddressRequired for THIRD_PARTY; only NATIVE_WOLLETTE may omit it; a supplied address is validated
ReturnsConsumer id and fullyRegistered; neither creates a sign-in session nor confirms wallet activation
Success side effectClears the in-memory registration session
Lost responseDetermine whether the consumer exists through the approved onboarding/support process before submitting again
ContinueSign in, then activate

The SDK does not provide reference-data lookup methods. Your host obtains valid IDs through the core reference-data reads for the approved environment; variables such as termsId are app inputs, not literal test values.

WalletOnboarding

interface WalletOnboarding {
    suspend fun pendingProgress(provider: ApiContextProvider): WalletOnboardingProgress?
    suspend fun resumePendingRegistration(activity: Activity, provider: ApiContextProvider): WalletOnboardingProgress
    suspend fun resumePendingRegistration(webView: WalletOnboardingWebView, provider: ApiContextProvider): WalletOnboardingProgress
    suspend fun addAccount(activity: Activity, provider: ApiContextProvider): WalletOnboardingProgress
    suspend fun addAccount(webView: WalletAccountLinkingWebView, provider: ApiContextProvider): WalletOnboardingProgress
    suspend fun progress(provider: ApiContextProvider): WalletOnboardingProgress
    suspend fun registrationStatus(provider: ApiContextProvider): WalletGriffinState
    suspend fun start(activity: Activity, provider: ApiContextProvider): WalletOnboardingProgress
    suspend fun start(webView: WalletOnboardingWebView, provider: ApiContextProvider): WalletOnboardingProgress
    suspend fun resumeRegistration(activity: Activity, provider: ApiContextProvider): WalletOnboardingProgress
    suspend fun resumeRegistration(webView: WalletOnboardingWebView, provider: ApiContextProvider): WalletOnboardingProgress
}
MethodBehaviour
pendingProgressChecks server state for the saved AIS target. Returns null/nil and clears a completed or invalid record; null/nil does not prove general activation is complete
resumePendingRegistrationContinues the saved target without new AIS. With no saved record, returns Complete without starting a flow. Check general progress separately
addAccountStarts new AIS authorisation, requires the new consent ID from the trusted callback, and continues for that target. An existing-account match can return Complete; refresh the linked-account list
progressReads general AIS, latest Griffin registration, PIS and account state. Check pending recovery first; an older active account can already satisfy general progress
registrationStatusReads the latest Griffin registration regardless of AIS or PIS state. No registration: mode START, null id and status. Accepted: mode ACCEPTED
startChooses the first incomplete step, opens its form, confirms with the API after the callback, creates the BaaS account before PIS if needed, continues through confirmed Griffin states in the same call. Returns Complete, Needs(step) or Griffin(state)
resumeRegistrationSame state machine as start, intended for continuation after a restart, a saved draft or a pending result

All wallet-onboarding operations require a session and provider. Methods that open forms also require access to the fixed development form origin. Custom addAccount presentation requires WalletAccountLinkingWebView. See Custom WebView adapter. A callback that leaves server state unchanged for about 30 seconds returns Needs or Griffin. Closing the SDK-owned WebView throws CANCELLED; a failed message throws ONBOARDING_FAILED; a Griffin saved message closes the SDK-owned form, reads progress once and returns that progress without polling or opening the next form. The result can be Needs, Griffin with the current server-derived mode, or Complete. The public custom-adapter interface does not expose the built-in draft-saved signal; see adapter limits. Concurrent start calls on one instance are serialised. Android: the SDK-owned path throws VALIDATION if the device WebView lacks document-start script injection or the web message listener.

Wallet (sdk.wollette)

MethodReturnsBehaviourErrors
retrieve(provider)WalletAccountFirst BaaS account from the API. Empty list throws WALLET_NOT_READY. A returned account does not prove PIS is complete. Safe to retryUNAUTHORIZED, NETWORK, SERVER, INVALID_RESPONSE, WALLET_NOT_READY, STORAGE
linkedAccounts(provider)List<LinkedAccount>Linked CURRENT bank accounts from AIS consents. Empty list is valid. Safe to retryUNAUTHORIZED, NETWORK, SERVER, INVALID_RESPONSE, STORAGE
topUp(accountId, amount, provider)WalletTransferBank account → wallet. Requires a completed PIS consent for the account. Your app opens the returned authorizationUrl when presentVALIDATION, UNAUTHORIZED, NETWORK, SERVER, INVALID_RESPONSE, STORAGE
payOut(accountId, amount, provider)WalletTransferWallet → bank account. Requires account number and sort codeVALIDATION, UNAUTHORIZED, NETWORK, SERVER, INVALID_RESPONSE, WALLET_NOT_READY, STORAGE
reconcileTopUp(paymentId, provider)TopUpStatusOne reconciliation request for a top-up. Safe to retryShared request errors: VALIDATION, UNAUTHORIZED, NETWORK, SERVER, INVALID_RESPONSE, STORAGE
awaitTopUpCompletion(paymentId, provider)TopUpStatusReconciles every 2 seconds until succeeded, declined or expired. After 180 seconds throws retryable SERVER. Fresh proof per pollErrors from reconciliation; retryable SERVER on timeout; task/coroutine cancellation can propagate
updateBalanceControlSettings(settings, provider)—Replaces auto top-up and minimum balance together. Null minimum clears it. Resolves the wallet firstVALIDATION, UNAUTHORIZED, NETWORK, SERVER, INVALID_RESPONSE, WALLET_NOT_READY, STORAGE, DEVICE_COMPROMISED
transactionsWalletTransactionsTransaction history service—

Reconciliation uses the shared authenticated request/error path. Invalid proofs and session replacement can produce VALIDATION; response decoding can produce INVALID_RESPONSE. Protected calls can also produce DEVICE_COMPROMISED. Use kind and retryable rather than treating an error table as an exhaustive list of host-provider or cancellation errors.

Wallet.retrieve

Read the current consumer's first BaaS wallet account.

suspend fun retrieve(provider: ApiContextProvider): WalletAccount
ContractBehaviour
Required inputFresh developer proof from provider, plus an active consumer session
Device/activation prerequisitesNo FCM/device-association requirement for this read. A returned account is not proof of completed activation
Returned valueWalletAccount; response fields, including balance, can be absent
Empty account listWALLET_NOT_READY / .walletNotReady
Side effectsAuthenticated GET and SDK-owned token refresh where applicable; no activation or payment initiation
RetryRead is marked safe; use retryable for eligible network/429/5xx failures. Host-owned sessions require host renewal
Other failuresDeveloper-proof/session validation, storage, decoding, device-integrity and transport failures; native cancellation and provider errors can propagate

The Consumer starter apps call this after hosted login. See wallet reads for linked accounts, pagination and optional money fields.

Wallet.topUp

ContractBehaviour
accountIdThe linked bank account's LinkedAccount.id, not the BaaS WalletAccount.id
Other inputsActive consumer session, provider and positive finite amount; money policy still needs backend confirmation
Account stateMatching completed PIS consent
ReturnsWalletTransfer.id, optional status and optional authorizationUrl
Host actionSave the returned ID and open any authorisation URL in the system browser
Confirm resultreconcileTopUp for one check, or awaitTopUpCompletion for polling
Retry boundaryDo not automatically repeat initiation; a lost response can leave an uncertain transfer
Insufficient fundsThe specific PIS HTTP 401 rejection is non-retryable VALIDATION, not UNAUTHORIZED; see error handling

Wallet.payOut

ContractBehaviour
accountIdThe selected linked bank account's ID
Other inputsActive consumer session, provider and positive finite amount
Account detailsAccount number and sort code must be available
ReturnsWalletTransfer; its presence alone does not establish settlement
Host actionRecord returned identity/status and use the approved backend outcome/reconciliation process
Retry boundaryDo not automatically repeat initiation; reconcileTopUp is not a pay-out status method

The transfer guide shows both calls. Required units, rounding/precision and accepted currencies belong to the confirmed backend contract.

WalletTransactions.list

suspend fun list(from: Date, to: Date, startingAfter: String? = null, provider: ApiContextProvider): TransactionPage

One page of wallet transactions. from and to are inclusive. VALIDATION if from is after to or startingAfter is not a non-negative integer. Safe to retry. Resolving an empty wallet-account list throws WALLET_NOT_READY. Errors: VALIDATION, UNAUTHORIZED, NETWORK, SERVER, INVALID_RESPONSE, WALLET_NOT_READY, STORAGE.

Profile (sdk.profile)

MethodReturnsBehaviourErrors
retrieve(provider)UserProfileConsumer and account details. Safe to retryUNAUTHORIZED, NETWORK, SERVER, INVALID_RESPONSE, STORAGE, DEVICE_COMPROMISED
update(changes, provider)—Reads the current consumer, preserves version and unedited fields, sends a full update. Empty change set or blank string is VALIDATION. Not safe to auto-retryVALIDATION, UNAUTHORIZED, NETWORK, SERVER, INVALID_RESPONSE, STORAGE, DEVICE_COMPROMISED
changePassword(oldPassword, newPassword, otp, provider)—Verifies the 6-digit OTP, then submits the change. Success invalidates the session (Android also clears payment keys and NFC)VALIDATION, OTP_INVALID, UNAUTHORIZED, NETWORK, SERVER, INVALID_RESPONSE, STORAGE, DEVICE_COMPROMISED

Profile.update

Supply at least one allowed field in ProfileChanges. Omitted/null fields mean unchanged. The SDK reads the current consumer and version, preserves other fields and sends a full update. It is not safe to automatically repeat a mutation after a lost response; re-read the profile before deciding what remains to change. See profile settings.

Profile.changePassword

Supply non-blank old/new passwords and the required six-digit OTP. The SDK verifies that OTP and submits the change. Success invalidates the session; Android also clears payment keys and NFC. The OTP request/acquisition contract still needs Wollette confirmation. Handle the documented password-change flow and subsequent sign-in explicitly.

Payments (sdk.payments)

MethodPlatformBehaviour
pay(accountId, provider)AndroidPrepares tap to pay for a linked account: device association, payment keys, arms the HCE service. Requires session, HCE, NFC on, completed PIS consent, and an FCM token (or an existing association). VALIDATION otherwise. Errors: VALIDATION, UNAUTHORIZED, NETWORK, SERVER, INVALID_RESPONSE, STORAGE
pay(accountId:provider:)iOSThrows .validation. No HCE on iOS
stop()AndroidDisarms immediately, invalidates in-flight pay calls, does not throw or wait
stop()iOSNo-op

LoginRedirectActivity (Android)

Library activity that completes login. Merge an exported intent filter into your app manifest. tools:replace overrides the library's exported=false; the app callback, SDK URI and hosted-login registration must match:

XML
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">
    <application>
        <activity android:name="com.wollette.LoginRedirectActivity"
            android:exported="true" tools:replace="android:exported">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="myapp" android:host="wollette-callback" />
            </intent-filter>
        </activity>
    </application>
</manifest>

Consumer Bluetooth (iOS)

Retain AppleBlePaymentClient for the foreground payment screen:

Swift
func exchange(
    accountId: String,
    profile: BleGattProfile,
    provider: any ConsumerBlePayloadProvider,
    minimumRSSI: Int = -65,
    discoveryMillis: Int = 2_000,
    timeoutMillis: Int = 40_000,
    onStage: @escaping @Sendable (BleTransferStage) -> Void = { _ in }
) async throws
func stop() async

exchange returns Void: success means transferred, not authorised. It allows one active exchange per client. stop cancels and waits for its current task. The legacy payments.stop() is unrelated.

Construct BackendConsumerBlePayloadProvider(preparation: sdk.consumerPayments, provider: provider) and use .wollettePaymentV1. The concrete provider resolves the trusted POS key, prepares the payer and encrypts the envelope. Ordinary missing/expired/unbound account keys are provisioned once within the same exchange. Unknown mutations require explicit recovery; an expired device key requires separate maintenance.

Consumer payer preparation (iOS)

Obtain the preparation actor from sdk.consumerPayments; it has no public initializer.

Swift
func payer(
    accountId: String,
    provider: any ApiContextProvider
) async throws -> ConsumerPaymentPayer

func replaceAccountKey(
    accountId: String,
    provider: any ApiContextProvider,
    recoverUnknownOutcome: Bool = false
) async throws -> ConsumerPaymentKeyInfo

payer requires the current device/account association, matching completed PIS consent and a bound account key. It does not create/rotate that key. Keep the returned inner payer native and out of logs.

replaceAccountKey replaces server key material. A pending marker survives unknown response, cancellation or storage failure. recoverUnknownOutcome: true explicitly authorises another replacement, not retrieval of the lost key. This mutation disables automatic HTTP 401 refresh/replay; that does not change the ordinary policy for other consumer reads.

Types, validation and error families are described under Types, Validation and Errors. The consumer payment guide shows the screen lifecycle.