Search code examples
javanfcemv

EMV Contactless - GPO with PDOL


I need to write a method that can generate a GET PROCESSING OPTION regardless the PDOL with EMV Contactless. How can I format the GPO command with the correct data?

This is data:

6F 4E 84 07 A0 00 00 00 03 20 10 A5 43 50 0D 56 49 53 41 20 45 4C 45 43 54 52 4F 4E 87 01 01 9F 38 18 9F 66 04 9F 02 06 9F 03 06 9F 1A 02 95 05 5F 2A 02 9A 03 9C 01 9F 37 04 5F 2D 08 69 74 65 6E 64 65 66 72 BF 0C 08 9F 5A 05 31 09 78 03 80

PDOL is: 9F 66 04 9F 02 06 9F 03 06 9F 1A 02 95 05 5F 2A 02 9A 03 9C 01 9F 37 04

What is the correct GPO command APDU? Thanks.


Solution

  • GPO command is constructed as follows:

    CLA '80'
    INS 'A8'
    P1 '00'
    P2 '00'
    Lc var.
    Data PDOL Related Data
    Le '00'
    

    Based on your PDOL, you need to provide the following data:

    9F66 (?) 4 bytes
    9F02 (amount authorized) 6 bytes
    9F03 (amount other) 6 bytes
    9F1A (terminal country code) 2 bytes
    95 (TVR - Terminal Verification Results) 5 bytes
    5F2A (terminal currency code) 2 bytes
    9A (transaction date) 3 bytes
    9C (transaction type) 1 bytes
    9F37 (unpredictable number) 4 bytes
    

    (You will need to parse the PDOL but you can also use the online TVR decoder to parse it.)

    Basically you need to populate the DOL with values for the requested tags (in the order they appear). For example, if you populate only the amount, the DOL will look like this:

    000000001122334455660000000000000000000000000000000000000000000000

    And your GPO command will be:

    80A8000023832100000000112233445566000000000000000000000000000000000000000000000000
                ^^
    

    Where the hex value 21 (that is 33) is the length of the DOL.

    Hope this helps. You can refer to the EMV specifications for more details. https://www.emvco.com/emv-technologies/contactless/