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.
| Kind | Handling |
|---|---|
VALIDATION | Correct input/configuration |
INVALID_SESSION, SESSION_REQUIRED, SESSION_EXPIRED | Supply a valid host-managed merchant session |
FORBIDDEN_CONTEXT, CONTEXT_REQUIRED, CONTEXT_CHANGED | Revalidate selected merchant/branch/POS and discard stale UI work |
OPERATION_IN_PROGRESS | Wait for/cancel current work before another operation |
KEY_MISSING, KEY_EXPIRED | Inspect key state and perform explicit maintenance before new initiation |
KEY_ALREADY_PRESENT, INVALID_KEY | Validate import/current key; do not silently overwrite it |
KEY_RECOVERY_REQUIRED | Explicit recovery rotation; never automatically replay an uncertain mutation |
OPERATION_UNRESOLVED | Inspect/recover retained financial operation |
RECOVERY_WINDOW_EXPIRED | Retain journal and reconcile externally; never invent a new operation ID |
NFC_UNAVAILABLE, TRANSPORT_UNAVAILABLE, BLE_PERMISSION_REQUIRED | Resolve hardware/permission/setup; before claim another available source may continue |
NFC_FAILED, NFC_INVALID_RESPONSE, BLE_FAILED, BLE_INVALID_RESPONSE, PAYER_TIMEOUT | Inspect journal before explicit retry; no selected-channel fallback |
NETWORK, HTTP | Use HTTP status, uncertainty and journal state; no automatic financial replay or token refresh |
STORAGE | Secure persistence failed; preserve unresolved financial state |
DEVICE_COMPROMISED | Stop 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
- Let the active call finish or cancel. Preserve coroutine cancellation.
- Inspect
pendingOperation()using the original terminal context. - Recover a submitted operation; do not start another payment/refund.
- For a never-submitted abandoned attempt, acknowledge it before an explicit retry.
- 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
| Failure | Next action | Completion checkpoint |
|---|---|---|
| POS 401 | Retain the journal; host renews/checks the merchant session and key/context | Recover the same operation; platform distinguishes token from signature failure |
| Transfer happened without a definitive result | Inspect original snapshot/request and recover it | Same financial result or an explicit unresolved state |
| Result saved but host completion failed | Keep the receipt and retry only the unfinished host step | One financial creation and one completed host flow |
| Journal/host record lost, or replay expired | Block fresh initiation and contact the named reconciliation owner | Server/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:
- Let the active call end or cancel, then inspect
pendingOperation()with the original API/storage and terminal context. - If the snapshot has a known request ID, renew the host-managed merchant session and recover that same request.
- If a submitted snapshot has no request ID, follow explicit exact replay within its allowed window. Reuse the saved request; do not call
paywith a replacement identity. - 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.