Android HCE payment faills

Hi,
We have an emulated card on android, set up as a MasterCard and it is accepted by the POS payment terminal using NFC, it works as expected. However, the Poynt terminal has a problem with it. I post the catlog below. Could you tell me what the error codes mean and if there’s a specific requirement for a card to be accepted?

I/CO.POYNT.SERVICES( 801): NOTIFICATION: PoyntNotification{protocol=POYNT1, type=UI_EVENT, notificationFlags=00000000, dataLength=8, data=0000000500000000, EventCode=INSERT_SWIPE_OR_TRY_ANOTHER_CARD, logData=null, crc=5205, expectedCrc=5205}
D/PaymentOptionsFragment( 801): Received broadcasted intent: poynt.intent.action.INSERT_SWIPE_OR_TRY_ANOTHER_CARD
D/com.amplitude.api.AmplitudeClient( 801): Logged event to Amplitude: frag_message_ACTION_INSERT_SWIPE_OR_TRY_ANOTHER_CARD
D/UsbRequestJNI( 801): init
D/UsbRequestJNI( 801): init
I/CO.POYNT.SERVICES( 801): NOTIFICATION: PoyntNotification{protocol=POYNT1, type=CERTIFICATION_LOG_EVENT, notificationFlags=00000000, dataLength=42, data=00000000000000002D2D2D2D3E204B65726E656C204552524F5220434F4445203D203030303230323139, EventCode=GENERAL_MESSAGE, logData=----> Kernel ERROR CODE = 00020219, crc=CF98, expectedCrc=CF98}
D/UsbRequestJNI( 801): init
D/UsbRequestJNI( 801): init
I/CO.POYNT.SERVICES( 801): CARDREADER_LOG: [E] REP_STATUS_FAIL - CMD_PERFORM_TRANSACTION Failed: code 0xff
D/UsbRequestJNI( 801): init
D/UsbRequestJNI( 801): init
I/CO.POYNT.SERVICES( 801): CARDREADER_LOG:
D/UsbRequestJNI( 801): init
D/UsbRequestJNI( 801): init
D/UsbRequestJNI( 801): init
D/UsbRequestJNI( 801): init
I/POYNT-EVENT( 801): {“time” : “2016-02-10T09:03:08Z”, “type” : “CARD_READER”, “resource” : “”, “status” : “INFO”, “businessId” : “f9247f46-7407-4ea1-9495-757fb589733a”, “businessType” : “TEST_MERCHANT”, “processingTime” : 0.0, “method” : “PERFORM_TRANSACTION”, “apiStatusCode” : 0, “apiEndpoint” : “”, “sdkErrorCode” : 0, “data” : "status(FAILED) data_len(0) "}

Thanks Chris - reached out to our firmware team to understand what this specific kernel code is. Can you provide any details on how we can reproduce this issue ? You said emulated card on android - is this google wallet (not android pay) app ?

Hi Praveen,
thanks for the response. No, it’s not emulated like that. We follow the Android HCE documentation to create and emulate our own cards. We create our card to conform with the MasterCard PayPass specifications and it has all the fields that are documented as required and then some that are required by the national card operator for their terminal to accept the card. Maybe you have some documentation what exactly is required from a card to complete a payment on the Poynt terminal?
We tried some configurations for the card like using USD instead of BGN but it was still not right.

One other thing, there’s a test card that used to work on the Poynt terminal. For some time there’s a problem with it - it is read but then is declined with terminal exception (I paste if below). The terminal itself is connected to the internet, updating itself, so the connection problem seems to be in the back-end. The same problem happens if I use a real end-user MasterCard PayPass.

