# MTSCRA Callback Messages 11 - 19

#### OnDeviceExtendedResponse (EMV Device Only)

This message occurs when an extended response is received from the device.

<table data-header-hidden><thead><tr><th width="128.54547119140625" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top"><p> </p><p> </p><p>obj</p></td><td valign="top"><p>Byte array containing the extended response data received from the device. The first two bytes represent the result codes for the extended command.</p><p>The next two bytes (most significant byte first) indicate the total length of the following data in bytes.</p></td></tr></tbody></table>

#### OnDeviceState (EMV Device Only) <a href="#id-5.12_ondevicestate_-emv_device_only" id="id-5.12_ondevicestate_-emv_device_only"></a>

This message occurs when the device changes state.

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">obj</td><td valign="top">Byte array containing the data received from the device.</td></tr></tbody></table>

<table data-header-hidden><thead><tr><th width="80.81817626953125" valign="top"></th><th width="120.27276611328125" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Offset</td><td valign="top">Field Name</td><td valign="top">Value</td></tr><tr><td valign="top"><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p>0</p></td><td valign="top"><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p>Device State</p></td><td valign="top"><p>0x00 = Idle 0x01 = Session</p><p>0x02 = Wait For Card 0x03 = Wait For PIN </p><p>0x04 = Wait For Selection</p><p>0x05 = Displaying Message</p><p>0x06 = Test (Reserved for future use) </p><p>0x07 = Manual Card Entry</p><p>0x08 = Wait for Signature Capture (SC-S Only | SC-F Only) </p><p>0x09 = Wait Cardholder Entry</p><p>0x0A = Chip Card </p><p>0x0B = ICC Kernel Test</p><p>0x0C = EMV Transaction </p><p>0x0D = Show PAN</p></td></tr></tbody></table>

<table data-header-hidden><thead><tr><th valign="top"></th><th width="86.18182373046875" valign="top"></th><th width="59.81817626953125" valign="top"></th><th width="60.9090576171875" valign="top"></th><th width="65.272705078125" valign="top"></th><th width="73.45458984375" valign="top"></th><th width="78.9091796875" valign="top"></th><th width="58.9091796875" valign="top"></th><th width="59.8182373046875" valign="top"></th><th width="54.3636474609375" valign="top"></th></tr></thead><tbody><tr><td valign="top">Offset</td><td valign="top">Field Name</td><td valign="top">Bit 7</td><td valign="top">6</td><td valign="top">5</td><td valign="top">4</td><td valign="top">3</td><td valign="top">2</td><td valign="top">1</td><td valign="top">0</td></tr><tr><td valign="top">1</td><td valign="top">Session State</td><td valign="top">Pwr Chg</td><td valign="top">RFU</td><td valign="top">RFU</td><td valign="top">RFU</td><td valign="top">Card Data</td><td valign="top">MSRP AN</td><td valign="top">EXPAN</td><td valign="top">Amt</td></tr></tbody></table>

The bits of Session State mean the following:

* Pwr Chg:
  * 1 = Power Change Occurred (occurs on Power up or after a USB resume)
* Card Data:
  * 1 = Card Data Available
* MSR PAN:
  * 1 = PAN Parsed from Card
* EXPAN:
  * 1 = External PAN Sent
* Amt:
  * 1 = Amount sent<br>

<table data-header-hidden><thead><tr><th width="80.81817626953125" valign="top"></th><th width="120.27276611328125" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Offset</td><td valign="top">Field Name</td><td valign="top">Value</td></tr><tr><td valign="top"><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p>2</p></td><td valign="top"><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p>Device Status</p></td><td valign="top"><p>0x00 = OK. Otherwise, the possible values are listed below:</p><p> </p><p>Bit 7 = Device Error Status: </p><p>1 = Device Error</p><p> </p><p>Bit 6 = Authentication Status:</p><p>0 = Not Authenticated</p><p>1 = Authenticated</p><p> </p><p>Bit 5 = 0</p><p> </p><p>Bit 4 = Tamper:</p><p>0 = Normal</p><p>1 = Tamper Detected</p><p></p><p>Bits [3,2] = MSR Key Status:</p><p>00 = MSR Key OK</p><p>01 = MSR Key Exhausted</p><p>10 = No MSR Key</p><p>11 = MSR Key Not Bound</p><p> </p><p>Bits [1,0] = PIN Key Status: </p><p>00 = PIN Key OK</p><p>01 = PIN Key Exhausted</p><p>10 = No PIN Key</p><p>11 = PIN Key Not Bound</p></td></tr></tbody></table>

