Terminal
Entry point of the APA POS SDK. Create one instance per terminal and reuse it; instances are thread-safe.
Types
Builds an Terminal. Requires terminalId and connectionOptions to be set.
Functions
Asks the terminal to abort its current work.
Opens a shift via service-request/activate. ActivateData.userId is sent as ecrId for this call, and a successful request updates getState unless the SDK is disconnected.
Validates a remote connection by fetching an access token and querying the terminal. Updates getState accordingly and throws if the terminal cannot be reached.
Closes the current shift via service-request/deactivate and returns the clearing data. A successful request updates getState unless the SDK is disconnected.
Same as deactivate, but runs on a background thread and returns an Async wrapping it.
Clears the cached access token obtained by connect and moves getState to TerminalState.DISCONNECTED.
Same as disconnect, but runs on a background thread and returns an Async wrapping it.
Reads the persisted status of a previously started transaction.
Queries the terminal's current final balance/clearing totals.
Same as finalBalance, but runs on a background thread and returns an Async wrapping it.
Current TerminalState.
Recovers a pre-transaction wait after a restart using its persisted transactionId. Checks the recorded status before returning; throws IllegalStateException unless it is TransactionStatus.INITIALIZED. The returned handle waits for the pre-transaction to finish. Previously collected loyalty data cannot be recovered and is null in the result.
Asks the terminal to reboot, using the generic terminal command channel (there is no dedicated reboot endpoint on the terminal service).
Recovers an UncommittedTransactionResult for WAITING_FOR_COMMIT or TransactionResult for a settled operation. While the terminal reports IN_PROGRESS, this blocks the calling thread and re-polls the status every 250 ms until it settles into one of the states above. Polling is bounded by TerminalOptions.commitTimeout; if the transaction is still IN_PROGRESS once that budget elapses, or the status is UNKNOWN, this throws IllegalStateException - call resume again to keep waiting. A failed or timed-out status request throws TerminalException; it does not establish the payment outcome. Recovery may be repeated with the same transaction ID. Only data available from the status endpoint is recovered. Missing authorisation data is null.
Starts a pre-transaction wait ahead of the actual payment amount being known - triggers the background wait (see PreTransactionProgress class docs) on its own cancellable background thread right away, and returns a PreTransactionProgress immediately without waiting for it to complete. Call PreTransactionProgress.getResult to retrieve the outcome once available, or PreTransactionProgress.cancel to stop waiting.
Asynchronous variant of startPreTransaction. PreTransactionCall.onResult fires once the background wait completes.
Reverses a concluded transaction. ReversalRequest.transactionId is also used as this call's X-Correlation-ID.
Same as startReversal, but runs on a background thread and returns an Async wrapping it.
Runs configuration and/or initialisation, according to request - see ServiceRequest. The default request runs both configuration and initialisation for every acquirer.
Same as startServiceRequest, but runs on a background thread and returns an Async wrapping it.
Starts a transaction synchronously. Returns UncommittedTransactionResult when a commit decision is required, otherwise TransactionResult. Failed payments are results; communication failures throw TerminalException. Run on a worker thread when used from a UI.
Starts a transaction in the background. Use the returned handle to receive the final TransactionResult and to resolve deferred commit decisions.