Reputation: 709
I am trying to perform Apple pay transaction. The card edded to apple pay wallet is MasterCard. If I perform a contactless transaction using a physical card, my code works. But when I try to do the same with ApplePay, I get SW 6700 (wrong length) status after the GENERATE AC command. Here you can see how I construct data for GAC request:
9f02 06 000000000100 Amount, Authorised (Numeric)
9f03 06 000000000000 Amount, Other (Numeric)
9f1a 02 0804 Terminal Country Code
95 05 0000000000 Terminal Verification Results
5f2a 02 0980 Transaction Currency Code
9a 03 210511 Transaction Date
9c 01 00 Transaction Type
9f37 04 3357A30A Unpredictable Number
9f35 01 21 Terminal Type
9f45 02 0000 Data Authentication Code
9f4c 08 0000000000000000 ICC Dynamic Number
9f34 03 1F0302 Cardholder Verification Method (CVM) Results
9f21 03 131340 Transaction Time HHMMSS
9f7c 14(20 dec) 0000000000000000000000000000000000000000 Customer Exclusive Data (CED)
So, my final data is:
80 AE 8000 42 000000000030 000000000000 0804 0000008001 0980 210511 00 3357A30A 21 0000 0000000000000000 1F0302 133040 0000000000000000000000000000000000000000 00
Le byte is 42 (66 dec) and it is correct if physical card is used. What is wrong with Apple Pay?
Upvotes: 1
Views: 1035
Reputation: 709
The problem is that CDOL1 differs when using ApplePay with the same card. Thus tag 0x8C (CDOL1) using ApplePay is:
9f02069f03069f1a0295055f2a029a039c019f37049f35019f45029f4c089f34039f1d089f15029f4e14
And using physical contactless card (MasterCard):
9f02069f03069f1a0295055f2a029a039c019f37049f35019f45029f4c089f34039f21039f7c14
So, they are not equal, and deconstruction gives us such a data items:
9f02 06 000000000100
9f03 06 000000000000
9f1a 02 0804
95 05 0000000000
5f2a 02 0980
9a 03 210511
9c 01 00
9f37 04 3357A30A
9f35 01 21
9f45 02 0000
9f4c 08 0000000000000000
9f34 03 1F0302
9f1d 08 6CF8000000000000
9f15 02 0000
9f4e 14 0000000000000000000000000000000000000000
So, the final data for GENERATE AC command should be:
80 AE 8000 49 000000000030 000000000000 0804 0000008001 0980 210511 00 3357A30A 21 0000 0000000000000000 1F0302 6CF8000000000000 0000 0000000000000000000000000000000000000000 00
Le = 73 dec / 0x49 hex. This works fine.
Upvotes: 1