Transaction Search

Description

The Transaction Search function is used to retrieve details of previous transactions.


Request

Parameters

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

PARAMETERTYPEDESCRIPTIONEXAMPLE
REQUIRED
launchTypeSTRINGMust be “TX_SEARCH”
Used for launching the Ecentric Payment App to perform a transaction search query.
TX_SEARCH
merchantIDSTRINGThe merchant ID assigned to the merchant.945230000000001
authenticationKeySTRINGThe authentication token that was generated by the server on a successful login to the Ecentric Payment Appe27b5456-8bff6-4746-94bg-367253356eb
OPTIONAL
transactionUuid STRINGUnique ID (UUID) of transaction if searching for a specific transaction..79f451e7-edc9-4f9e-8625-18618f597a8f

Sample Code

private void doTxSearch() {
    Intent intent = new Intent();
    intent.setClassName("com.ecentric.ecentricpay", "com.ecentric.ecentricpay.MainActivity");
    Bundle dataBundle = new Bundle();
    dataBundle.putString("launchType", "TX_SEARCH");
    dataBundle.putString("merchantID", "910100000000001");
  	dataBundle.putString("authenticationKey", "received_authenticationKey");
  	dataBundle.putString("transactionUuid", "78a501e7-edc9-4f9e-8625-18618f597a8f"); // Returns last transaction or specific transaction if UUID is specified

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

Response

Parameters

The following table describes the parameters of the TX_SEARCH response message.

PARAMETERTYPEDESCRIPTIONEXAMPLE
launchTypeSTRINGEcho of the launchType used to launch the Ecentric Payment App.TX_SEARCH
resultCodeSTRINGRepresents the result status of the TX Search intent call:
● 01: SUCCESSFUL
● 02: DECLINED
● 04: ERROR
01
isReceiptDataAvailableBOOLBoolean indicating whether a receiptBundle object is available. Will always be included for approved or declined transactions.true
receiptBundleSTRINGConsists of a sub-bundle of server parameters that can be used by the partner application to create a receipt.See Sample ecentricBundle SALE Response.
merchantIDSTRINGEcho of the merchantID used in the request.910100000000001
resultDescriptionSTRINGA user readable representation of the above resultCode i.e. Approved for resultCode 01.COMPLETED
transactionAmountLONGApproved total transactionAmount.1000
cashAmountLONGApproved cashAmount.500
transactionUuidSTRINGUnique ID of transactionbdf9d0af-17b3-48ca-8a0b-37dc52bf49bc
appVersionSTRINGThe software version currently running on the Ecentric Payment App.2.0.0

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");
                   Boolean success = false;
                   if (resultCode != null && (resultCode.matches("00") || resultCode.matches("01"))) {
                       success = true;
                   }

                   if (success && launchType.matches("RETAIL_AUTH")) {
                       authenticationKey = responseBundle.getString("authenticationKey");
                   }

                   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"