Skip to main content

Cordova — Events Reference

The Cordova plugin delivers all asynchronous SDK state changes (transaction results, connection changes, status updates) via a single persistent event handler. This is separate from the per-operation callbacks passed to each financial operation call.

Registering the event handler​

Call handpoint.eventHandler() separately from handpoint.setup(). The event handler must be registered before any operations are initiated.

// Step 1 — initialize the SDK
handpoint.setup(
{
sharedSecret: "YOUR_SHARED_SECRET",
automaticReconnection: true,
},
function(result) { console.log("Setup complete", result); },
function(error) { console.error("Setup failed", error); }
);

// Step 2 — register the persistent event handler (separate call)
handpoint.eventHandler(
function(event) {
// event.event → event name (string)
// event.data → event payload (object)
switch (event.event) {
case "endOfTransaction":
handleResult(event.data.transactionResult);
break;
case "currentTransactionStatus":
updateStatusDisplay(event.data.info.message);
break;
// ... handle other events
}
},
function(error) { console.error("Event handler error:", error); }
);

All events share the same outer envelope:

{
"event": "<eventName>",
"data": { ... }
}

Priority events​

endOfTransaction​

Fires when a financial operation completes. Use this as the primary result handler for all transactions.

Android payload:

{
"event": "endOfTransaction",
"data": {
"transactionResult": { ... },
"device": { ... }
}
}

iOS payload:

{
"event": "endOfTransaction",
"data": {
"transactionResult": { ... }
}
}

The transactionResult object is the full Transaction Result. The device field is included on Android only.


currentTransactionStatus​

Fires repeatedly during an active transaction to report in-progress status. Use this to update your UI (e.g. "Waiting for card", "Authorising…").

Android payload:

{
"event": "currentTransactionStatus",
"data": {
"info": { ... },
"device": { ... }
}
}

iOS payload:

{
"event": "currentTransactionStatus",
"data": {
"info": {
"cancelAllowed": true,
"deviceStatus": { ... },
"message": "Authorising...",
"status": "authorising"
},
"device": { ... }
}
}

Android passes the full StatusInfo object serialized by Gson; iOS extracts only the four fields shown above. The cancelAllowed boolean indicates whether handpoint.cancelRequest() can be called at this point.


All events​

Cross-platform events (Android + iOS)​

Eventdata fieldsDescription
endOfTransactiontransactionResult, device (Android only)Financial operation completed — check transactionResult.finStatus
connectionStatusChangedstatus (string), deviceTerminal connection state changed
currentTransactionStatusinfo (StatusInfo), deviceMid-transaction status update
deviceDiscoveryFinisheddevices (array)listDevices() scan completed
signatureRequiredmerchantReceipt (string), deviceTerminal requires manual signature verification — display receipt and call handpoint.signatureResult(accepted)

connectionStatusChanged status values:

ValueMeaning
"Connected"Terminal connected and ready
"Connecting"Connection attempt in progress
"Disconnected"Terminal disconnected
"Diconnecting"Disconnection in progress
"Initializing"Terminal initializing after connect
"NotConfigured"Terminal connected but not configured
iOS typo

"Diconnecting" (missing the first n) is the exact string returned by the iOS SDK — match it exactly in your code.


Android-only events​

Eventdata fieldsDescription
networkStatusChangednetworkStatus, deviceTerminal network connectivity changed
receiptsReadymerchantReceipt (string HTML), customerReceipt (string HTML), guid (string)Receipt HTML is ready for display or printing
receiptsUploadedmerchantReceiptUrl (string), customerReceiptUrl (string), guid (string)Receipts uploaded to cloud storage (only fires when getReceiptsAsURLs: true in setup)
transactionResultReadytransactionResult, deviceTransaction result available for retrieval
cardTokenizedcardTokenizationDataCard tokenization data ready during tokenizedOperation two-phase flow
authStatusinfo (AuthenticationResponse)mPOS authentication status update
showMessagemessage (string), dismissible (string "true"/"false"), duration (string of integer ms)SDK requests your app display a message; dismissible and duration are serialized as strings
hideMessagemessage (string)SDK requests your app hide a previously shown message
hardwareStatusChangedstatus (HardwareStatus enum string), connectionMethod (ConnectionMethod enum string)Hardware connection state changed
transactionStartedtype (string), amount (string), currency (ISO alpha string), transactionReference (string)Transaction initiated on the terminal
dependantRefundReceivedamount (string), currency (string), originalTransactionId (string), resumeDependantOperationDependent refund awaiting execution — call resumeDependantOperation() to proceed
dependantReversalReceivedoriginalTransactionId (string), resumeDependantOperation, cardPresent (boolean)Dependent reversal awaiting execution
enrichtransactionResultTransaction result paused for enrichment (fires only when enrichTransactionResult: true in setup)
printErrorerror (PrintError object)Printer encountered an error
printSuccess(empty {})Print completed successfully
reportResulthtmlReport (string)getTransactionsReport() result ready
deviceLogsReadylogs (string), deviceDevice log data fetched
controlCommandcommand (string), payload (string)Internal device control command echoed from the SDK — values: setKioskMode, setLocale, setPasswordProtection, setScreenBrightness
onMessageLoggedlevel (LogLevel enum string), message (string)SDK internal log message
cardLanguagelocale (SupportedLocales enum string)Card language preference detected
onKeyPressedkey (string)Physical keyboard key pressed on the terminal
supportedCardBrandscardBrandsList (array of strings)Terminal reports its supported card brands
readCardusedCard (CardBrands enum string)Card brand detected at card read
webViewUpdatedsuccess (string "true"/"false")WebView content update completed

iOS-only events​

Eventdata fieldsDescription
exceptionmessage (string)SDK error or unhandled exception
scannerResultsscannedCodes (array)QR/barcode scan results from enableScanner()
scannerOff(empty {})Scanner deactivated

Platform availability summary​

EventAndroidiOS
endOfTransactionYesYes
connectionStatusChangedYesYes
currentTransactionStatusYesYes
deviceDiscoveryFinishedYesYes
signatureRequiredYesYes
networkStatusChangedYesNo
receiptsReadyYesNo
receiptsUploadedYesNo
transactionResultReadyYesNo
cardTokenizedYesNo
authStatusYesNo
showMessageYesNo
hideMessageYesNo
hardwareStatusChangedYesNo
transactionStartedYesNo
dependantRefundReceivedYesNo
dependantReversalReceivedYesNo
enrichYesNo
printErrorYesNo
printSuccessYesNo
reportResultYesNo
deviceLogsReadyYesNo
controlCommandYesNo
onMessageLoggedYesNo
exceptionNoYes
scannerResultsNoYes
scannerOffNoYes