After creating an instance of the MTSCRA class in your custom software project, use the methods described in this section to communicate with SCRA device.
setConnectionType
This method sets the connection type of the device.
public void setConnectionType(MTConnectionType connectionType)
Parameters:
Parameter
Description
connectionType
The following table shows the connection types supported by the various SCRA devices:
Return Value: None
This function when set to True instructs the SDK to automatically retry to connect to the Bluetooth LE reader upon pairing. If set to False, the Bluetooth LE reader will be disconnected after pairing. This function is set to False by default in the SDK, but MagTek highly recommends to set this flag to True in your application in order to make sure that you'll have a successful secure connection between Android OS and Bluetooth LE reader after the paring.
Parameters:
Return Value: None
This method sets the address of the device.
Parameters:
Return Value: None
This method sets the configuration parameters for the device.
Parameters:
Return Value: None
This method opens connection to the device.
Parameters: None
Return Value: None
This method closes the connection to the device.
Parameters: None
Return Value: None
This method returns whether the device is connected or not.
Parameters: None
Return Value:
Return true if the device is connected. Otherwise, return false.
This method returns whether the device supports EMV or not.
Parameters: None
Return Value:
Return true if EMV is supported by the device. Otherwise, return false.
Get stored masked tracks data. If decodable track data exists for a given track, it is located in the Masked Track Data field that corresponds to the track number. The length of each Masked Track Data field is fixed at 112 bytes, but the length of valid data in each field is determined by the Masked Track Data
Length field that corresponds to the track number. Masked Track Data located in positions greater than indicated in the Masked Track Data Length field are undefined and should be ignored.
The Masked Track Data is decoded and converted to ASCII and then it is masked. The Masked Track Data includes all data starting with the start sentinel and ending with the end sentinel. Much of the data is masked; a specified mask character is sent instead of the actual character read from the track. Which characters are masked depends on the format of the card. Only ISO/ABA (Financial Cards with Format Code B) and AAMVA cards are selectively masked; all other card types are either entirely masked or sent totally in the clear. There is a separate masking property for ISO/ABA cards and AAMVA cards. See D99875475 for the ISO Track Masking property and the AAMVA Track Masking property for more information. See D99875475 for a description on how ISO/ABA and AAMVA cards are identified.
Each of these properties allows the application to specify masking details for the Primary Account Number and Driver’s License / ID Number (DL/ID#), the masking character to be used, and whether a correction should be applied to make the Mod 10 9 (Luhn algorithm) digit at the end of the number be correct.
Parameters: None
Return Value:
Return stored masked tracks data string.
Get stored track1 data. This field contains the encrypted track data for track 1.
True = SDK will retry the conection after pairing.
False = SDK will not retry the connection after pairing.
Parameter
Description
deviceAddress
String value of the address.
Parameter
Description
configuration
String value of the configuration parameters to be used for the device.
Audio Reader Device Configuration
Parameter
Default Value
Configurable Values
PAN_MOD10_CHECKDIGIT
TRUE
setConnectionRetry
setAddress
setDeviceConfiguration
openDevice
closeDevice
isDeviceConnected
isDeviceEMV
getMaskedTracks
getTrack1
Android 4.4.2 and above
FALSE, TRUE
public void setConnectionRetry(boolean connectionRetry)
public void setAddress(String deviceAddress)
public void setDeviceConfiguration(String configuration)
public void openDevice()
public void closeDevice()
public boolean isDeviceConnected()
public boolean isDeviceEMV()
public String getMaskedTracks()
MTSCRA Class Methods - 31 - 40
getCardDataCRC
Retrieves CRC from card data.
public long getCardDataCRC()
Parameters: None
Return Value:
Card data CRC
getCardExpDate
Retrieves card experiation date from card data.
public String getCardExpDate() Parameters: None
Return Value:
String representing card expiration date.
getCardIIN
Retrieves Issuer Identification Number (IIN) from card data.
public String getCardIIN()
Parameters: None
Return Value: String representing card IIN.
Retrieves Last 4 digits of card number from card data.
Return Value:
String representing card last 4 digits.
Retrieves card name from card data. public
Return Value:
String representing card name.
Retrieves PAN from card data.
Return Value:
String representing card PAN.
Retrieves PAN length from card data.
Return Value:
PAN length
Retrieves Service Code.
Parameters: None Return Value:
String representing service code.
Retrieves Card Status.
Parameters: None
Return Value:
String representing card status.
This one-byte value indicates the type of encoding that was found on the card. The following table defines the possible values.
Parameters: None Return Value:
2
Reserved
3
Blank
The card is blank. Only occurs if all tracks decode without error and without data.
4
Other
The card has a non-standard encode format. For example, ISO/ABA track 1 format on track 2.
5
Undetermined
The card encode type could not be determined because no tracks could be decoded. (Combination of Error tracks and Blank Tracks, at least one Error track).
6
None
No decode has occurred. This type occurs if no magnetic stripe data has been acquired since the data has been cleared or since the reader was powered on. This reader only sends an Input report when a card has been swiped so this value will never occur.
Value
Encode Type
Description
0
ISO/ABA
ISO/ABA encode format. At least one track in ISO/ABA format, Track 3 not AAMVA format.
1
AAMVA
getCardLast4
getCardName
getCardPAN
getCardPANLength
getCardServiceCode
getCardStatus
getEncodeType
AAMVA encode Track 3 is AAMVA format, Tracks 1 and 2 are ISO/ABA if correctly decoded.
public String getCardLast4() Parameters: None
String getCardName() Parameters: None
public String getCardPAN() Parameters: None
public int getCardPANLength() Parameters: None
public String getCardServiceCode()
public String getCardStatus()
public int getEncodeType()
MTSCRA Class Methods - 11 - 20
getTrack2
Get stored track2 data. This field contains the encrypted track data for track 2.
public String getTrack2()
Parameters: None
Return Value:
Return stored track2 data string.
getTrack3
Get stored track3 data. This field contains the encrypted track data for track 3.
public String getTrack3()
Parameters: None
Return Value:
Return stored track3 data string.
getTrack1Masked
Get stored masked track1 data.
Parameters: None Return Value:
Return stored masked track1 data string.
For an ISO/ABA card, the PAN is masked as follows:
The specified number of initial characters is sent unmasked. The specified number of trailing characters is sent unmasked. If Mod 10 correction is specified, all but one of the intermediate characters of the PAN are set to zero; one of them will be set such that last digit of the PAN calculates an accurate Mod 10 check of the rest of the PAN as transmitted. If the Mod 10 correction is not specified, all of the intermediate characters of the PAN are set to the specified mask character.
The Card Holder’s name and the Expiration Date are transmitted unmasked.
All Field Separators are sent unmasked.
For an AAMVA card, the specified mask character is substituted for each of the characters read from the card.
Get stored masked track2 data.
Parameters: None
Return Value:
Return stored masked track2 data string.
For an ISO/ABA card, the PAN is masked as follows:
The specified number of initial characters are sent unmasked. The specified number of trailing characters are sent unmasked. If Mod 10 correction is specified, all but one of the intermediate characters of the PAN are set to zero; one of them will be set such that last digit of the PAN calculates an accurate Mod 10 check of the rest of the PAN as transmitted. If the Mod 10 correction is not specified, all of the intermediate characters of the PAN are set to the specified mask character.
The Expiration Date is transmitted unmasked.
All Field Separators are sent unmasked.
For an AAMVA card, the DL/ID# is masked as follows:
The specified number of initial characters are sent unmasked. The specified number of trailing characters are sent unmasked. If Mod 10 correction is specified, all but one of the intermediate characters of the DL/ID#PAN are set to zero; one of them will be set such that last digit of the DL/ID# calculates an accurate Mod 10 check of the rest of the DL/ID# as transmitted. If the Mod 10 correction is not specified, all of the intermediate characters of the DL/ID# are set to the specified mask character.
The Expiration Date and Birth Date are transmitted unmasked.
All other characters are set to the specified mask character.
Get stored masked track3 data.
Parameters: None
Return Value:
Return stored masked track3 data string.
For an ISO/ABA card, the PAN is masked as follows:
The specified number of initial characters are sent unmasked. The specified number of trailing characters are sent unmasked. If Mod 10 correction is specified, all but one of the intermediate characters of the PAN are set to zero; one of them will be set such that last digit of the PAN calculates an accurate Mod 10 check of the rest of the PAN as transmitted. If the Mod 10 correction is not specified, all of the intermediate characters of the PAN are set to the specified mask character.
All Field Separators are sent unmasked.
All other characters are set to the specified mask character.
For an AAMVA card, the specified mask character is substituted for each of the characters read from the card.
Not supported on aDynamo. This 128 byte Binary field contains the MagnePrint data. Only the number of bytes specified in the MagnePrint data length field are valid. The least significant bit of the first byte of data in this field corresponds to the first bit of MagnePrint data. If the Enable/Disable MagnePrint property is set to disable MagnePrint, this field will not be sent.
Parameters: None
Return Value:
String containing the MagnePrint data.
Not supported on aDynamo. Get the card MagnePrint status. For more information, see D9875475
Parameters: None
Return Value:
String containing the MagnePrint status.
This Binary field represents 32 bits of MagnePrint status information. Each character represents 4 bits (hexadecimal notation). For example, suppose the characters are: “A1050000”:
Usage Legend:
D = Direction
F = Too Fast
L = Too Slow
M = MagnePrint capable
This four-byte field contains the MagnePrint status. The MagnePrint status is in little endian byte order. Byte 1 is the least significant byte. Byte 1 LSB is status bit 0. Byte 4 MSB is status bit 31. MagnePrint status is defined as follows:
Bit 0 = MagnePrint-capable product (usage M)
Bits 1-15 = Product revision & mode (usage R)
Bit 16 = STATUS-only state (usage S)
If the Enable/Disable MagnePrint property is set to disable MagnePrint, this field will not be sent.
Get stored device serial number. This 16-byte ASCII field contains the device serial number. The device serial number is a NUL (zero) terminated string. So the maximum length of the device serial number, not including the null terminator, is 15 bytes. This device serial number can also be retrieved and set with the device serial number property explained in the property section of this document. This field is stored in non-volatile memory, so it will persist when the unit is power cycled.
Parameters: None
Return Value:
Return stored device serial number.
Not suported on aDynamo. This 8-byte Binary field contains the encrypted version of the current Session ID. Its primary purpose is to prevent replays. After a card is read, this property will be encrypted, along with the card data, and supplied as part of the transaction message. The clear text version of this will never be transmitted. To avoid replay, the application sets the Session ID property before a transaction and verifies that the Encrypted Session ID returned with card data decrypts to the value set.
public String getSessionID()
Parameters: None
Return Value:
Returns a string containing the session id.
Get stored key serial number. This 10-byte Binary field contains the DUKPT Key Serial Number used to encrypt the encrypted fields in this message. This 80-bit field includes the Initial Key Serial Number in the leftmost 59 bits and a value for the Encryption Counter in the rightmost 21 bits. If no keys are loaded, all bytes will have the value 0x00.
public String getKSN()
Parameters: None
Return Value:
Return stored key serial number.
MTSCRA Class Methods - 61 - 69
Request the device to display a message for swiping a card.
Parameters:
All other characters are set to the specified mask character.
All other characters are set to the specified mask character.
Value
A
1
0
5
0
0
0
0
Bit
7
6
5
4
3
2
1
0
1
5
1
4
1
3
Value
1
0
1
0
0
0
0
1
0
0
0
Usage*
R
R
R
R
R
R
R
M
R
R
R
N = Too Noisy
R =Revision
Bit 17 = Noise too high or “move me” away from the noise source (used only in STATUS) (usage N)
Bit 18 = Swipe too slow (usage L)
Bit 19 = Swipe too fast (usage F)
Bit 20 = Unassigned (always set to Zero)
Bit 21 = Actual Card Swipe Direction (0 = Forward, 1 = Reverse) (usage D)
High nibble = Max PIN length (<=12) Low nibble = Min PIN length (>=4)
Example: 0x64 is for PIN length of 4 to 6 Example: 0xC4 is for PIN length of 4 to 12 Example: 0xC8 is for PIN length of 8 to 12
Return Value:
0 = Success
9 = Error
15 = Busy
Request the card holder to enter card data manually.
Parameters:
Parameter
Description
waitTime
Wait Time in seconds, (0x01 – 0xFF; 0x00 = 256 seconds)
options
Message and mode to display on the device. Bit (7,6,5)
Reserved
Bit 4
0=Use PAN min 9, max 19
1=Use PAN min 14, max 21
Bit 3
1=Use PAN in PIN block creation
Bit 2
1=Use QwickCodes entry Bit (1,0)
beepCount
0x00 = None
0x01 = Single Beep 0x02 = Double Beep
Return Value:
0 = Success
9 = Error
15 = Busy
Request the card holder to sign on the screen.
Parameters:
Parameter
Description
waitTime
Wait Time in seconds, (0x01 – 0xFF; 0x00 = 256 seconds)
options
0x00 = Timeout clears any signature data
0x01 = Timeout returns timeout status plus length collected. Sig Data can be requested.
beepCount
0x00 = None
0x01 = Single Beep 0x02 = Double Beep
Return Value:
0 = Success
9 = Error
15 = Busy
Request the card holder signature from the device. To be used after calling requestSignature().
Return Value:
0 = Success
9 = Error
15 = Busy
Request the card holder to enter text for encryption.
Parameters:
Parameter
Description
waitTime
Wait Time in seconds, (0x01 – 0xFF; 0x00 = 256 seconds)
beepCount
0x00 = None
0x01 = Single Beep 0x02 = Double Beep
Return Value:
0 = Success
9 = Error
15 = Busy
Request the encrypted input data from the device. To be used after calling requestEncryptedInputData().
Return Value:
0 = Success
9 = Error
15 = Busy
Request to cancel a command or request while the device is waiting for the card holder.
Return Value:
0 = Success
9 = Error
15 = Busy
public int requestSwipeCard(
byte waitTime,
byte messageID,
byte beepCount)
Parameter
Description
waitTime
Wait Time in seconds, (0x01 – 0xFF; 0x00 = Infinite Wait Time)
requestCardSwipe
messageID
public int getMSRData()
public int requestPINEntry(
byte waitTime,
byte pinMode,
byte pinLength,
byte beepCount,
byte pinOption,
byte[] amount,
byte[] pan)
public int requestManualCardEntry(
byte waitTime,
byte options,
byte beepCount)
public int requestSignature(
byte waitTime,
byte options,
byte beepCount)
public int getSignature()
public int requestEncryptedInputData(
byte waitTime,
byte beepCount)
public int getEncryptedInputData()
public int cancelRequest()
getMSRData
requestPINEntry
requestManualCardEntry
requestSignature
getSignature
requestEncryptedInputData
getEncryptedInputData
cancelRequest
1
2
1
1
1
0
9
8
2
3
2
2
2
1
2
0
1
9
1
8
1
7
1
6
3
1
3
0
2
9
2
8
2
7
2
6
2
5
2
4
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
R
R
R
R
R
0
0
D
0
F
L
N
S
0
0
0
0
0
0
0
0
0 = Acct, Date, CVC
1 = Acct, Date
2 = Acct, CVC
3 = Acct
beepCount
0x00 = None
0x01 = Single Beep 0x02 = Double Beep
pinOption
Bit(7,6,5)
PIN Block Format 0b000 = ISO Format 0
0b001 = ISO Format 1 (No PAN Required) 0b011 = ISO Format 3
0b100 = ISO Format 4
Bit(4,3)
(PIN Language Select Only) Language Select:
0b00 = Disabled
0b01 = English or French Only
0b10 = All Languages as defined by DFDF2D
Bit 2
Wait Message
Bit 1
Verify PIN
Bit 0
Reserved
amount
Numeric: n12
pan
Min.: 9 bytes; Max.: 21 bytes
MTSCRA Class Methods - 51 - 60
Retrieves track decode status. This is a one-byte value, which indicates the status of decoding track 1. Bit position zero indicates if there was an error decoding track 1 if the bit is set to one. If it is zero, then no error occurred. If a track has data on it that is not noise, and it is not decodable, then a decode error is indicated. If a decode error is indicated, the corresponding track data length value for the track that has the error will be set to zero and no valid track data will be supplied.
public String getTrackDecodeStatus()
Track Decode Status. Consists of three 2-byte hex values representing the decode status for tracks 1, 2, and 3 (respectively from left to right). Values are:
00 = Track OK
01 = Track read Error
02 = Track is Blank
Retrieves SDK version.
Parameters: None
Return Value:
The version information of the SDK.
Send command to device.
Parameters:
Parameter
Description
command
Command string to send to the device.
Return Value:
0 = Success
9 = Error
15 = Busy
This function starts an EMV L2 transaction.
Parameters:
Parameter
Description
timeLimit
Specifies the maximum time, in seconds, allowed to complete the total transaction. This includes time for the user to insert the card, choose a language, choose an application, and online processing. If this time is exceeded, the transaction will be aborted and an appropriate Transaction Status will be available. Value 0 is not allowed.
cardType
Card Type to Read:
0x01 = Magnetic Stripe (as alternative to EMV L2, card swipe causes abort of EMV L2)
Note: Multiple Card Types can be selected, for example: Set this byte to 3 to read both Magnetic Stripe and Contact Smart Card.
option
0x00 = Normal 0x01 = Bypass PIN 0x02 = Force Online
0x04 = Acquirer not available (Note: prevents long timeout on waiting for host approval) (causes “decline” to be generated internally if ARQC is generated)
To use Quick Chip mode, set the most significant bit to ‘1’. 0x80 = Quick Chip, Normal
0x01 = Cash Advance (not supported for this reader)
0x02 or 0x09 = Cash back (0x09 not supported, contactless) 0x04 = Goods (Purchase)
0x08 = Services (Purchase)
0x10 = International Goods (Purchase) 0x20 = Refund
0x40 = International Cash Advance or Cash Back 0x80 = Domestic Cash Advance or Cash Back
cashBack
Cash back Amount (if non-zero, EMV Tag 9F03, format n12, 6 bytes) in hex string.
For example: “000000001000”, means 10.00 dollars.
currencyCode
Transaction Currency Code (EMV Tag 5F2A, format n4, 2 bytes) Sample Valid values:
0x0840 – US Dollar 0x0978 – Euro 0x0826 – UK Pound
Return Value:
0 = Success
9 = Error
15 = Busy
This function sets the user selection result. It should be called after receiving the OnUserSelectRequest event which is triggered after the user makes a selection.
Parameters:
Parameter
Description
status
Indicates the status of User Selection:
0x00 – User Selection Request completed, see Selection Result
0x01 – User Selection Request aborted, cancelled by user
0x02 – User Selection Request aborted, timeout
selection
Indicates the menu item selected by the user. This is a single byte zero based binary value.
Return Value:
0 = Success
9 = Error
15 = Busy
This function informs EMV device to process transaction decision from acquirer.
Parameters:
Parameter
Description
response
The first two bytes (most significant byte first) indicate the total length of the following byte array. The byte array contains the ARQC Response message. For details about the ARQC response, see the Programmer's Manual (COMMANDS) for the specific device you are communicating with.
Return Value:
0 = Success
9 = Error
15 = Busy
This function cancels a transaction while waiting for the user to insert a card.
Parameters: None Return Value:
0 = Success
9 = Error
15 = Busy
Send extended command to device.
Parameters:
Parameter
Description
command
Hexadecimal string of the byte array for the extended command.
The first two bytes represent the value of the extended command.
The next two bytes (most significant byte first) indicate the total length the following data in bytes.
Return Value:
0 = Success
9 = Error
15 = Busy
Retrieves features for the device.
Parameters: None
Return Value:
Retrieves power management value for the device.
Parameters: None
Return Value: Returns the PM value associated with the device.
Parameter
Power Management
BulleT KB BulleT SPP
cDynamo
PM1
Dynamag, Dynamag Duo, USB Enc IntelliHead V5
Parameters: None Return Value:
getTrackDecodeStatus
public String getSDKVersion()
public int sendCommandToDevice(String command)
public int startTransaction(
byte timeLimit,
byte cardType,
byte option,
byte[] amount,
byte transactionType,
byte[] cashBack,
byte[] currentCode,
byte reportingOption)
public int setUserSelectionResult(byte status, byte selection)
public int setAcquirerResponse(byte[] response)
public int cancelTransaction()
public int sendExtendedCommand(String command)
public MTDeviceFeatures getDeviceFeatures()
public class MTDeviceFeatures
{
public boolean MSR;
public boolean Contact;
public boolean Contactless;
public boolean PINPad;
public boolean MSRPowerSaver;
public boolean BatteryBackedClock;
public boolean SRED;
public boolean SignatureCapture;
public boolean ManualEntry; }
public String getPowerManagementValue()
getSDKVersion
sendCommandToDevice
startTransaction (EMV Device Only)
setUserSelectionResult (EMV Device Only)
setAcquirerResponse (EMV Device Only)
cancelTransaction (EMV Device Only)
sendExtendedCommand (EMV Device Only)
getDeviceFeatures()
getPowerManagementValue()
amount
Amount Authorized (EMV Tag 9F02, format n12, 6 bytes) in hex string
For example: “000000000999”, means 9.99 dollars.
reportingOption
This single byte field indicates the level of Transaction Status notifications the host desires to receive during the course of this transaction.
0x00 = Termination Status only (normal termination, card error, timeout, host cancel)
0x01 = Major Status changes (terminations plus card insertions and waiting on user)
0x02 = All Status changes (documents the entire transaction flow)