Leveraging the Clover Go Android SDK in your app
(Legacy Content)
You can leverage the ICloverGoConnector cloverGo450Connector
and ICloverGoConnectorListener ccGoListener
functions in your app:
- Create and implement
ICloverGoConnectorListener
.
ccGoListener = new new ICloverGoConnectorListener() {
public void...
...
}
**** Below are useful and important functions ****
ccGoListener = new ICloverGoConnectorListener() {
public void onDeviceDisconnected(ReaderInfo readerInfo) {}
public void onDeviceConnected() {}
public void onCloverGoDeviceActivity(final CloverDeviceEvent deviceEvent) {
switch (deviceEvent.getEventState()) {
case CARD_SWIPED:
break;
case CARD_TAPPED:
break;
case CANCEL_CARD_READ:
break;
case EMV_COMPLETE_DATA:
break;
case CARD_INSERTED_MSG:
break;
case CARD_REMOVED_MSG:
break;
case PLEASE_SEE_PHONE_MSG:
break;
case READER_READY:
break;
}
}
public void onDeviceDiscovered(ReaderInfo readerInfo) {}
public void onAidMatch(final List<CardApplicationIdentifier>applicationIdentifiers, final AidSelection aidSelection) {}
public void onDeviceReady(final MerchantInfo merchantInfo) {}
public void onDeviceError(CloverDeviceErrorEvent deviceErrorEvent) {
switch (deviceErrorEvent.getErrorType()) {
case READER_ERROR:
case CARD_ERROR:
case READER_TIMEOUT:
case COMMUNICATION_ERROR:
case LOW_BATTERY:
case PARTIAL_AUTH_REJECTED:
case DUPLICATE_TRANSACTION_REJECTED:
// notify user
break;
case MULTIPLE_CONTACT_LESS_CARD_DETECTED_ERROR:
case CONTACT_LESS_FAILED_TRY_CONTACT_ERROR:
case EMV_CARD_SWIPED_ERROR:
case DIP_FAILED_ALL_ATTEMPTS_ERROR:
case DIP_FAILED_ERROR:
case SWIPE_FAILED_ERROR:
// show progress to user
break;
}
}
public void onAuthResponse(final AuthResponse response) {}
public void onPreAuthResponse(final PreAuthResponse response) {}
public void onTipAdjustAuthResponse(TipAdjustAuthResponse response) {}
public void onCapturePreAuthResponse(CapturePreAuthResponse response) {}
public void onConfirmPaymentRequest(ConfirmPaymentRequest request) {}
public void onSaleResponse(final SaleResponse response) {}
public void onRefundPaymentResponse(final RefundPaymentResponse response) {}
public void onTipAdded(TipAddedMessage message) {}
public void onVoidPaymentResponse(VoidPaymentResponse response) {}
- Initialize the SDK with 450 (Bluetooth) Reader.
The following parameters are required to initialize the SDK:accessToken
environment
apiKey
secret
appId
CloverGoDeviceConfiguration config = new CloverGoDeviceConfiguration.Builder(getApplicationContext(), accessToken, goEnv, apiKey, secret, appId).deviceType(ReaderInfo.ReaderType.RP450). allowAutoConnect(false).build();
ICloverGoConnector cloverGo450Connector = (CloverGoConnector)
ConnectorFactory.createCloverConnector(config);
cloverGo450Connector.addCloverGoConnectorListener(ccGoListener);
cloverGo450Connector.initializeConnection();
- Perform a sale transaction.
SaleRequest request = new
SaleRequest(store.getCurrentOrder().getTotal(), externalPaymentID);
request.setCardEntryMethods(store.getCardEntryMethods());
request.setAllowOfflinePayment(store.getAllowOfflinePayment());
request.setForceOfflinePayment(store.getForceOfflinePayment());
request.setApproveOfflinePaymentWithoutPrompt(store.getApproveOfflinePaymentWithoutPrompt());
request.setTippableAmount(store.getCurrentOrder().getTippableAmount());
request.setTaxAmount(store.getCurrentOrder().getTaxAmount());
request.setDisablePrinting(store.getDisablePrinting());
request.setTipMode(store.getTipMode());
request.setSignatureEntryLocation(store.getSignatureEntryLocation());
request.setSignatureThreshold(store.getSignatureThreshold());
request.setDisableReceiptSelection(store.getDisableReceiptOptions());
request.setDisableDuplicateChecking(store.getDisableDuplicateChecking());
request.setTipAmount(store.getTipAmount());
request.setAutoAcceptPaymentConfirmations(store.getAutomaticPaymentConfirmation());
request.setAutoAcceptSignature(store.getAutomaticSignatureConfirmation());
cloverGo450Connector.sale(request);
Required parameters for sale transactions:
-
amount
– the total amount you want to make a transaction for -
externalPaymentID
– random unique number for this transaction -
Perform an auth transaction.
AuthRequest request = new AuthRequest(store.getCurrentOrder().getTotal(), externalPaymentID);
request.setCardEntryMethods(store.getCardEntryMethods());
request.setAllowOfflinePayment(store.getAllowOfflinePayment());
request.setForceOfflinePayment(store.getForceOfflinePayment());
request.setApproveOfflinePaymentWithoutPrompt(store.getApproveOfflinePaymentWithoutPrompt());
request.setTippableAmount(store.getCurrentOrder().getTippableAmount());
request.setTaxAmount(store.getCurrentOrder().getTaxAmount());
request.setDisablePrinting(store.getDisablePrinting());
request.setSignatureEntryLocation(store.getSignatureEntryLocation());
request.setSignatureThreshold(store.getSignatureThreshold());
request.setDisableReceiptSelection(store.getDisableReceiptOptions());
request.setDisableDuplicateChecking(store.getDisableDuplicateChecking());
request.setAutoAcceptPaymentConfirmations(store.getAutomaticPaymentConfirmation());
request.setAutoAcceptSignature(store.getAutomaticSignatureConfirmation());
cloverConnector.auth(request);
Required parameters for auth transactions:
amount
– Total amount you want to make in a transactionexternalPaymentID
– Random unique number for this transaction and other optional parameters
Updated 3 months ago