All pages
Powered by GitBook
1 of 1

Loading...

Appendix C - EMV Transaction Flow

This section demonstrates transaction flow.

Flow Chart - QuickChip

Sample Code - QuickChip

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.
List<PaymentMethod> paymentMethod = new List<PaymentMethod>(); paymentMethod.Add(PaymentMethod.MSR); 
paymentMethod.Add(PaymentMethod.Contact); 
paymentMethod.Add(PaymentMethod.Contactless);

transaction = new Transaction();
transaction.Amount = “1.00”;
transaction.CashBack = “0.00”; 
transaction.EMVOnly = true; 
transaction.PaymentMethods = paymentMethod;
transaction.QuickChip = true; // QuickChip mode enabled.

// Start transaction.
bool result = device.startTransaction(transaction);
public void OnEvent(EventType eventType, IData data)
{
    string message 
    switch (eventType);
        {
            case EventType.DisplayMessage:
                // Get the message.
                message = data.StringValue;
    }
}
public void OnEvent(EventType eventType, IData data)
{
    string message; 
    switch (eventType);
        {
            case EventType.InputRequest:
            // Get the message.
            message = data.StringValue;

            // display/retrieve user selection.

            // set status and selection result.
            IData selectionData = new BaseData(new Byte[] {status, selection});
            device.sendSelection(selectionData);
    }
}
public void OnEvent(EventType eventType, IData data)
{
        byte[] ARQC = null; 
        switch (eventType);
                {
                        case EventType.AuthorizationRequest:
                        // Forward ARQC to processor.
                        /* data[0..1] – ARQC length
                        data[2..n] – remainder contains the ARQC TLV object */
        }
}
 public void OnEvent(EventType eventType, IData data)
{
        string message; 
        switch (eventType);
                {
                        case EventType.DisplayMessage:
                                // Display approval message. 
                                message = data.StringValue;

                                // A data size of 0 is an instruction to clear the display. 
                                if (data.StringValue.Length == 0)
                                {
                                        // Clear the UI display.
                                }
                }
}
public void OnEvent(EventType eventType, IData data)
{
        string message; 
        switch (eventType);
                {
                        case 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].
        }
}

Flow Chart – Signature Capture

Sample Code – Signature Capture

The following breaks out the EMV flow chart into code. Events are shown separately and in the order received.

// Assign parameters.
List<PaymentMethod> paymentMethod = new List<PaymentMethod>(); paymentMethod.Add(PaymentMethod.MSR); paymentMethod.Add(PaymentMethod.Contact); paymentMethod.Add(PaymentMethod.Contactless);

transaction = new Transaction();
transaction.Amount = “1.00”;
transaction.CashBack = “0.00”; transaction.EMVOnly = true; transaction.PaymentMethods = paymentMethod; transaction.QuickChip = true;

// Start transaction.
bool result = device.startTransaction(transaction);
public void OnEvent(EventType eventType, IData data)
{
        string message; 
        switch (eventType);
                {
                        case EventType.DisplayMessage:

                                // Get the message.
                                message = data.StringValue;
        }
}
 public void OnEvent(EventType eventType, IData data)
{
string message; 
switch (eventType);
        {
        case EventType.InputRequest:
        // Get the message.
        message = data.StringValue;

        // display/retrieve user selection.

        // set status and selection result.
        IData selectionData = new BaseData(new Byte[] {status, selection});
        device.sendSelection(selectionData);
    }
}
public void OnEvent(EventType eventType, IData data)
{
        byte[] ARQC = null; 
        switch (eventType);
                {
                        case EventType.AuthorizationRequest:
                                // #4a
                                // Forward ARQC to processor.
                                /* data[0..1] – ARQC length
                                data[2..n] – remainder contains the ARQC TLV object */
                }
}
public void OnEvent(EventType eventType, IData data)
{
        string message; 
        switch (eventType);
                {
                        case EventType.DisplayMessage:
                                // Display approval message. 
                                message = data.StringValue;

                                // A data size of 0 is an instruction to clear the display. 
                                if (data.StringValue.Length == 0)
                                {
                                        // Clear the UI display.
                                }
                        }
}
public void OnEvent(EventType eventType, IData data)
{
        string message; 
        switch (eventType);
                {
                        case 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].
                }
}
public void OnEvent(EventType eventType, IData data)
{
        String signature; 
        switch (eventType);
                {
                        case EventType.Signature: 
                        signature = data.StringValue;
                }
}

