Android SDK reader Payment Failed

CheckoutManager checkoutManager = ReaderSdk.checkoutManager();
checkoutCallbackRef = checkoutManager.addCheckoutActivityCallback(this::onCheckoutResult);

private void onCheckoutResult(Result<CheckoutResult, ResultError> result) {
isSuccessOrFailure=true;
if (result.isSuccess()) {
ExampleApplication.paymentDone = true;
BluetoothService.working=false;
CheckoutResult checkoutResult = result.getSuccessValue();

  progressBar.setVisibility(View.VISIBLE);

  Set<Tender> tenders=checkoutResult.getTenders();
  Tender[] tenders1=new Tender[tenders.size()];
  int counter=0;
  for (Tender tender2 : tenders) {
    tenders1[counter]=tender2;
    counter+=1;
  }
  //Tender[] tenders1= (Tender[]) tenders.toArray();
  String last4= tenders1[0].getCardDetails().getCard().getLastFourDigits();
  String locationId = checkoutResult.getLocationId();
  Log.d("checkPay", "onCheckoutResult: " + last4 + "    " + locationId);

  SquareClient client = new SquareClient.Builder()
          .environment(Environment.PRODUCTION)
          .accessToken("EAAAFANnrd7-Bfh_GvcyBcGxfEtykC7EQJ72Z2-hpYiGnoekY1TLtQYJKqagjkF6")
          .build();
  PaymentsApi paymentsApi = client.getPaymentsApi();
  paymentsApi.listPaymentsAsync(
          null,
          null,
          null,
          null,
          locationId,
          null,
          last4,
          null,
          null)
          .thenAccept(results -> {
            String name=results.getPayments().get(0).getCardDetails().getCard().getCardholderName().toString();
            //String name="MAYFIELD/ SAMIR        ";
            if (name.contains("CARD") || !name.contains("/") || name==null){
              PrefConfig.saveState(getApplicationContext(),8);
              Intent intent=new Intent(getApplicationContext(),ContinuousMode.class);
              startActivity(intent);
              finish();
            }else {
              name=name.replace(" ", "");
              String[] parts = name.split("/");
              String firstName = parts[1];
              String LastName = parts[0];
              Character LastNameLetter=LastName.charAt(0);
              firstName = firstName.substring(0, 1).toUpperCase() + firstName.substring(1).toLowerCase();
              name=firstName+" "+LastNameLetter+".";
              PrefConfig.saveTopListName(getApplicationContext(),name);
              PrefConfig.saveState(getApplicationContext(),19);
              Intent intent=new Intent(getApplicationContext(),ContinuousMode.class);
              startActivity(intent);
              finish();
            }

          })
          .exceptionally(exception -> {
            System.out.println("Failed to make the request");
            System.out.println(String.format("Exception: %s", exception.getMessage()));
            Log.d("paymentcancel", "onCheckoutResult: ");
            PrefConfig.saveState(getApplicationContext(),8);
            Intent intent=new Intent(getApplicationContext(),ContinuousMode.class);
            startActivity(intent);
            finish();
            return null;
          });
}else {
  ResultError<CheckoutErrorCode> error = result.getError();
  PrefConfig.saveState(getApplicationContext(),12); // initially 6 but 12 is working fine for all condition DO NOT TOUCH
  Intent intent=new Intent(getApplicationContext(),ContinuousMode.class);
  startActivity(intent);
  finish();
  Log.d("errorCode", "onCheckoutResult: " + error.getCode());

  switch (error.getCode()) {
    case SDK_NOT_AUTHORIZED:
      goToAuthorizeActivity();
      break;
    case CANCELED:
      Log.d("checkoutError", "onCheckoutResult: " + error);
      break;
    case USAGE_ERROR:
      showErrorDialog(error);
      Log.d("checkoutError", "onCheckoutResult: " + error);
      break;
  }
}

}