Skip to main content
Version: Android SDK 7.1004.2

Events Listeners

SmartposRequired

Events.SmartposRequired Interface

You must provide a class implementing this interface when initializing the SDK for a smartPOS terminal (PAX/Telpo).

Code example

public final class EventHandler implements Events.SmartposRequired {

@Override
public void connectionStatusChanged(ConnectionStatus status, Device device) { ... }
@Override
public void currentTransactionStatus(StatusInfo statusInfo, Device device) { ... }
@Override
public void endOfTransaction(TransactionResult transactionResult, Device device) { ... }
@Override
public void transactionResultReady(TransactionResult transactionResult, Device device) { ... }

}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);

Events

ConnectionStatusChangedCurrentTransactionStatusEndOfTransaction PendingResults

MposRequired

Events.MposRequired Interface

You must provide a class implementing this interface when initializing the SDK for an mPOS terminal (HiLite).

Code example

public final class EventHandler implements Events.MposRequired {
@Override
public void deviceDiscoveryFinished(List devices) { ... }
@Override
public void connectionStatusChanged(ConnectionStatus status, Device device) { ... }
@Override
public void currentTransactionStatus(StatusInfo statusInfo, Device device) { ... }
@Override
public void signatureRequired(SignatureRequest signatureRequest, Device device) { ... }
@Override
public void endOfTransaction(TransactionResult transactionResult, Device device) { ... }
@Override
public void transactionResultReady(TransactionResult transactionResult, Device device) { ... }

}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);

Events

ConnectionStatusChangedCurrentTransactionStatusEndOfTransaction PendingResults DeviceDiscoveryFinished SignatureRequired

PosRequired

Events.PosRequired Interface

You must provide a class implementing this interface when initializing the SDK when supporting both mPOS and SmartPOS terminals (PAX/Telpo & HiLite).

Code example

public final class EventHandler implements Events.PosRequired {
@Override
public void deviceDiscoveryFinished(List devices) { ... }
@Override
public void connectionStatusChanged(ConnectionStatus status, Device device) { ... }
@Override
public void currentTransactionStatus(StatusInfo statusInfo, Device device) { ... }
@Override
public void signatureRequired(SignatureRequest signatureRequest, Device device) { ... }
@Override
public void endOfTransaction(TransactionResult transactionResult, Device device) { ... }
@Override
public void transactionResultReady(TransactionResult transactionResult, Device device) { ... }

}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);

Events

ConnectionStatusChangedCurrentTransactionStatusEndOfTransaction PendingResults DeviceDiscoveryFinished SignatureRequired

Card Brand Display

Events.CardBrandDisplay Interface

An interface which needs to be implemented and added as a listener to get events providing information on the supported card brands and/or the card brand used during the transaction.

Methods

supportedCardBrands( List<CardBrands> cardBrandsList );

ParameterNotes
cardBrandsList Required
List <CardBrands>
A list containing the supported card brands

readCard( CardBrands usedCard );

ParameterNotes
usedCard Required
CardBrands
Name of the card brand

Code example

public final class EventHandler implements Events.CardBrandDisplay {

@Override
public void supportedCardBrands(List cardBrandsList) {
// Get supported card brands
}

@Override
public void readCard(CardBrands usedCard) {
// Get the used card brand
}

}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);

Card Tokenization

Events.CardTokenization Interface

Implement this interface in order to receive events about the card tokenization.

Methods

cardTokenized( ResumeCallback callback, CardTokenizationData cardTokenizationData)

ParameterNotes
callback Required
ResumeCallback
Lets the SDK continue the operation
cardTokenizationData Required
CardTokenizationData
Object with the tokenization data.
public final class EventHandler implements Events.CardTokenization {

@Override
public void cardTokenized(@NonNull ResumeCallback callback, @NonNull CardTokenizationData cardTokenizationData) { ... }

}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);

Connection status changed

Events.ConnectionStatusChanged Interface

Implement this interface in order to receive connection status changes.

Methods

connectionStatusChanged( ConnectionStatus status , Device device );

ParameterNotes
status Required
ConnectionStatus
New status of the connection
device Required
Device
The terminal which sent this information.

Code example

public final class EventHandler implements Events.ConnectionStatusChanged {

@Override
public void connectionStatusChanged(ConnectionStatus status, Device device) { ... }

}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);

Current transaction status

Events.CurrentTransactionStatus Interface

Implement this interface in order to receive events about the current transaction.

Methods

currentTransactionStatus( StatusInfo status , Device device );

ParameterNotes
status Required
StatusInfo
The StatusInfo of the current transaction
device Required
Device
The terminal the request is sent from.

