Card Query

Description

The Card Query function is used to obtain card information by means of swiping the card on the payment device.


Request

Parameters

The following table describes the parameters of the CARDQUERY request message.

PARAMETERTYPEDESCRIPTIONEXAMPLE
REQUIRED
launchTypeSTRINGMust be “CARDQUERY”
Used for launching the Ecentric Payment App to perform a card query.
CARDQUERY
merchantIDSTRINGThe merchant ID assigned to the merchant.971234500000003
authenticationKeySTRINGThe authentication token that was generated by the server on a successful auth call to the Ecentric Payment Appe27b6ce6-78ba6-4y46-9953-5afr28f7cbeb

Sample Code

private void doCardQuery() {
   Intent intent = new Intent();
   intent.setClassName("com.ecentric.ecentricpay", "com.ecentric.ecentricpay.MainActivity");
   Bundle dataBundle = new Bundle();
   dataBundle.putString("launchType", "CARDQUERY");
   dataBundle.putString("merchantID", "910100000000001");
 	 dataBundle.putString("authenticationKey", "received_authenticationKey");
  
   addDefaultToIntentBundle(dataBundle);

   intent.putExtra("ecentricBundle", dataBundle);
   try {
       intentLauncher.launch(intent);
   } catch (Exception e) {
       Log.e(TAG, "Error launching intent: " + e);
   }
}

Response

Parameters

PARAMETERTYPEDESCRIPTIONEXAMPLE
launchTypeSTRINGEcho of the launchType used to launch the Ecentric Payment App.CARDQUERY
resultCodeSTRINGRepresents the result of the card query intent call:
● 00: COMPLETED
● 04: ERROR
00
merchantIDSTRINGEcho of the merchantID used in the request.910100000000001
resultDescriptionSTRINGA user readable representation of the above resultCode i.e. Approved for resultCode 01.COMPLETED
track1DataSTRINGContents of track 1 if availableB5210955001511518^ /^29056270000015400000000000000000000000000000
track2DataSTRINGContents of track 2 if available5210955001511518=29056270000000154000
panDataSTRINGPAN of card if available5210955001511518
transactionUuidSTRINGUnique ID of transaction. bdf9d0af-17b3-48ca-8a0b-37dc52bf49bc
serialNumberSTRINGThe serial number for the device that was used for the CARDQUERY intent call.PC05P2CB14336
appVersionSTRINGThe software version currently running on the Ecentric Payment App.1.9.2

Sample Code

private final ActivityResultLauncher<Intent> intentLauncher = registerForActivityResult(
       new ActivityResultContracts.StartActivityForResult(),
       result -> {
           if (result.getResultCode() == Activity.RESULT_OK) {
               Intent data = result.getData();
               if (data != null) {
                   Bundle responseBundle = new Bundle(data.getBundleExtra("ecentricApplicationResponse"));
                   String launchType = responseBundle.getString("launchType");
                   String resultCode = responseBundle.getString("resultCode");
                 	 String track1Data = responseBundle.getString("track1Data"); 
									 String track2Data = responseBundle.getString("track2Data"); 
									 String panData = responseBundle.getString("panData");
                   Boolean success = false;
                   if (resultCode != null && (resultCode.matches("00") || resultCode.matches("01"))) {
                       success = true;
                   }

                   if (responseBundle.get("errorBundle") != null) {
                       Bundle errorBundle = new Bundle(responseBundle.getBundle("errorBundle"));
                   }
               }
           } else {
               Log.e(TAG, "Received error resultCode: " + result.getResultCode());
           }
       }
);

Error Handling

Sample Bundle

"resultDescription": "ABORTED",
"errorBundle": {
    "description": "ERROR",
    "reference": "",
    "errorType": "OTHER",
    "message": "Transaction cancelled by user"
  },
"buildInfo": "Ecentric_DEBUG_Ecentric_INT",
"resultCode": "03",
"merchantID": "910100000000001",
"serialNumber": "PC05P2CG10036",
"launchType": "CARDQUERY",
"appVersion": "1.9.8"