End of Transaction
Normally application is informed about transaction result using callback functions (the result may be an approval, a decline, or an error). Also, an application may stop the transaction before the kernel is finished. There are 2 functions to end a transaction before it finishes.
stopTransaction
: this call doesn’t terminate the transaction immediately. It signals the kernel about the stop request. Kernel stops the flow asap if it isn’t finished already. The application receives result callbacks after the kernel finishes its flow.
cancelTransaction
: this function forcefully ends the kernel flow.
Kernel Callbacks
There are 2 types of callbacks,
Synchronous callbacks: These callbacks are called in kernel thread, kernel suspends until application returns from the function.
onAppSelectCompleted
: Called after application selection, Aid list is passed to the application, the application may return preferred AID. If null is returned, the kernel selects the application according to EMV flow.
onReadRecordsCompleted
: Called after read records completed, the application may override some parameters according to records read.
onCvmDecision
: Called before CVM processing, the application may override the CVM method.
onTryAgain
: Called if card communication fails, and a new tap is required, the application may return false if a new try is not preferred.
onSignalReceived
: (optional) Called if DEK signal is received in Mastercard flow. Application may return a DET signal immediately or may callprocessDetSignal
later. processDetSignal
a signal may be called several times according to Mastercard flow.
Informative (async) callbacks: These callbacks are run in the UI thread, the kernel continues its flow in parallel, nothing waits from the application.
onNotifyCardWait
: Inform user about card read
onNotifyCardInProgress
: Inform user about a card in progress
onNotifyCardRemoval
: Inform user about card removal
onNotifyCardRetry
: Inform user about card retry (note that before this call onTryAgain
was called, if the application returns true on that call, this function is invoked, and kernel starts to listen for a card)
Action (async) callbacks: These callbacks are also asynchronous, but the kernel does not continue processing, the application should reenter to kernel flow using appropriate calls.
onOnlineAuthorization
: Send an authorization request to the acquirer, and inform the kernel about the authorization result. After authorization completeEMVTransaction
function is called.
onTransactionCompleted
: Called after kernel finishes. the result might be approved or declined.
onTransactionTerminated
: Called after kernel finishes with error.
onPerformPinEntry
: Online pin is acquired. After pin entry userInputEntered
function is called.
onPerformSignatureEntry
: Signature is acquired. After signature entry userInputEntered
function is called. If the signature will be acquired later, the application may immediately enter the kernel.