Errors
Core consumer calls throw WolletteException on Android and WolletteError on iOS. Their WolletteErrorKind codes match. Consumer Bluetooth/preparation uses additional types below; merchant failures have a separate POS error reference.
| Field | Type | Meaning |
|---|---|---|
kind | WolletteErrorKind | Stable code. The iOS raw value equals the Android enum name |
message | String | Fixed public text for the kind, with safe operation-specific wording where applicable. Raw backend text is not passed through |
statusCode | Int? | HTTP status when the failure came from the server |
retryable | Boolean | Whether the failed request was classified safe to retry; check the enclosing operation before repeating a mutation |
cause (Android) | Throwable? | Underlying transport or parsing failure |
underlyingDescription (iOS) | String? | Sendable-safe transport or decoding diagnostic |
Kinds
| Android | iOS | Default message | When |
|---|---|---|---|
VALIDATION | .validation | The request is invalid. | Client-side input check failed; invalid config; unmapped HTTP 4xx; a session replacement that invalidates an in-flight operation; a late HTTP success discarded after logout, applySession or login; iOS hosted login superseded by a newer login; the specific PIS insufficient-funds rejection below |
DEVICE_COMPROMISED | .deviceCompromised | This device cannot securely use Wollette. | Root or jailbreak indicators detected. Protected work blocked; cleanup attempted, with possible storage failures |
NETWORK | .network | The network request failed. | Transport failure, no response |
UNAUTHORIZED | .unauthorized | Authentication is required. | Ordinary HTTP 401 (except the PIS insufficient-funds case below), or the token is not a consumer token, or the consumer is suspended or deactivated |
OTP_INVALID | .otpInvalid | The OTP is invalid. | HTTP 400 or 422 on OTP verification |
OTP_COOLDOWN | .otpCooldown | Please wait before requesting another OTP. | HTTP 429 on OTP send |
SERVER | .server | The server request failed. | HTTP 5xx or an unmapped failure |
INVALID_RESPONSE | .invalidResponse | The server response is invalid. | Body cannot be decoded, a required value is missing, a JWT structure/payload is malformed, or an account-linking callback has no valid new consent ID |
WALLET_NOT_READY | .walletNotReady | The wallet is not ready yet. | Wallet-account resolution returned an empty BaaS account list, including during retrieve, payOut, balance-control updates or transaction reads. Finish or resume activation |
REGISTRATION_STATE | .registrationState | The registration state does not allow this operation. | OTP not requested or not verified |
ONBOARDING_FAILED | .onboardingFailed | Wallet onboarding failed. | A hosted wallet form reported failure; the next form was not opened |
STORAGE | .storage | The device storage is unavailable. | Device identity, session, pending wallet recovery record or native consumer payment keys cannot be read, written or deleted |
CANCELLED | .cancelled | The login was cancelled. | The user dismissed the login page or a wallet form, or a custom adapter reported dismissal. The message keeps its login wording for all cases |
Retry rule
retryable is true only when the call is marked safe to retry and the failure is a network error, HTTP 429 or HTTP 5xx.
Read/reconciliation operations marked safe to retry: checkPhone, checkEmail, checkUsername, wallet retrieve, linkedAccounts, reconcileTopUp, transaction list, profile retrieve.
The mutation HTTP requests for OTP request/resend/verification, createUser, profile update, changePassword, updateBalanceControlSettings, topUp, payOut and pay are not marked safe to retry. Some of these methods perform prerequisite reads; a failure in one of those reads can still propagate retryable=true. That flag does not authorise replaying an uncertain mutation. Re-read or reconcile operation state before submitting again.
awaitTopUpCompletion reports a retryable SERVER error after its 180-second timeout.
Special cases
For POST psd/pis/payments only, HTTP 401 with the exact JSON message Insufficient funds is a business rejection. Both clients return VALIDATION / .validation, statusCode=401, the fixed public message Insufficient funds and retryable=false. They skip session refresh and replay for this response. Handle it as a rejected top-up, rather than asking the user to sign in again. Other 401 responses follow the ordinary authentication path.
DEVICE_COMPROMISEDis never retryable and persists across later calls, including a laterlogin.- A successful
changePasswordinvalidates the session; later protected calls need a fresh sign-in. - iOS: cancelling the
TaskawaitingloginthrowsCancellationError, not.cancelled. - Android:
paythrowsVALIDATIONfor missing HCE, NFC off, PIS not ready or no FCM token.
Handling patterns: Handle errors and retries.
Consumer payment preparation errors (iOS)
ConsumerPaymentError exposes kind and outcomeUnknown.
| Swift case | Raw code | Handling |
|---|---|---|
.keySetupRequired | PAYMENT_KEY_SETUP_REQUIRED | Prepare an account key; the concrete Bluetooth provider handles ordinary setup once |
.keyRecoveryRequired | PAYMENT_KEY_RECOVERY_REQUIRED | Explicit replacement recovery; do not blindly repeat the mutation |
.keyExpired | PAYMENT_KEY_EXPIRED | Account-key renewal; the concrete provider handles ordinary expiry once |
.deviceKeyExpired | DEVICE_PAYMENT_KEY_EXPIRED | Separate device-key maintenance; account-key replacement does not fix it |
.operationInProgress | OPERATION_IN_PROGRESS | Wait for/cancel current preparation |
.contextChanged | CONTEXT_CHANGED | Discard stale account/session work |
Unknown account-key replacement persists a pending marker. Explicit recovery authorises a new replacement, not retrieval of the old key. Native cancellation remains CancellationError.
Bluetooth transport errors (iOS)
BleTransportError raw values are lower camel case:
| Cases | Handling |
|---|---|
invalidConfiguration | Correct the Bluetooth arguments |
unavailable, permissionRequired | Resolve device/radio/foreground/permission setup |
multipleTerminals | Ask the consumer to move closer to one terminal and retry |
failed, invalidMessage, timedOut, sessionExpired | Stop the attempt and offer an explicit retry after checking payment outcome as appropriate |
noTerminal | The public foreground client normally repeats discovery while its screen remains active |
Another exchange on the same client throws core WolletteError.validation. HTTP, session, developer-proof and storage failures can also remain core errors. Handle these error families and cancellation separately.
A consumer transfer error does not prove that the POS submitted no payment. The financial outcome channel must be confirmed with Wollette.