I/POYNT-EVENT( 3953): {“time” : “2016-02-11T08:27:38Z”, “type” : “CARD_READER”, “resource” : “”, “status” : “INFO”, “businessId” : “f9247f46-7407-4ea1-9495-757fb589733a”, “businessType” : “TEST_MERCHANT”, “processingTime” : 0.0, “method” : “PERFORM_TRANSACTION”, “apiStatusCode” : 0, “apiEndpoint” : “”, “sdkErrorCode” : 0, “data” : “Status (ONLINE_AUTHZ_REQ) - Card Scheme (PAYPASS_MAGSTRIPE)”}
D/CLOUD-API( 3953): —> HTTP POST https://services.poynt.net/businesses/f9247f46-7407-4ea1-9495-757fb589733a/transactions
D/CLOUD-API( 3953): Authorization: BEARE
D/CLOUD-API( 3953): POYNT-REQUEST-ID: cf7158de-0152-1000-1ac0-a9d4adbe23e9
D/CLOUD-API( 3953): api-version: 1.2
D/CLOUD-API( 3953): User-Agent: Poynt Services/1.0-R160 (Android 4.4.4; merchant-release-51; urn:tid:82b8e3ee-13dc-3575-8cd9-0963ff5a0823; P61SWT233FS000493)
D/CLOUD-API( 3953): Content-Type: application/json; charset=UTF-8
D/CLOUD-API( 3953): Content-Length: 1467
D/CLOUD-API( 3953): —> END HTTP (1467-byte body)
D/com.amplitude.api.AmplitudeClient( 3953): Logged event to Amplitude: frag_message_ACTION_CARD_AUTHORIZING
D/PaymentOptionsFragment( 3953): Received broadcasted intent: poynt.intent.action.ONLINE_AUTHORIZATION
I/POYNT-EVENT( 3953): {“time” : “2016-02-11T08:27:39Z”, “type” : “REST_API”, “resource” : “”, “status” : “SUCCESS”, “storeDeviceId” : “urn:tid:82b8e3ee-13dc-3575-8cd9-0963ff5a0823”, “processingTime” : 1267.053166, “method” : “POST”, “apiStatusCode” : 201, “apiRequestId” : “cf7158de-0152-1000-1ac0-a9d4adbe23e9”, “apiEndpoint” : “https://services.poynt.net/businesses/f9247f46-7407-4ea1-9495-757fb589733a/transactions”, “apiServerDate” : “Thu, 11 Feb 2016 08:27:36 GMT”, “apiServerBuild” : “1.2.109-20160209-1017”, “apiServerInstanceId” : “i-21da0ce8”, “sdkErrorCode” : 0}
D/CLOUD-API( 3953): <— HTTP 201 https://services.poynt.net/businesses/f9247f46-7407-4ea1-9495-757fb589733a/transactions (1269ms)
D/CLOUD-API( 3953): Server: nginx
D/CLOUD-API( 3953): Date: Thu, 11 Feb 2016 08:27:36 GMT
D/CLOUD-API( 3953): Content-Type: application/json;charset=UTF-8
D/CLOUD-API( 3953): Transfer-Encoding: chunked
D/CLOUD-API( 3953): Connection: keep-alive
D/CLOUD-API( 3953): Poynt-Request-Id: cf7158de-0152-1000-1ac0-a9d4adbe23e9
D/CLOUD-API( 3953): Poynt-Build-Info: 1.2.109-20160209-1017
D/CLOUD-API( 3953): Instance-Id: i-21da0ce8
D/CLOUD-API( 3953): OkHttp-Selected-Protocol: http/1.1
D/CLOUD-API( 3953): OkHttp-Sent-Millis: 1455179258180
D/CLOUD-API( 3953): OkHttp-Received-Millis: 1455179259442
D/CLOUD-API( 3953): <— END HTTP (-1-byte body)
I/POYNT-EVENT( 3953): {“time” : “2016-02-11T08:27:39Z”, “type” : “TRANSACTION”, “resource” : “”, “status” : “SUCCESS”, “businessId” : “f9247f46-7407-4ea1-9495-757fb589733a”, “businessType” : “TEST_MERCHANT”, “storeDeviceId” : “urn:tid:82b8e3ee-13dc-3575-8cd9-0963ff5a0823”, “processingTime” : 0.0, “method” : “AUTHORIZE”, “apiStatusCode” : 0, “apiEndpoint” : “”, “sdkErrorCode” : 27, “data” : “Status: DECLINED statusCode: ExpiredCard”}
I/POYNT-EVENT( 3953): {“time” : “2016-02-11T08:27:39Z”, “type” : “CARD_READER”, “resource” : “”, “status” : “INFO”, “businessId” : “f9247f46-7407-4ea1-9495-757fb589733a”, “businessType” : “TEST_MERCHANT”, “processingTime” : 0.0, “method” : “COMPLETE_TRANSACTION”, “apiStatusCode” : 0, “apiEndpoint” : “”, “sdkErrorCode” : 0, “data” : “SENDING”}
I/CO.POYNT.SERVICES( 3953): NOTIFICATION: PoyntNotification{protocol=POYNT1, type=UI_EVENT, notificationFlags=00000000, dataLength=8, data=0000001400000000, EventCode=DECLINED, logData=null, crc=56BA, expectedCrc=56BA}
D/UsbRequestJNI( 3953): init
D/UsbRequestJNI( 3953): init
D/UsbRequestJNI( 3953): init
D/UsbRequestJNI( 3953): init
D/UsbRequestJNI( 3953): init
D/UsbRequestJNI( 3953): init
D/UsbRequestJNI( 3953): init
D/UsbRequestJNI( 3953): init
D/UsbRequestJNI( 3953): init
D/UsbRequestJNI( 3953): init
D/UsbRequestJNI( 3953): init
D/UsbRequestJNI( 3953): init
D/com.amplitude.api.AmplitudeClient( 3953): Logged event to Amplitude: frag_message_ACTION_CARD_DECLINED
D/PaymentOptionsFragment( 3953): Received broadcasted intent: poynt.intent.action.DECLINED
I/POYNT-EVENT( 3953): {“time” : “2016-02-11T08:27:39Z”, “type” : “CARD_READER”, “resource” : “”, “status” : “INFO”, “businessId” : “f9247f46-7407-4ea1-9495-757fb589733a”, “businessType” : “TEST_MERCHANT”, “processingTime” : 0.0, “method” : “COMPLETE_TRANSACTION”, “apiStatusCode” : 0, “apiEndpoint” : “”, “sdkErrorCode” : 0, “data” : "status(ONLINE_DECLINED) data_len(249) "}
I/CO.POYNT.SERVICES( 3953): Executing task (OfflineTransactionTask{transaction=null, requestId=‘cf715f1c-0152-1000-1ac0-a9d4adbe23e9’, businessUser=Account {name=Hristo, type=co.poynt}, adjustTransaction=null, transactionId=‘null’, originalRequestId=‘cf7158de-0152-1000-1ac0-a9d4adbe23e9’, action=null’, adjustOnly=false’, counter=0})
I/CO.POYNT.SERVICES( 3953): Skipping due to already running(true) isNetworkAvailable(true)
D/CLOUD-API( 3953): —> HTTP POST https://services.poynt.net/businesses/f9247f46-7407-4ea1-9495-757fb589733a/transactions/cancel?original-request-id=cf7158de-0152-1000-1ac0-a9d4adbe23e9
D/CLOUD-API( 3953): Authorization: BEARE
D/CLOUD-API( 3953): POYNT-REQUEST-ID: cf715f1c-0152-1000-1ac0-a9d4adbe23e9
D/CLOUD-API( 3953): api-version: 1.2
D/CLOUD-API( 3953): User-Agent: Poynt Services/1.0-R160 (Android 4.4.4; merchant-release-51; urn:tid:82b8e3ee-13dc-3575-8cd9-0963ff5a0823; P61SWT233FS000493)
D/CLOUD-API( 3953): Content-Type: application/json; charset=UTF-8
D/CLOUD-API( 3953): Content-Length: 2
D/CLOUD-API( 3953): —> END HTTP (2-byte body)
I/POYNT-EVENT( 3953): {“time” : “2016-02-11T08:27:39Z”, “type” : “REST_API”, “resource” : “”, “status” : “FAILURE”, “storeDeviceId” : “urn:tid:82b8e3ee-13dc-3575-8cd9-0963ff5a0823”, “processingTime” : 256.955417, “method” : “POST”, “apiStatusCode” : 404, “apiRequestId” : “cf715f1c-0152-1000-1ac0-a9d4adbe23e9”, “apiEndpoint” : “https://services.poynt.net/businesses/f9247f46-7407-4ea1-9495-757fb589733a/transactions/cancel?original-request-id=cf7158de-0152-1000-1ac0-a9d4adbe23e9”, “apiServerDate” : “Thu, 11 Feb 2016 08:27:37 GMT”, “apiServerBuild” : “1.2.109-20160209-1017”, “apiServerInstanceId” : “i-0325afcb”, “sdkErrorCode” : 0}
D/CLOUD-API( 3953): <— HTTP 404 https://services.poynt.net/businesses/f9247f46-7407-4ea1-9495-757fb589733a/transactions/cancel?original-request-id=cf7158de-0152-1000-1ac0-a9d4adbe23e9 (273ms)
D/CLOUD-API( 3953): Server: nginx
D/CLOUD-API( 3953): Date: Thu, 11 Feb 2016 08:27:37 GMT
D/CLOUD-API( 3953): Content-Type: application/json;charset=UTF-8
D/CLOUD-API( 3953): Transfer-Encoding: chunked
D/CLOUD-API( 3953): Connection: keep-alive
D/CLOUD-API( 3953): Vary: Accept-Encoding
D/CLOUD-API( 3953): Poynt-Request-Id: cf715f1c-0152-1000-1ac0-a9d4adbe23e9
D/CLOUD-API( 3953): Poynt-Build-Info: 1.2.109-20160209-1017
D/CLOUD-API( 3953): Instance-Id: i-0325afcb
D/CLOUD-API( 3953): OkHttp-Selected-Protocol: http/1.1
D/CLOUD-API( 3953): OkHttp-Sent-Millis: 1455179259718
D/CLOUD-API( 3953): OkHttp-Received-Millis: 1455179259962
D/CLOUD-API( 3953): <— END HTTP (-1-byte body)
E/CO.POYNT.SERVICES( 3953): PoyntAPIException{HTTP statusCode=404 apiErrorCode=TRANSACTION_NOT_FOUND Network Error? false}
E/CO.POYNT.SERVICES( 3953): at co.poynt.services.rest.RestErrorHandler.handleError(RestErrorHandler.java:15)
E/CO.POYNT.SERVICES( 3953): at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:242)
E/CO.POYNT.SERVICES( 3953): at $Proxy13.reverseTransaction(Native Method)
E/CO.POYNT.SERVICES( 3953): at co.poynt.services.processors.PoyntTransactionProcessorImpl.reverseTransaction(PoyntTransactionProcessorImpl.java:314)
E/CO.POYNT.SERVICES( 3953): at co.poynt.services.offline.tasks.CancelTransactionRequestTaskRunner.doInBackground(CancelTransactionRequestTaskRunner.java:65)
E/CO.POYNT.SERVICES( 3953): at co.poynt.services.offline.tasks.CancelTransactionRequestTaskRunner.doInBackground(CancelTransactionRequestTaskRunner.java:20)
E/CO.POYNT.SERVICES( 3953): at android.os.AsyncTask$2.call(AsyncTask.java:288)
E/CO.POYNT.SERVICES( 3953): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E/CO.POYNT.SERVICES( 3953): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
E/CO.POYNT.SERVICES( 3953): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/CO.POYNT.SERVICES( 3953): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/CO.POYNT.SERVICES( 3953): at java.lang.Thread.run(Thread.java:841)
I/POYNT-EVENT( 3953): {“time” : “2016-02-11T08:27:40Z”, “type” : “OFFLINE_SERVICE”, “resource” : “TRANSACTION”, “status” : “FAILURE”, “businessId” : “f9247f46-7407-4ea1-9495-757fb589733a”, “businessType” : “TEST_MERCHANT”, “storeDeviceId” : “urn:tid:82b8e3ee-13dc-3575-8cd9-0963ff5a0823”, “processingTime” : 0.0, “method” : “CANCEL”, “apiStatusCode” : 404, “apiEndpoint” : “”, “apiErrorcode” : “TRANSACTION_NOT_FOUND”, “sdkErrorCode” : 0, “data” : “isNetworkError(false)”}
I/CO.POYNT.SERVICES( 3953): Offline Transaction executing failure
I/CO.POYNT.SERVICES( 3953): Stopping self.

looks like you are doing a 1cent transaction - our sandbox gateway requires amount to be within $0.25 cents and $200, and $5 amount is always declined. So please try any other amount.

With regards to the other issue - this is what I got back from our firmware team: " kernel codes with the lower 2 bytes starting with 02xx are Read Record / Get Processing Options errors. 00020219 should mean that in the MasterCard kernel that there was an error reported by the L1 for either the Get Processing Options APDU or one of the read record APDUs." Is it possible to get any traces from your emulated card side ?

Yes, there’s a trace left by the communication, from the service that extends HostApduService, in processCommandApdu(final byte[] commandApdu, final Bundle extras):

APDU In : 00a404000e325041592e5359532e444446303100
APDU Out: 6f2d840e325041592e5359532e4444463031a51bbf0c1861164f07a000000004101050086d6f636b2d6170708701019000
APDU In : 00a4040007a000000004101000
APDU Out: 6f188407a0000000041010a50d50086d6f636b2d6170708701019000
APDU In : 80a8000002830000
APDU Out: 770e82021880940808010100100101009000
APDU In : 00b2010c00
APDU Out: 7081a99f6c0200019f6b135269971700000083d20118021100000000000f564a42353236393937313730303030303038335e202f5e31383032323031303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030309f620600000000e0009f63060000003f00009f6401039f650200389f66020fc09f6701039f691b9f02069f03069f1a0295055f2a029a039c019f37049f35019f45029000

Regarding the other issue, the amount limitations are good to know but in this case not this is the problem. I currently try with $13 and I still get the 404 status code.

Thanks for the trace - our firmware team is looking into it.

Regarding the other issue, I did not look close enough - the error seems to be expired card - here is the response from the processor:

ProcessorResponse [avsResult=AVSResult [addressResult=null, postalCodeResult=null, stateResult=null, countryResult=null, phoneResult=null, cardHolderNameResult=null, cityResult=null, actualResult=null], cvResult=null, remainingBalance=null, approvedAmount=0, emvTags=null, processor=CREDITCALL, acquirer=CHASE_PAYMENTECH, status=Failure, providerVerification=null, statusCode=ExpiredCard, statusMessage=ExpiredCard, transactionId=f9e6be4d-99d0-e511-bb26-0050569228c2, approvalCode=null, batchId=null, retrievalRefNum=null], transactionNumber=null, receiptEmailAddress=null, notes=null, approvalCode=null, action=AUTHORIZE, amounts=TransactionAmounts [customerOptedNoTip=null,** transactionAmount=1, orderAmount=1,** tipAmount=0, cashbackAmount=0, currency=USD], status=DECLINED

Btw as you see above the amount is also set to 1 cent.

Hello again,

regarding the expired card, I really didn’t notice as well, that was the issue.

Regarding the other problem, do you have response from the firmware team?

Another question came up: what are you PAN limitations? The emulated card is supposed to be with a maximum of 19-digit PAN but the Poynt terminal wouldn’t accept a PAN with 17 digits and above.