Errors
Reference

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.

FieldTypeMeaning
kindWolletteErrorKindStable code. The iOS raw value equals the Android enum name
messageStringFixed public text for the kind, with safe operation-specific wording where applicable. Raw backend text is not passed through
statusCodeInt?HTTP status when the failure came from the server
retryableBooleanWhether 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

AndroidiOSDefault messageWhen
VALIDATION.validationThe 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.deviceCompromisedThis device cannot securely use Wollette.Root or jailbreak indicators detected. Protected work blocked; cleanup attempted, with possible storage failures
NETWORK.networkThe network request failed.Transport failure, no response
UNAUTHORIZED.unauthorizedAuthentication 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.otpInvalidThe OTP is invalid.HTTP 400 or 422 on OTP verification
OTP_COOLDOWN.otpCooldownPlease wait before requesting another OTP.HTTP 429 on OTP send
SERVER.serverThe server request failed.HTTP 5xx or an unmapped failure
INVALID_RESPONSE.invalidResponseThe 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.walletNotReadyThe 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.registrationStateThe registration state does not allow this operation.OTP not requested or not verified
ONBOARDING_FAILED.onboardingFailedWallet onboarding failed.A hosted wallet form reported failure; the next form was not opened
STORAGE.storageThe device storage is unavailable.Device identity, session, pending wallet recovery record or native consumer payment keys cannot be read, written or deleted
CANCELLED.cancelledThe 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_COMPROMISED is never retryable and persists across later calls, including a later login.
  • A successful changePassword invalidates the session; later protected calls need a fresh sign-in.
  • iOS: cancelling the Task awaiting login throws CancellationError, not .cancelled.
  • Android: pay throws VALIDATION for 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 caseRaw codeHandling
.keySetupRequiredPAYMENT_KEY_SETUP_REQUIREDPrepare an account key; the concrete Bluetooth provider handles ordinary setup once
.keyRecoveryRequiredPAYMENT_KEY_RECOVERY_REQUIREDExplicit replacement recovery; do not blindly repeat the mutation
.keyExpiredPAYMENT_KEY_EXPIREDAccount-key renewal; the concrete provider handles ordinary expiry once
.deviceKeyExpiredDEVICE_PAYMENT_KEY_EXPIREDSeparate device-key maintenance; account-key replacement does not fix it
.operationInProgressOPERATION_IN_PROGRESSWait for/cancel current preparation
.contextChangedCONTEXT_CHANGEDDiscard 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:

CasesHandling
invalidConfigurationCorrect the Bluetooth arguments
unavailable, permissionRequiredResolve device/radio/foreground/permission setup
multipleTerminalsAsk the consumer to move closer to one terminal and retry
failed, invalidMessage, timedOut, sessionExpiredStop the attempt and offer an explicit retry after checking payment outcome as appropriate
noTerminalThe 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.