<table data-header-hidden><thead><tr><th valign="top"></th><th width="104.3636474609375" valign="top"></th><th width="59.81817626953125" valign="top"></th><th width="60.9090576171875" valign="top"></th><th width="79.818115234375" valign="top"></th><th width="87.0909423828125" valign="top"></th><th width="78.9091796875" valign="top"></th><th width="78" valign="top"></th><th width="82.5455322265625" valign="top"></th><th width="78.9090576171875" valign="top"></th></tr></thead><tbody><tr><td valign="top">Offset</td><td valign="top">Field Name</td><td valign="top">Bit 7</td><td valign="top">6</td><td valign="top">5</td><td valign="top">4</td><td valign="top">3</td><td valign="top">2</td><td valign="top">1</td><td valign="top">0</td></tr><tr><td valign="top">3</td><td valign="top">Device Certificate Status</td><td valign="top">MSR CRL</td><td valign="top"></td><td valign="top">PIN CRL</td><td valign="top"><p>TLS (RSA)C</p><p>ert</p></td><td valign="top">Manufa cturer Unbind</td><td valign="top"><p>MSR</p><p>Key Loader CA</p></td><td valign="top">Device CA</td><td valign="top">Device CA</td></tr></tbody></table>

* 0 = Certificate does not exist in the device
* 1 = Certificate exists in the device

#### OnCardStatus (EMV Device Only) <a href="#id-5.13_oncardstatus_-emv_device_only" id="id-5.13_oncardstatus_-emv_device_only"></a>

This message occurs when the card status has changed.

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">obj</td><td valign="top">Byte array containing the data received from the device.</td></tr></tbody></table>

<table data-header-hidden><thead><tr><th width="93.54541015625" valign="top"></th><th width="175.1817626953125" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Offset</td><td valign="top">Field Name</td><td valign="top">Value</td></tr><tr><td valign="top">0</td><td valign="top">Operation Status</td><td valign="top"> </td></tr><tr><td valign="top">1</td><td valign="top">Card Status</td><td valign="top"> </td></tr><tr><td valign="top">2</td><td valign="top">Card Type</td><td valign="top"></td></tr></tbody></table>

#### 1.4           OnCardData (EMV Device Only) <a href="#id-5.14_oncarddata_-emv_device_only" id="id-5.14_oncarddata_-emv_device_only"></a>

This message occurs when the device sends card data.

<table data-header-hidden><thead><tr><th width="137.6363525390625" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">obj</td><td valign="top">Byte array containing the data received from the device.</td></tr></tbody></table>

```
F8<len> /*container tag for encryption */ 
    DFDF59(Encrypted Data Primitive)<len><Encrypted Data val (Decrypt data to read tags)> 
    DFDF56(Encrypted Transaction Data KSN)<len><val> 
    DFDF57(Encrypted Transaction Data Encryption Type)<val> 
    DFDF58(# of bytes of padding in DFDF59)<len><val> 
    FC<len> /*container tag for encrypted generic data */ 
        F4<len>/* container tag for encrypted MSR data */ 
        DFDF36 <EncT1status><len><val> 
        DFDF37 <EncT1data><len><val> 
        DFDF38 <EncT2status><len><val> 
        DFDF39 <EncT2data><len><val> 
        DFDF3A <EncT3status><len><val> 
        DFDF3B <EncT3data><len><val> 
        DFDF3C <Encrypted Magneprint Data><len><val> 
        DFDF43 <Magneprint Status Data><len><val> 
        DFDF50(MSR KSN Data)<len><val> /*sent in the clear*/ 
        DFDF51(MSR EncryptionType)<len><val>
```

#### OnPINResponse (EMV Device Only) <a href="#id-5.15_onpinresponse_-emv_device_only" id="id-5.15_onpinresponse_-emv_device_only"></a>

This message occurs when the device sends the response to a PIN request.

<table data-header-hidden><thead><tr><th width="163.0909423828125" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">obj</td><td valign="top">Byte array containing the data received from the device.</td></tr></tbody></table>

<table data-header-hidden><thead><tr><th width="85.36358642578125" valign="top"></th><th width="167.36358642578125" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Offset</td><td valign="top">Field Name</td><td valign="top">Value</td></tr><tr><td valign="top">0</td><td valign="top">Operation Status</td><td valign="top"> </td></tr><tr><td valign="top"><p> </p><p>1</p></td><td valign="top"><p> </p><p>PIN BLOCK</p><p>Format</p></td><td valign="top"><p>0000 0000 = ISO Format 0 (PAN Required)</p><p>0000 0001 = ISO Format 1 (No PAN Required)</p><p>0000 0011 = ISO Format 3 (PAN Required)</p><p>0000 0100 = ISO Format 4 (Not Supported)</p></td></tr><tr><td valign="top"><p> </p><p> </p><p> </p><p>2</p></td><td valign="top"><p> </p><p> </p><p>PIN BLOCK</p><p>Encryption Type</p></td><td valign="top"><p>0xxx xxxx = Fixed key </p><p>1xxx xxxx = DUKPT key </p><p>xx00 xxxx = TDES</p><p>xx01 xxxx = AES128 </p><p>xx10 xxxx = AES256 </p><p>xxxx xx00 = Data variant </p><p>xxxx xx01 = PIN variant </p><p>xxxx xx10 = MAC variant</p></td></tr><tr><td valign="top">3 - 14</td><td valign="top">PIN KSN.</td><td valign="top"><p>PIN KSN.</p><p>If fixed PIN Key is used, KSN is all zeroes.</p></td></tr><tr><td valign="top"><p> </p><p> </p><p> </p><p>14 - 21</p></td><td valign="top"><p> </p><p> </p><p> </p><p>EPB</p></td><td valign="top"><p>Encrypted PIN Block (EPB). If PIN entry was successful, this contains the PIN data, encrypted using the PIN variant of the current PIN DUKPT working key. Format after decryption depends on the PIN Option the host specified, and on the device’s Session State:</p><ul><li>If the Session State indicates there is no PAN available (from card swipe or sent via command), the device creates the EPB using ISO Format 1.</li><li>If there is a PAN, the device creates the EPB using the PIN Option the host specified in the command.</li></ul></td></tr></tbody></table>

