Errors, Logging and Troubleshooting

WirexError codes and reasons, logging, timeouts and the common failures of the Android SDK.

Before You Start

Read the following guides before proceeding:

GuideWhy
Android SDKSurfaces, isolation model and flows
SDK Setupcreate(...), the credential provider and screen protection

Where Errors Arrive

SurfaceDelivery
Revealsnapshot.state Failed(error). load() throws only WirexDeclined
CollecttokenizeTopUp / tokenizeOctDestination throw WirexError
3-D Secureoutcome.error, code ORIGIN_REFUSED, DECLINED or UNAVAILABLE
Google PayExecuteFailed and Failed events

WirexError

codeHandling
UNAUTHORIZEDRefresh the access token. The SDK never retries a 401
ACTION_REQUIREDObtain a fresh action token and retry
UPDATE_REQUIREDShip a newer SDK build
INVALID_INPUTFix the input — see reason
TEMPORARYRetry when retryable is true. A timed-out request fails TEMPORARY and is retryable
FAILEDTerminal
reasonMeaning
ACTION_TOKEN_REJECTEDThe API rejected the action token. Mint a fresh GetCardDetails token
CARD_ALREADY_LINKEDCollect: the card is already linked. Ask for a different card
CARD_LIMIT_REACHEDCollect: the user holds the maximum number of saved cards. Remove one first
INVALID_CARD_IDReveal: the card id is malformed
fun describe(error: WirexError): String = when (error.code) {
    WirexError.Code.UNAUTHORIZED -> "refresh the access token"
    WirexError.Code.ACTION_REQUIRED -> "obtain a fresh action token and retry"
    WirexError.Code.UPDATE_REQUIRED -> "ship a newer SDK build"
    WirexError.Code.INVALID_INPUT -> when (error.reason) {
        WirexError.Reason.CARD_ALREADY_LINKED -> "enter a different card"
        WirexError.Reason.CARD_LIMIT_REACHED -> "remove a card first"
        else -> "fix the highlighted field"
    }
    WirexError.Code.TEMPORARY -> if (error.retryable) "retry" else "give up"
    WirexError.Code.FAILED -> "terminal"
}

Other Types

  • WirexDeclined is not an error state: the user said no and nothing was sent.
  • WirexEnvironmentUnavailable is thrown by WirexEnvironment.resolve(name, chainId) and
    WirexWalletEnvironment.resolve(name): UnknownName, NotBuilt, MalformedEndpoints, MissingChainId.
    The create(...) factories return null for the same conditions. Show the reason; never fall back to another
    environment.

Logging

Logging is off by default. Every logged value passes a redactor; tokens and card data are never handed to a
sink. Sinks are called on arbitrary threads and must not block.

SurfaceOptionLogcat tag
Reveal, Collect, 3-D Securelogging = WirexLogging(level, sink). Presets: WirexLogging.DISABLED (default), WirexLogging.DEBUG, logcatLogging(level)WirexappCardSdk
Google PayWirexWalletLogging with its own sink type and com.wirexapp.wallet.topup.logcatLogging(level). Default WirexWalletLogging.DISABLEDWirexWallet
val reveal = WirexReveal.create(
    credentials = credentials, chainId = "<chain id>",
    logging = logcatLogging(WirexLogLevel.INFO),
    timeouts = WirexTimeouts(connectMillis = 10_000, readMillis = 20_000),
)

Log at DEBUG in development builds and WARN in release.


Timeouts

timeouts = WirexTimeouts(connectMillis, readMillis) on create(...). Both default to 15 seconds. A timed-out
request fails with code TEMPORARY and retryable = true.


Troubleshooting

SymptomCauseResolution
A revealed field is blank or will not unmaskFLAG_SECURE not active on the window; onRevealRefused firesPass the window with secureWindow(window)
create(...) returns nullThe build has no endpoints for that environment, or chainId is blankCall WirexEnvironment.resolve(name, chainId) to get the reason
Reveal or Collect fails with UNAUTHORIZEDStale bearer. The SDK never retries a 401Check expiry and refresh inside accessToken()
API answers 400 on every callBoth userEmail and userWallet are setReturn exactly one identity
Collect cannot tokenizeBilling details missing, or the user is not enrolled at the acquirerSend every required billing field — see Collect a Card
The Pay button is unavailableChecker not started, empty provider block, or the device is below the Google Pay floorsStart WirexWalletAvailabilityChecker with the real block; test on a device with Google Pay set up
3-D Secure ends in PENDINGThe payment is not settled yetNot an error. Settle from the top-up status

Did this page help you?