Set Card Reader Mode
Overview
The SDK exposes a ReaderType class that constrains how a card can be presented during a transaction—magnetic stripe (swipe), EMV chip (insert), and/or contactless (tap). Choose one value per request to match your business rules and the terminal’s capabilities.
Meaning of Each Option
SWIPE | Only magnetic stripe cards |
|---|---|
NSERT | Only chip (EMV) cards |
SWIPE_INSERT | Either swipe or insert |
CLESS | Contactless (tap) only |
CLESS_SWIPE | Contactless or swipe |
INSERT_CLESS | Insert or contactless |
INSERT_CLESS_SWIPE | All card input methods (recommended) |
Setting ReaderType in a Transaction Request
Assign the desired readerType when constructing a RequestMsg for a sale, refund, or token
operation. Select exactly one constant per transaction.
val requestMsg = RequestMsg(
msgType = MsgType.SALE,
invoiceNbr = DEFAULT_INVOICE_NUMBER,
amount = parsedAmount,
currency = DEFAULT_CURRENCY,
readerType = ReaderType.INSERT, // Choose allowed card input method here
tokenReq = tokenRequest,
agreementID = agreementID,agreementType = agreementType,
)Common Usage Patterns
Allow all input methods (most common)
readerType = ReaderType.INSERT_CLESS_SWIPE
Force contactless only
readerType = ReaderType.CLESS
Restrict to chip insert
readerType = ReaderType.INSERT
Allow tap + insert
readerType = ReaderType.INSERT_CLESS
Best Practices & Notes
- Prefer flexibility: Use INSERT_CLESS_SWIPE unless your flow or compliance rules require
otherwise. - Match hardware: Ensure the terminal supports the selected method(s) to avoid interaction
errors. - One per request: Only one readerType can be set per transaction.
- UI hint: If your UI lets a cashier pick methods, map those choices to a single constant before sending the request.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/**
* Class containing constants for reader types.
* These constants represent the type of card readers used in transactions.
*/
class ReaderType private constructor() {
companion object {
const val SWIPE = 1 // Magnetic stripe only
const val INSERT = 2 // Chip (EMV) only
const val SWIPE_INSERT = 3 // Swipe or Insert
const val CLESS = 4 // Contactless (Tap) only
const val CLESS_SWIPE = 5 // Contactless + Swipe
const val INSERT_CLESS = 6 // Insert + Contactless
const val INSERT_CLESS_SWIPE = 7 // All methods allowed
}
}