#### OnSignatureState (EMV Device Only) <a href="#id-5.16_onsignaturestate_-emv_device_only" id="id-5.16_onsignaturestate_-emv_device_only"></a>

This message occurs when the signature state has change.

<table data-header-hidden><thead><tr><th width="135.81817626953125" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">obj</td><td valign="top">Byte array containing the data received from the device.</td></tr></tbody></table>

<table data-header-hidden><thead><tr><th width="84.45452880859375" valign="top"></th><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Offset</td><td valign="top">Field Name</td><td valign="top">Value</td></tr><tr><td valign="top">0</td><td valign="top">Operation Status</td><td valign="top"> </td></tr><tr><td valign="top">1</td><td valign="top">Reserved</td><td valign="top"> </td></tr><tr><td valign="top">2</td><td valign="top">Signature length (low byte)</td><td valign="top"> </td></tr><tr><td valign="top">3</td><td valign="top">Signature length (high byte)</td><td valign="top"> </td></tr></tbody></table>

#### OnSignature (EMV Device Only) <a href="#id-5.17_onsignature_-emv_device_only" id="id-5.17_onsignature_-emv_device_only"></a>

This message occurs when the device sends the response to a signature request.

<table data-header-hidden><thead><tr><th width="138.54547119140625" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">obj</td><td valign="top">Byte array containing the data received from the device.</td></tr></tbody></table>

<table data-header-hidden><thead><tr><th width="87.18182373046875" valign="top"></th><th width="124.54547119140625" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Offset</td><td valign="top">Field Name</td><td valign="top">Value</td></tr><tr><td valign="top">0</td><td valign="top">Message</td><td valign="top">This Signature is an array of bytes.</td></tr></tbody></table>

#### OnEncryptedDataState (EMV Device Only) <a href="#id-5.18_onencrypteddatastate_-emv_device_on" id="id-5.18_onencrypteddatastate_-emv_device_on"></a>

This message occurs when the encrypted data state has changed.

<table data-header-hidden><thead><tr><th width="136.727294921875" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">obj</td><td valign="top">Byte array containing the data received from the device.</td></tr></tbody></table>

<table data-header-hidden><thead><tr><th width="99" valign="top"></th><th width="249.45452880859375" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Offset</td><td valign="top">Field Name</td><td valign="top">Value</td></tr><tr><td valign="top">0</td><td valign="top">Operation Status</td><td valign="top"> </td></tr><tr><td valign="top">1</td><td valign="top">Reserved</td><td valign="top"> </td></tr><tr><td valign="top">2</td><td valign="top">Input Data length (low byte)</td><td valign="top"> </td></tr><tr><td valign="top">3</td><td valign="top">Input Data length (high byte)</td><td valign="top"> </td></tr></tbody></table>

#### OnEncryptedData (EMV Device Only) <a href="#id-5.19_onencrypteddata_-emv_device_only" id="id-5.19_onencrypteddata_-emv_device_only"></a>

This message occurs when the device returns encrypted data.

<table data-header-hidden><thead><tr><th width="121.272705078125" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">obj</td><td valign="top">Byte array containing the data received from the device.</td></tr></tbody></table>

<table data-header-hidden><thead><tr><th width="100.81817626953125" valign="top"></th><th width="199.3636474609375" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Offset</td><td valign="top">Field Name</td><td valign="top">Value</td></tr><tr><td valign="top">0</td><td valign="top">Operation Status</td><td valign="top"> </td></tr><tr><td valign="top">1 - 10</td><td valign="top">KSN.</td><td valign="top"><p>KSN.</p><p>If fixed Key is used, KSN is all zeroes.</p></td></tr><tr><td valign="top">11 - n</td><td valign="top">Encrypted Input Data</td><td valign="top">The encrypted data encrypted using the DATA variant of the current DATA DUKPT working key.</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.magtek.com/hardware/card-readers/magnetic-stripe-readers/idynamo-5-gen-iii/documentation/developers-manuals/programmers-manual-android/mtscra-callback-messages/mtscra-callback-messages-11-19.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
