Handle PIN Entry
Some transactions require the cardholder to enter a PIN. Unlike signature capture, the SDK draws its own native PIN pad UI — you don't build this screen yourself. Your app is still responsible for getting out of the way: any dialog or overlay your app is showing (e.g. the "tap your card" dialog) must be hidden while the native PIN pad is on screen, or the PIN pad will be drawn behind it.
PIN-Related onTransactionUIEvent Constants
onTransactionUIEvent fires with these SDK constants
(my.com.softspace.reader.TransactionCodes.TransactionUIEvent) during PIN
entry:
| Constant | Meaning |
|---|---|
EVENT_ENTER_PIN | The native PIN pad is about to be shown — hide your own UI now. |
EVENT_PIN_ENTERED | The cardholder finished entering their PIN — safe to restore your UI. |
EVENT_PIN_TIMEOUT | PIN entry timed out — safe to restore your UI. |
EVENT_CANCEL_PIN | The cardholder cancelled PIN entry — safe to restore your UI. |
EVENT_PIN_BYPASS | PIN entry was bypassed for this transaction. No UI action needed. |
EVENT_CARD_READ_OK_REMOVE_CARD | The card was read successfully and can be removed. Informational — update any status text, no dialog changes needed. |
Also see Capture Signature for the other
onTransactionUIEvent case your app must handle, and
Flow Overview for where this fits in the overall
sequence.
Sample Handling
@Override
public void onTransactionUIEvent(int event) {
switch (event) {
case TransactionUIEvent.EVENT_ENTER_PIN:
onPinRequired(true);
break;
case TransactionUIEvent.EVENT_PIN_ENTERED:
case TransactionUIEvent.EVENT_PIN_TIMEOUT:
case TransactionUIEvent.EVENT_CANCEL_PIN:
onPinRequired(false);
break;
default:
writeLog("onTransactionUIEvent: Unhandled event (" + event + ")");
break;
}
}
private void onPinRequired(boolean requiresPin) {
if (requiresPin) {
tapCardDialog.hide(); // don't dismiss() — you'll want to show() it again
} else {
tapCardDialog.show();
}
}