Handle errors and retries
This page covers core consumer errors. Consumer Bluetooth has additional error types. Merchant integrations use POS errors and recovery rules.
Handle SDK errors by kind: Android uses WolletteException; iOS uses WolletteError. Message wording can vary by operation, so do not use it for control flow. Also handle coroutine/task cancellation and errors from your own dependencies separately.
| Field | Meaning |
|---|---|
kind | Stable code, for example VALIDATION or .validation |
message | Public text for display; do not parse it |
statusCode | HTTP status when the failure came from the server |
retryable | True only when the call is marked safe to retry and the failure was a network error, HTTP 429 or HTTP 5xx |
cause (Android) / underlyingDescription (iOS) | Transport or decoding diagnostic |
A handling pattern
try {
sdk.onboarding.verifyOtp(code, provider)
} catch (e: WolletteException) {
when (e.kind) {
WolletteErrorKind.OTP_INVALID -> showWrongCode()
WolletteErrorKind.OTP_COOLDOWN -> showWaitBeforeResend()
WolletteErrorKind.UNAUTHORIZED -> showSignIn()
WolletteErrorKind.WALLET_NOT_READY -> startActivation()
WolletteErrorKind.DEVICE_COMPROMISED -> showDeviceBlocked()
else -> if (e.retryable) offerRetry() else showError(e.message)
}
}do {
try await sdk.onboarding.verifyOtp(code, provider: provider)
} catch let error as WolletteError {
switch error.kind {
case .otpInvalid: showWrongCode()
case .otpCooldown: showWaitBeforeResend()
case .unauthorized: showSignIn()
case .walletNotReady: startActivation()
case .deviceCompromised: showDeviceBlocked()
default: error.retryable ? offerRetry() : showError(error.message)
}
}Which calls are safe to retry
Read/reconciliation operations: checkPhone, checkEmail, checkUsername, wallet retrieve, linkedAccounts, reconcileTopUp, transaction list, and profile retrieve.
Not safe to auto-retry: OTP requests and verification, createUser, profile updates, password changes, balance-control updates, topUp, payOut and pay. For these, re-read state before deciding to submit again. awaitTopUpCompletion keeps calling reconcileTopUp and reports a retryable SERVER error after 180 seconds.
A multi-step method can fail during a prerequisite read and propagate retryable=true before its mutation. The mutation request itself remains unsafe to replay automatically. Use the operation-specific state/reconciliation contract; do not turn the flag into a generic financial Retry button.
Codes that change your flow
| Kind | What it means for your app |
|---|---|
UNAUTHORIZED | The session is gone or the token is not a consumer token. Sign in again |
WALLET_NOT_READY | No BaaS account was returned. Check pending and general activation progress before continuing |
CANCELLED | The user closed the login page or a wallet form. Return to your screen |
ONBOARDING_FAILED | A wallet form reported failure. Offer retry |
DEVICE_COMPROMISED | Stop the flow, show a device error, do not retry login. The SDK attempts cleanup; a storage failure can leave some data undeleted |
REGISTRATION_STATE | Registration steps out of order. Restart from the OTP request |
VALIDATION | Check input/proof and the operation. It also represents the specific PIS insufficient-funds rejection. Discard the previous consumer UI only when you know the session changed |
STORAGE | The device's secure storage is unavailable |
The full catalogue with causes is in Errors.
iOS task cancellation
Cancelling the Swift Task that is awaiting login during the browser wait or token exchange throws CancellationError, not .cancelled. Handle both.
Session replacement during a call
If you know the session changed during a call, discard the old consumer UI when it returns VALIDATION. Otherwise check inputs and context first; the error kind alone does not prove a session change. For applySession, malformed JWTs use INVALID_RESPONSE, while disallowed consumer claims use UNAUTHORIZED.
Diagnose the failure before offering Retry
| Symptom | Check | Next action |
|---|---|---|
VALIDATION before HTTP | Inputs, developer ID/proof shape and any session change | Correct configuration/context first; validation alone does not prove sign-out |
UNAUTHORIZED | Session owner and token type/environment | Reauthenticate or renew the host-managed session |
NETWORK on a read | retryable, connectivity and current consumer context | Offer an explicit read retry when eligible |
| Failure after a mutation | Operation-specific progress/reconciliation API | Read current state before deciding whether to submit again |
| Cleanup reports storage failure | Which cleanup steps completed | Keep protected UI unavailable; follow incomplete cleanup |
For support, collect SDK revision, platform/OS, operation, kind and HTTP status. Never log private keys, tokens, OTPs or signatures. Share transaction identifiers through the approved support channel.
Troubleshoot the first failing checkpoint
| Failure | Check and next action | Expected result / escalation |
|---|---|---|
| Package cannot resolve | Correct module/version and read permissions; use the documented source path when applicable | Dependency resolves; otherwise the package owner fixes access |
| Developer proof rejected before HTTP | Check origin, installed alias/tag, fresh UUID, RSA key and proof shape | Local validation passes; enrolment/verification still needs Wollette confirmation |
| Login fails to return | Match the registered URI, SDK configuration and Android manifest/iOS URL Types | Return to the active app; otherwise confirm callback registration |
Top-up VALIDATION, HTTP 401, safe message Insufficient funds | The SDK recognised the specific PIS business rejection and skipped refresh/replay | Display the rejection; do not force sign-in or automatically submit again |
Consumer UNAUTHORIZED (normally HTTP 401) | Check identity, remaining lifetime, environment and enrolled signing material | Sign in/renew through the correct session owner, then explicitly read |
| Wallet not ready | After sign-in inspect pendingProgress before general progress | Resume the saved operation or outstanding activation step |
| OTP rejected/cooldown | Use the typed kind and approved resend interval | User corrects the code or waits; avoid repeated OTP requests |
For iOS consumer payment/Bluetooth work, handle ConsumerPaymentError, BleTransportError, core errors and native cancellation separately. Use the diagnostic template and include only fields actually exposed by that error family. For merchant uncertainty use the POS recovery rules, rather than a generic Retry action.
Diagnostic examples
These are decision examples, not captured live-test results. Use fields actually exposed by the error.
| Observation | Check | Next action |
|---|---|---|
VALIDATION occurs before an HTTP attempt | Local inputs, DeveloperId, nonce/signature shape and any known consumer change | Correct the local setup; a well-shaped proof still needs server verification |
An authenticated wallet read returns UNAUTHORIZED with HTTP 401 | Consumer session ownership, remaining lifetime, token type and environment; enrolled signing material with Wollette | Hosted sessions use their configured SDK renewal path. For host-managed sessions, obtain a current token and apply it, then explicitly read |
A read fails with NETWORK and retryable=true | Connectivity and the current consumer context | Offer a read retry. This flag does not authorise resubmitting a financial mutation |
Use the support template if the approved inputs still fail. A real support destination and known proof-verification example remain Wollette requirements.