Code example

public final class EventHandler implements Events.CurrentTransactionStatus {

@Override
public void currentTransactionStatus(StatusInfo info, Device device) { ... }

}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);

Device capabilities ready

Events.DeviceCapabilitiesReady Interface

Implement this interface in case the payment terminal needs to notify the SDK of its capabilities

Methods

deviceCapabilities( DeviceCapabilities capabilities , Device device );

ParameterNotes
capabilities Required
DeviceCapabilities
The capabilities of the terminal
device Required
Device
The terminal sending its capabilities

Code example

public final class EventHandler implements Events.DeviceCapabilitiesReady {

@Override
public void deviceCapabilities(DeviceCapabilities capabilities, Device device) { ... }

}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);

Device discovery finished

Events.DeviceDiscoveryFinished Interface

Implement this interface in order to receive a list of available payment terminals. The event handler defined in this interface is invoked after calling the method searchDevices

Methods

deviceDiscoveryFinished( List<Device> devices );

ParameterNotes
devices Required
List <Device>
A list of available devices.

Code example

public final class EventHandler implements Events.DeviceDiscoveryFinished {

@Override
public void deviceDiscoveryFinished(List<Device> devices) {
// Receiving a list of connectable payment terminals
foreach(Device device in devices) { ... }

}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);

End of transaction

Events.EndOfTransaction Interface

Implement this interface to receive an event when a transaction is complete.

Methods

endOfTransaction( TransactionResult result , Device device );

ParameterNotes
result Required
TransactionResult
Holds all the information about the transaction.
device Required
Device
The payment terminal.

Code example

public final class EventHandler implements Events.EndOfTransaction {

@Override
public void endOfTransaction(TransactionResult result, Device device) {
// Check the status of the transaction, save it, ...
}

}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);

Hardware status changed

Events.HardwareStatusChanged Interface

Implement this interface in order to receive events when the hardware status changes.

Methods

hardwareStatusChanged( HardwareStatus status , Device device );

ParameterNotes
status Required
HardwareStatus
New status of the hardware.
device Required
Device
The payment terminal.

Code example

public final class EventHandler implements Events.HardwareStatusChanged {

@Override
public void hardwareStatusChanged(HardwareStatus status, Device device) { ... }

}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);

Log

Events.Log Interface

An interface which needs to be implemented and added as a listener to receive logging information.

Extends

OnMessageLogged

Code example

public final class EventHandler implements Events.Log {

@Override
public void deviceLogsReady(String logs, Device device) { ... }
@Override
public void onMessageLogged(LogLevel level , String message) { ... }

}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);

MessageHandling

Events.MessageHandling Interface

An interface which needs to be implemented and added as a listener to get events which are called when the sdk asks the application to display or hide a message.

Methods

showMessage( String message , Boolean dismissible , int duration );

ParameterNotes
message Required
String
Message to display
dismissible Required
Boolean
A flag that indicates whether the message can be dismissed
duration Required
int
The timeout to hide the message. In milliseconds, if 0 is sent, the message should not auto dismiss.

hideMessage( String message );

ParameterNotes
message Required
String
Message to hide

Code example

public final class EventHandler implements Events.MessageHandling {

@Override
public void showMessage(String message, Boolean dismissible, int duration) {
// Show message for a 'duration' period (if duration = 0 DO NOT dismiss until hideMessage(String message) event is received) and make it dismissible if the input marks it as possible
}

@Override
public void hideMessage(String message) {
// Hide the message
}

}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);

On message logged

Events.OnMessageLogged Interface

Implement this interface to receive logs from the payment terminal. Methods

onMessageLogged( LogLevel level , String message );

ParameterNotes
level Required
LogLevel
The LogLevel of the logging
message Required
String
The log trace which was logged by the SDK.

Code example

public final class EventHandler implements Events.OnMessageLogged {

@Override
public void onMessageLogged(LogLevel level, String message) {
// Process log trace
}

}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);

PhysicalKeyboardEvent

Events.PhysicalKeyboardEvent Interface

An interface which needs to be implemented and added as a listener to get events coming from the PAX A80 physical keyboard.

Methods

onKeyPressed( PaxA80Keys key );

ParameterNotes
key Required
PaxA80Keys
The name of the key that has been pressed

Code example

public final class EventHandler implements Events.PhysicalKeyboardEvent {

@Override
public void onKeyPressed(String key) { ... }

}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);

PendingResults

Events.PendingResults Interface

