This section demonstrates transaction flow.
The following breaks out the EMV flow chart into code. When enabling QuickChip mode, host does not send the ARPC to the device to complete the transaction. Events are shown separately and in the order received.
// Assign parameters.
var transaction: ITransaction = ITransaction(
Amount:“1.00”,
CashBack:“0.00”,
TransactionType:0,
Timeout:30,
For:MTU_PaymentMethod_MSR | MTU_PaymentMethod_Contact |
MTU_PaymentMethod_Contactless,
QuickChip:true)
// Start transaction.
var result: BOOL = device.startTransaction(transaction)func onEvent(_ eventType: MTU_EventType, data: IData!)
{
var message: NSString = “”
switch eventType
{
case MTU_EventType_DisplayMessage:
// Get the message.
message = data.StringValue
}
} func onEvent(_ eventType: MTU_EventType, data: IData!)
{
var message: NSString = “”
switch eventType
{
case MTU_EventType_InputRequest:
// Get the message.
message = data.StringValue
// display/retrieve user selection.
// set status and selection result.
var statusSelection: NSString* = "0001"
var selectionData: IData = IData.dataWithHex(statusSelection);
device.sendSelection(selectionData)
}
}func onEvent(_ eventType: MTU_EventType, data: IData!)
{
var ARQC[]: Byte = nil; switch eventType
{
case MTU_EventType_AuthorizationRequest:
// Forward ARQC to processor.
/* data[0..1] – ARQC length
data[2..n] – remainder contains the ARQC TLV object */
}
}func onEvent(_ eventType: MTU_EventType, data: IData!)
{
var message: NSString = “”
switch eventType
{
case MTU_EventType_DisplayMessage:
// Display approval message.
message = data.StringValue
// A data size of 0 is an instruction to clear the display.
if (data.StringValue.count == 0)
{
// Clear the UI display.
}
}
}func onEvent(_ eventType: MTU_EventType, data: IData!)
{
switch eventType
(
case MTU_EventType_TransactionResult:
/* data[0] – Signature Required
data[1..2] – Batch Data length
data[3..n] – remainder contains the Batch Data TLV object
*/
// Parse the TLV from data[].
// Abstract Approval status from TLV tag “DFDF1A”.
// Abstract Signature Required status from TLV tag data[0].
}
}
The following breaks out the EMV flow chart into code. Events are shown separately and in the order received.
// Assign parameters.
var transaction: ITransaction = ITransaction(
Amount: "1.00",
CashBack: "0.00",
TransactionType:0,
Timeout:30,
For:MTU_PaymentMethod_MSR | MTU_PaymentMethod_Contact |
MTU_PaymentMethod_Contactless,
QuickChip:true
)
// Start transaction.
var result: BOOL = device.startTransaction(transaction)func onEvent(_ eventType: MTU_EventType, data: IData!)
{
var message: NSString = ""
switch eventType
{
case MTU_EventType_DisplayMessage:
// Get the message.
message = data.StringValue
}
}func onEvent(_ eventType: MTU_EventType, data: IData!)
{
var message: NSString = ""
switch eventType
{
case MTU_EventType_InputRequest:
// Get the message.
message = data.StringValue
// display/retrieve user selection.
// set status and selection result.
var statusSelection: NSString* = "0001"
IData* selectionData = IData dataWithHex(statusSelection);
device.sendSelection(selectionData);
}
} func onEvent(_ eventType: MTU_EventType, data: IData!)
{
var ARQC[]: Byte = nil; switch eventType
{
case MTU_EventType_AuthorizationRequest:
// Forward ARQC to processor.
/* data[0..1] – ARQC length
data[2..n] – remainder contains the ARQC TLV object */
}
}func onEvent(_ eventType: MTU_EventType, data: IData!)
{
var message: NSString = ""
switch eventType
{
case MTU_EventType_DisplayMessage:
// Display approval message.
message = data.StringValue;
// A data size of 0 is an instruction to clear the display.
if (data.StringValue.count == 0)
{
// Clear the UI display.
}
}
}func onEvent(_ eventType: MTU_EventType, data: IData!)
{
switch eventType
{
case MTU_EventType_TransactionResult:
/* data[0] – Signature Required
data[1..2] – Batch Data length
data[3..n] – remainder contains the Batch Data TLV object
*/
// Parse the TLV from data[].
// Abstract Approval status from TLV tag “DFDF1A”.
// Abstract Signature Required status from TLV tag data[0].
}
}func onEvent(_ eventType: MTU_EventType, data: IData!)
{
var signature: NSString = “”;
switch eventType
{
case MTU_EventType_Signature:
signature = data.StringValue;
}
}The following breaks out the EMV flow chart into code. When disabling QuickChip mode, host must send the ARPC to the device to complete the transaction. Events are shown separately and in the order received.
// Assign parameters.
var transaction: ITransaction = ITransaction(
Amount:“1.00”,
CashBack:“0.00”,
TransactionType:0,
Timeout:30,
For:MTU_PaymentMethod_MSR | MTU_PaymentMethod_Contact |
MTU_PaymentMethod_Contactless,
QuickChip:false
);
// Start transaction.
var result: BOOL = device.startTransaction(transaction)func onEvent(_ eventType: MTU_EventType, data: IData!)
{
var message: NSString = ""
switch eventType
{
case MTU_EventType_DisplayMessage:
// Get the message.
message = data.StringValue
}
}func onEvent(_ eventType: MTU_EventType, data: IData!)
{
var message: NSString = "";
switch eventType
{
case MTU_EventType_InputRequest:
// Get the message.
message = data.StringValue
// display/retrieve user selection.
// set status and selection result.
var statusSelection: NSString = "0001"
var selectionData: IData* = IData
dataWithHex(statusSelection);
device.sendSelection(selectionData)
}
}func onEvent(_ eventType: MTU_EventType, data: IData!)
{
var ARQC: IData = data;
switch eventType
{
case MTU_EventType_AuthorizationRequest:
// Forward ARQC to processor.
/* data[0..1] – ARQC length
data[2..n] – remainder contains the ARQC TLV object */
ARPC = sendARQCToProcessorForApproval(ARQC.ByteArray)
}
}After the ARPC is returned from the processor, it is constructed into a TLV container and then sent to the device. The ARPC for approved (00) is set in ASCII 3030.
The optional tags 91, 71, and 72 (Issuer Authentication Data, Issuer Script Template 1, and Issuer Script Template 2) are not included in this example.
See the construction of the ARPCTLV in the table below.
var ARPC: NSString = “8A3030”;
var ARPCTLV: IData = IData();
ARPCTLV.StringValue = "FF7413DFDF250742363243413546FA067004” + ARPC
device.sendAuthorization(ARPCTLV)The use case for an MSR fallback is when communication with the chip results in a terminated transaction and the TransactionStatus is reported as MSRFallback.
The host application will re-attempt the transaction. To invoke this use case, here are the following pre-requisites.
Pre-requisites:
Device already configured for Device-Driven Fallback = Disabled.
A card to cause the fallback. Example but not limited to a card with no applications programmed or a card with an application not configured on the device.
Scheme:
-->Host begins an initial transaction with PaymentMethod set to MSR+Chip+Contactless.
<--Device responds with fail and with status of MSRFallback.
-->Host displays a message to use magnetic stripe.
-->Host starts a transaction with PaymentMethod set to MSR.
-->Host displays a message each time the transaction fails until successful or until Host decides to end the transaction.
<--Device sends the transaction result.
Tag
Len
Value / Description
Typ
Req
Default
FF74
var
Container for non-MAC ARPC
T
R
/DFDF25
var
Device Serial Number (IFD Serial Number)
B
R
Tag
Len
Value / Description
Typ
Req
Default
///71
var
Issuer Script Template 1
As defined in EMV Integrated Circuit Card Specifications for Payment Systems 4.3. The host may include as many instances of this parameter as needed, up to a maximum length of 128 bytes including Tags and Lengths.
B
O
///72
var
Issuer Script Template 2
As defined in EMV Integrated Circuit Card Specifications for Payment Systems 4.3. The host may include as many instances of this parameter as needed, up to a maximum length of 128 bytes including Tags and Lengths.
B
func onEvent(_ eventType: MTU_EventType, data: IData!)
{
var message: NSString = ""
switch eventType
{
case MTU_EventType_DisplayMessage:
// Display approval message.
message = data.StringValue
// A data size of 0 is an instruction to clear the display.
if (data.StringValue.count == 0)
{
// Clear the UI display.
}
}
}func onEvent(_ eventType: MTU_EventType, data: IData!)
{
switch eventType
{
case MTU_EventType_TransactionResult:
/* data[0] – Signature Required
data[1..2] – Batch Data length
data[3..n] – remainder contains the Batch Data TLV object
*/
// Parse the TLV from data[].
// Abstract Approval status from TLV tag “DFDF1A”.
// Abstract Signature Required status from TLV tag data[0].
}
}func onEvent(_ eventType: MTU_EventType, data: IData!)
{
var signature: NSString* = ""
switch eventType
{
case MTU_EventType_Signature:
signature = data.StringValue
}
}


/FA
var
Container for generic data
T
R
//70
var
Container for ARPC
T
R
///8A
02
Authorization Response Code
· 0x3030 = Approved
· 0x3031 = Issuer Referral
· 0x3035 = Declined
· 0x3132 = Switch Interface
· 0x3133 = Request Online PIN
AN
R
///91
var
Issuer Authentication Data
As defined in EMV Integrated Circuit Card Specifications for Payment Systems 4.3
B
O
O