I'm running my Android POS app on a Clover Flex WiFi gen 2. When I hit "run card" button in my app, I run this code:
initializePaymentConnector() val saleRequest = SaleRequest() saleRequest.externalId = ExternalIdUtils.generateNewID() saleRequest.amount = amount paymentConnector!!.sale(saleRequest)
private fun initializePaymentConnector() { val cloverAccount: android.accounts.Account? = getAccount(requireContext()) val remoteApplicationId = "..." if (paymentConnector == null) { 2 paymentConnector = PaymentConnector(requireContext(), cloverAccount, paymentConnectorListener, remoteApplicationId) paymentConnector!!.initializeConnection() } }
val paymentConnectorListener: IPaymentConnectorListener = object : IPaymentConnectorListener { override fun onDeviceDisconnected() { Toast.makeText(requireContext(), "onDeviceDisconnected", Toast.LENGTH_LONG).show() } override fun onDeviceConnected() { activityProShopPayment8!!.runOnUiThread(Runnable { Timber.d(tag, "onDeviceConnected") Toast.makeText(requireContext(), "onDeviceConnected", Toast.LENGTH_LONG).show() }) } override fun onPreAuthResponse(response: PreAuthResponse?) { Toast.makeText(requireContext(), "onPreAuthResponse", Toast.LENGTH_LONG).show() } override fun onAuthResponse(response: AuthResponse?) { activityProShopPayment8!!.runOnUiThread(Runnable { Timber.d(tag, "onAuthResponse") Toast.makeText(requireContext(), "onAuthResponse", Toast.LENGTH_LONG).show() }) } override fun onTipAdjustAuthResponse(response: TipAdjustAuthResponse?) { Toast.makeText(requireContext(), "onTipAdjustAuthResponse", Toast.LENGTH_LONG).show() } override fun onCapturePreAuthResponse(response: CapturePreAuthResponse?) { Toast.makeText(requireContext(), "onCapturePreAuthResponse", Toast.LENGTH_LONG).show() } override fun onVerifySignatureRequest(request: VerifySignatureRequest?) { Toast.makeText(requireContext(), "onVerifySignatureRequest", Toast.LENGTH_LONG).show() } override fun onConfirmPaymentRequest(request: ConfirmPaymentRequest?) { if (request!!.payment == null || request.challenges == null) { showError("Error: The ConfirmPaymentRequest was missing the payment and/or challenges.") } else { currentPayment = request.payment } } override fun onSaleResponse(saleResponse: SaleResponse) { activityProShopPayment8!!.runOnUiThread(Runnable { Timber.d(tag, "onSaleResponse") processSaleResponse(saleResponse) }) } override fun onManualRefundResponse(response: ManualRefundResponse?) { Toast.makeText(requireContext(), "onManualRefundResponse", Toast.LENGTH_LONG).show() } override fun onRefundPaymentResponse(response: RefundPaymentResponse?) { Toast.makeText(requireContext(), "onRefundPaymentResponse", Toast.LENGTH_LONG).show() } override fun onTipAdded(tipAdded: TipAdded?) { Toast.makeText(requireContext(), "onTipAdded", Toast.LENGTH_LONG).show() } override fun onVoidPaymentResponse(response: VoidPaymentResponse?) { Toast.makeText(requireContext(), "onVoidPaymentResponse", Toast.LENGTH_LONG).show() } override fun onVaultCardResponse(response: VaultCardResponse?) { Toast.makeText(requireContext(), "onVaultCardResponse", Toast.LENGTH_LONG).show() } override fun onRetrievePendingPaymentsResponse(retrievePendingPaymentResponse: RetrievePendingPaymentsResponse?) { Toast.makeText(requireContext(), "onRetrievePendingPaymentsResponse", Toast.LENGTH_LONG).show() } override fun onReadCardDataResponse(response: ReadCardDataResponse?) { Toast.makeText(requireContext(), "onReadCardDataResponse", Toast.LENGTH_LONG).show() } override fun onCloseoutResponse(response: CloseoutResponse?) { Toast.makeText(requireContext(), "onCloseoutResponse", Toast.LENGTH_LONG).show() } override fun onRetrievePaymentResponse(response: RetrievePaymentResponse?) { Toast.makeText(requireContext(), "onRetrievePaymentResponse", Toast.LENGTH_LONG).show() } override fun onVoidPaymentRefundResponse(response: VoidPaymentRefundResponse?) { Toast.makeText(requireContext(), "onVoidPaymentRefundResponse", Toast.LENGTH_LONG).show() } }
I set breakpoints on all of the override functions and the only one that fires is onDeviceConnected. The Clover sales flow does work, and the card is charged, but after clicking no receipt, the app just closes. onSaleResponse never fires.
I'm new to this, so forgive me if I'm missing something obvious...