An interface which needs to be implemented and added as a listener to receive information about pending TransactionResults. In case of a communication failure between the SDK and the payment terminal there might be a result pending from the transaction which did not get sent to the SDK.

Code example

public final class EventHandler implements Events.PendingResults {

@Override
public void transactionResultReady(TransactionResult transactionResult, Device device) { ... }

}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);

Extends

TransactionResultReady

PaymentProvider

Events.PaymentProvider Interface

An interface which needs to be implemented and added as a listener to receive all available events related to financial operations.

Extends

SignatureRequired EndOfTransaction OnMessageLogged CurrentTransactionStatus

PrinterEvents

Events.PrinterEvents Interface

An interface which needs to be implemented and added as a listener to get events coming from the printer.

Methods

printSuccess( );

printError(PrintError error);

ParameterNotes
error Required
PrintError
Enum detailing the reason of the error

Code example

public final class EventHandler implements Events.PrinterEvents {

@Override
public void printSuccess() {
// Successful print action
}

@Override
public void printError(PrintError error) {
// Unable to perform print action due to error
}

}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);

Report result

Events.ReportResult Interface

Implement this interface to receive an event when a report result from a getTransactionsReport is returned.

Methods

reportResult( TypeOfResult type , String report , DeviceStatus status , Device device );

ParameterNotes
type Required
TypeOfResult
The type of the report
report Required
String
The text of the report
status Required
DeviceStatus
The status of the device
device Required
Device
The terminal sending the report

Code example

public final class EventHandler implements Events.ReportResult {

@Override
public void reportResult(TypeOfResult type, String report, DeviceStatus status, Device device) { ... }

}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);

Events

DeviceDiscoveryFinished SignatureRequired EndOfTransaction PendingResults

Signature required

Events.SignatureRequired Interface

The SignatureRequired interface must be implemented in order to receive an event when a card requires a signature as a verification method. This interface is only required for an Hilite integration, PAX and Telpo terminals automatically prompt for signature capture on the terminal.

Methods

signatureRequired( SignatureRequest request , Device device );

ParameterNotes
request Required
SignatureRequest
Holds the signature request.
device Required
Device
The payment terminal.

Code example

public final class EventHandler implements Events.SignatureRequired {

@Override
public void signatureRequired(SignatureRequest signatureRequest, Device device) {
// Save merchant receipt
String merchantReceipt = signatureRequest.getMerchantReceipt();
api.signatureResult(true);
}

}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);

Status

Events.Status Interface

An interface which needs to be implemented and added as a listener to receive connection and transaction statuses.

Code example

public final class EventHandler implements Events.Status {

@Override
public void connectionStatusChanged(ConnectionStatus status, Device device) { ... }
@Override
public void hardwareStatusChanged(HardwareStatus status, Device device) { ... }
@Override
public void currentTransactionStatus(StatusInfo info, Device device) { ... }

}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);

Extends

ConnectionStatusChanged HardwareStatusChanged CurrentTransactionStatus

Transaction result ready

Events.TransactionResultReady Interface

Implement this interface in order to receive an event after a pending TransactionResult has been recovered from the payment terminal.

Methods

transactionResultReady( TransactionResult transactionResult , Device device );

ParameterNotes
transactionResult Required
TransactionResult
A TransactionResult is containing all information about the recovered transaction.
device Required
Device
The payment terminal.

Code example

public final class EventHandler implements Events.TransactionResultReady {

@Override
public void transactionResultReady(TransactionResult transactionResult, Device device) { ... }

}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);

Transaction started

Events.TransactionStarted Interface

Implement this interface in order to receive an event when a transaction is started through the Cloud API channel.

IMPORTANT NOTE: This interface is only available for cloud-enabled devices. See DeviceCapabilitiesReady interface.

Methods

transactionStarted( TransactionType transactionType , BigInteger amount , Currency currency, String transactionReference );

ParameterNotes
transactionType Required
TransactionType
Type of transaction started
amount Required
BigInteger
Amount in the minor unit of currency (f.ex. 1000 is 10.00 GBP)
currency Required
Currency
Currency of the transaction started
transactionReference Required
String
The transaction reference of the started transaction. transactionReference will be empty if the operation has not been started with one, or if it is an operation to which it does not apply (a tokenization, for example)

Code example

public final class EventHandler implements Events.TransactionStarted {

//If the transactionReference has NOT been included in the request, it will be empty.
@Override
public void transactionStarted(TransactionType type, BigInteger amount, Currency currency, String transactionReference) {
// Notify the app user transaction has been started ...
}
}

// Remember to register the instance of this EventHandler:
this.api.registerEventsDelegate(eventHandlerInstance);