Sample Code – With ARPC

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.

C.1 Sample Code – With ARPC

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.
List<PaymentMethod> paymentMethod = new List<PaymentMethod>(); paymentMethod.Add(PaymentMethod.MSR); 
paymentMethod.Add(PaymentMethod.Contact); 
paymentMethod.Add(PaymentMethod.Contactless);

transaction = new Transaction();
transaction.Amount = “1.00”;
transaction.CashBack = “0.00”; 
transaction.EMVOnly = true; 
transaction.PaymentMethods = paymentMethod;
transaction.QuickChip = false; //QuickChip mode disabled.

// Start transaction.
bool result = device.startTransaction(transaction);
public void OnEvent(EventType eventType, IData data)
{
        string message; 
        switch (eventType);
                {
                        case EventType.DisplayMessage:

                                // Get the message.
                                message = data.StringValue;
        }
}
 public void OnEvent(EventType eventType, IData data)
{
        string message; 
        switch (eventType);
                {
                        case EventType.InputRequest:

                                // Get the message.
                                message = data.StringValue;

                                // display/retrieve user selection.
        
                                // set status and selection result.
                                IData selectionData = new BaseData(new Byte[] {status, selection});
                                device.sendSelection(selectionData);
                }
}
public void OnEvent(EventType eventType, IData data)
{
        byte[] ARQC = null; 
        switch (eventType);
                {
                        case EventType.AuthorizationRequest:
                                // Forward the ARQC to the processor.
                                /* data[0..1] – ARQC length
                                data[2..n] – remainder contains the ARQC TLV object */

                                ARQC.ByteArray = data.ByteArray;
                                // App function to send the request to the processor. 
                                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.

ARPC TLV object for sendAuthorization().

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 magstripe.

  • --> Host starts a transaction with PaymentMethod set to MSR.

Begin initial transaction:

Continue with Fallback transaction:

This section demonstrates transaction flow.

<— Device may respond with transaction cancelled card read error.
  • --> Host displays a message each time the transaction fails until successful or until Host decides to end the transaction.

  • <— Device sends the transaction result.

  • String ARPC = “8A3030”;
    IData ARPCTLV = new BaseData("");
    ARPCTLV.StringValue = "FF7413DFDF250742363243413546FA067004” + ARPC;
    
    device.sendAuthorization(ARPCTLV);

    Tag

    Len

    Value / Description

    Typ

    Req

    Default

    FF74

    var

    Container for non-MAC ARPC

    T

    R

    /DFDF25

    var

    Device Serial Number (IFD Serial Number)

    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

    public void OnEvent(EventType eventType, IData data)
    {
            string message; 
            switch (eventType);
                    {
                            case EventType.DisplayMessage:
                                    // Display approval message. 
                                    message = data.StringValue;
    
                                    // A data size of 0 is an instruction to clear the display. 
                                    if (data.StringValue.Length == 0)
                                    {
                                            // Clear the UI display.
                                    }
                    }
    }
    public void OnEvent(EventType eventType, IData data)
    {
            string message; 
            switch (eventType);
                    {
                            case 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].
                    }
    }
    public void OnEvent(EventType eventType, IData data)
    {
            String signature; 
            switch (eventType);
                    {
                            case EventType.Signature: 
                                    signature = data.StringValue;
                    }
    }

    MSR Fallback Flow

    B

    R

    /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