POS errors and retry rules
Reference

POS errors and retry rules

Use the error kind, HTTP status and retained operation to choose the next action. POS errors are separate from consumer errors.

Error types

POS operations throw WollettePosException. Constructor URL validation uses the shared parser and can instead throw WolletteException(VALIDATION); handle that setup error too. It exposes kind, optional statusCode, and outcomeUnknown (default false). Coroutine cancellation remains cancellation; inspect the journal to determine submission uncertainty. Never branch on message text.

KindHandling
VALIDATIONCorrect input/configuration
INVALID_SESSION, SESSION_REQUIRED, SESSION_EXPIREDSupply a valid host-managed merchant session
FORBIDDEN_CONTEXT, CONTEXT_REQUIRED, CONTEXT_CHANGEDRevalidate selected merchant/branch/POS and discard stale UI work
OPERATION_IN_PROGRESSWait for/cancel current work before another operation
KEY_MISSING, KEY_EXPIREDInspect key state and perform explicit maintenance before new initiation
KEY_ALREADY_PRESENT, INVALID_KEYValidate import/current key; do not silently overwrite it
KEY_RECOVERY_REQUIREDExplicit recovery rotation; never automatically replay an uncertain mutation
OPERATION_UNRESOLVEDInspect/recover retained financial operation
RECOVERY_WINDOW_EXPIREDRetain journal and reconcile externally; never invent a new operation ID
NFC_UNAVAILABLE, TRANSPORT_UNAVAILABLE, BLE_PERMISSION_REQUIREDResolve hardware/permission/setup; before claim another available source may continue
NFC_FAILED, NFC_INVALID_RESPONSE, BLE_FAILED, BLE_INVALID_RESPONSE, PAYER_TIMEOUTInspect journal before explicit retry; no selected-channel fallback
NETWORK, HTTPUse HTTP status, uncertainty and journal state; no automatic financial replay or token refresh
STORAGESecure persistence failed; preserve unresolved financial state
DEVICE_COMPROMISEDStop protected work; host handles its own credentials

outcomeUnknown reports uncertainty for returned errors; its absence/false value on an unrelated transport failure does not replace pendingOperation(). See key recovery and financial recovery.

Check state before retrying

  1. Let the active call finish or cancel. Preserve coroutine cancellation.
  2. Inspect pendingOperation() using the original terminal context.
  3. Recover a submitted operation; do not start another payment/refund.
  4. For a never-submitted abandoned attempt, acknowledge it before an explicit retry.
  5. If no financial operation is outstanding, inspect keyState() before repeating key setup.

An HTTP 401 does not trigger SDK token refresh. Your app renews the merchant token and explicitly recovers the saved operation. Even 401/412 initiation errors can leave a submitted operation with an unknown outcome.

A callback stage or transport error is not a financial result. Keep pending and timed-out results outstanding until a definitive result or external reconciliation is available.

Troubleshooting and diagnostic evidence

FailureNext actionCompletion checkpoint
POS 401Retain the journal; host renews/checks the merchant session and key/contextRecover the same operation; platform distinguishes token from signature failure
Transfer happened without a definitive resultInspect original snapshot/request and recover itSame financial result or an explicit unresolved state
Result saved but host completion failedKeep the receipt and retry only the unfinished host stepOne financial creation and one completed host flow
Journal/host record lost, or replay expiredBlock fresh initiation and contact the named reconciliation ownerServer/order state resolved before another attempt

Use the support diagnostic template. Read kind/status/uncertainty from the error and phase/status from the public snapshot when available. Preserve native cancellation and avoid deriving HTTP fields from message text. Never export the encrypted journal or payer/signature material.

Example: authentication fails after submission

This is a recovery decision example, not a captured backend test:

  1. Let the active call end or cancel, then inspect pendingOperation() with the original API/storage and terminal context.
  2. If the snapshot has a known request ID, renew the host-managed merchant session and recover that same request.
  3. If a submitted snapshot has no request ID, follow explicit exact replay within its allowed window. Reuse the saved request; do not call pay with a replacement identity.
  4. If state is unreadable, missing or past the unknown-submission window, block new initiation and use the approved reconciliation route.

HTTP 401 alone does not tell the app whether the token, signature or another server-side check failed. Collect the exposed kind/status and public snapshot phase, then use the secure diagnostic handoff.