ICloverConnectorListener
public protocol ICloverConnectorListener : AnyObject
-
Called at the completion of a Sale() request. The SaleResponse contains a ResultCode and a Success boolean. A successful Sale transaction will also have the payment object, which can be for the full or partial amount of the Sale request. Note: A Sale transaction may come back as a tip-adjustable Auth, depending on the payment gateway. The SaleResponse has a boolean isSale flag that indicates whether the sale is final, or will be finalized during closeout.
Declaration
Swift
func onSaleResponse(_ response: SaleResponse)
Parameters
response
The response to the transaction request.
-
Called in response to an Auth() request. Note: An Auth transaction may come back as a final Sale, depending on the payment gateway. The AuthResponse has a boolean isAuth flag that indicates whether the Payment can still be
tip-adjusted.Declaration
Swift
func onAuthResponse(_ authResponse: AuthResponse)
Parameters
authResponse
The response to the transaction request.
-
Called in response to a PreAuth() request. Note: The boolean isPreAuth flag in the PreAuthResponse indicates whether CapturePreAuth() can be called for the returned Payment. If the isPreAuth flag is false and the isAuth flag is true, then the payment gateway coerced the PreAuth() request to an Auth. The payment will need to be voided or it will be automatically captured at closeout.
Declaration
Swift
func onPreAuthResponse(_ preAuthResponse: PreAuthResponse)
Parameters
preAuthResponse
The response to the transaction request.
-
Called in response to a CapturePreAuth() request. Contains the new Amount and TipAmount if successful.
Declaration
Swift
func onCapturePreAuthResponse(_ capturePreAuthResponse: CapturePreAuthResponse)
Parameters
capturePreAuthResponse
The response to the transaction request.
-
Called in response to a tip adjustment for an Auth transaction. Contains the tipAmount if successful.
Declaration
Swift
func onTipAdjustAuthResponse(_ tipAdjustAuthResponse: TipAdjustAuthResponse)
Parameters
tipAdjustAuthResponse
The response to the transaction request.
-
Called in response to a voidPayment() request. Contains a ResultCode and a Success boolean. If successful, the response will also contain the paymentId for the voided Payment.
Declaration
Swift
func onVoidPaymentResponse(_ voidPaymentResponse: VoidPaymentResponse)
Parameters
voidPaymentResponse
The response to the transaction request.
-
Called in response to a RefundPayment() request. Contains a ResultCode and a Success boolean. The response to a successful transaction will contain the Refund. The Refund includes the original paymentId as a reference.
Declaration
Swift
func onRefundPaymentResponse(_ refundPaymentResponse: RefundPaymentResponse)
Parameters
refundPaymentResponse
The response to the transaction request.
-
Called in response to a voidPaymentRefund() request. Contains a ResultCode and a Success boolean. The response to a successful transaction will contain the Refund. The Refund includes the original paymentId as a reference.
Declaration
Swift
func onVoidPaymentRefundResponse(_ response: VoidPaymentRefundResponse)
Parameters
VoidPaymentRefundResponse
The response to the transaction request.
-
Called in response to a manualRefund() request. Contains a ResultCode and a Success boolean. If successful, the ManualRefundResponse will have a Credit object associated with the relevant Payment information.
Declaration
Swift
func onManualRefundResponse(_ manualRefundResponse: ManualRefundResponse)
Parameters
manualRefundResponse
The response to the transaction request.
-
Called in response to a Closeout() request.
Declaration
Swift
func onCloseoutResponse(_ closeoutResponse: CloseoutResponse)
Parameters
closeoutResponse
The response to the transaction request.
-
Called when the Clover device requests verification for a user’s on-screen signature. The Payment and Signature will be passed in.
Declaration
Swift
func onVerifySignatureRequest(_ signatureVerifyRequest: VerifySignatureRequest)
Parameters
signatureVerifyRequest
The verification request.
-
Called in response to a vaultCard() request. Contains a ResultCode and a Success boolean. If successful, the response will contain a VaultedCard object with a token value that’s unique for the card and merchant. The token can be used for future Sale() and Auth() requests.
Declaration
Swift
func onVaultCardResponse(_ vaultCardResponse: VaultCardResponse)
Parameters
vaultCardResponse
The response to the request.
-
Called when the Clover device transitions to a new screen or activity. The CloverDeviceEvent passed in will contain an event type, a description, and a list of available InputOptions.
Declaration
Swift
func onDeviceActivityStart(_ deviceEvent: CloverDeviceEvent)
Parameters
deviceEvent
The device event.
-
Called when the Clover device transitions away from a screen or activity. The CloverDeviceEvent passed in will contain an event type and description. Note: The start and end events are not guaranteed to process in order. The event type should be used to make sure these events are paired.
Declaration
Swift
func onDeviceActivityEnd(_ deviceEvent: CloverDeviceEvent)
Parameters
deviceEvent
The device event.
-
Called when an error occurs while trying to send messages to the Clover device.
Declaration
Swift
func onDeviceError(_ deviceErrorEvent: CloverDeviceErrorEvent)
Parameters
deviceErrorEvent
The device error event.
-
Called when the Clover device is initially connected, but not ready to communicate.
Declaration
Swift
func onDeviceConnected()
-
Called when the Clover device is ready to communicate and respond to requests.
Declaration
Swift
func onDeviceReady(_ merchantInfo: MerchantInfo)
Parameters
merchantInfo
The merchant information to associate with the device.
-
Called when the Clover device is disconnected from the CloverConnector or not responding. Not called when the CloverConnector is manually disconnected via ‘dispose()’
Declaration
Swift
func onDeviceDisconnected()
-
Called when the Clover device encounters a Challenge at the payment gateway and requires confirmation. A Challenge is triggered by a potential duplicate Payment (DUPLICATE_CHALLENGE) or an offline Payment (OFFLINE_CHALLENGE). The device sends a ConfirmPaymentRequest() asking the merchant to reply by sending either an AcceptPayment() or RejectPayment() call.
Note that duplicate Payment Challenges are raised when multiple Payments are made with the same card type and last four digits within the same hour. For this reason, we recommend that you do not programmatically call CloverConnector.RejectPayment() on all instances of DUPLICATE_CHALLENGE. For more information, see Working with Challenges.
Declaration
Swift
func onConfirmPaymentRequest(_ request: ConfirmPaymentRequest)
Parameters
request
The request for confirmation.
-
Called when a customer selects a tip amount on the Clover device’s screen.
Declaration
Swift
func onTipAdded(_ message: TipAddedMessage)
Parameters
message
The TipAddedMessage.
-
Called when a user requests a paper receipt for a Manual Refund. Will only be called if disablePrinting = true on the ManualRefund() request.
Declaration
Swift
func onPrintManualRefundReceipt(_ printManualRefundReceiptMessage: PrintManualRefundReceiptMessage)
Parameters
printManualRefundReceiptMessage
A callback that asks the POS to print a receipt for a ManualRefund. Contains a Credit object.
-
Called when a user requests a paper receipt for a declined Manual Refund. Will only be called if disablePrinting = true on the ManualRefund() request.
Declaration
Swift
func onPrintManualRefundDeclineReceipt(_ printManualRefundDeclineReceiptMessage: PrintManualRefundDeclineReceiptMessage)
Parameters
printManualRefundDeclineReceiptMessage
The PrintManualRefundDeclineReceiptMessage.
-
Called when a user requests a paper receipt for a Payment. Will only be called if disablePrinting = true on the Sale(), Auth(), or PreAuth() request.
Declaration
Swift
func onPrintPaymentReceipt(_ printPaymentReceiptMessage: PrintPaymentReceiptMessage)
Parameters
printPaymentReceiptMessage
The message.
-
Called when a user requests a paper receipt for a declined Payment. Will only be called if disablePrinting = true on the Sale(), Auth(), or PreAuth() request.
Declaration
Swift
func onPrintPaymentDeclineReceipt(_ printPaymentDeclineReceiptMessage: PrintPaymentDeclineReceiptMessage)
Parameters
printPaymentDeclineReceiptMessage
The message.
-
Called when a user requests a merchant copy of a Payment receipt. Will only be called if disablePrinting = true on the Sale(), Auth(), or PreAuth() request.
Declaration
Swift
func onPrintPaymentMerchantCopyReceipt(_ printPaymentMerchantCopyReceiptMessage: PrintPaymentMerchantCopyReceiptMessage)
Parameters
printPaymentMerchantCopyReceiptMessage
The message.
-
Called when a user requests a paper receipt for a Payment Refund. Will only be called if disablePrinting = true on the Sale(), Auth(), PreAuth() or ManualRefund() request.
Declaration
Swift
func onPrintRefundPaymentReceipt(_ printRefundPaymentReceiptMessage: PrintRefundPaymentReceiptMessage)
Parameters
printRefundPaymentReceiptMessage
The message.
-
Called in response to a retrievePrinters() request.
Declaration
Swift
func onRetrievePrintersResponse(_ retrievePrintersResponse: RetrievePrintersResponse)
Parameters
retrievePrintersResponse
The response to the request.
-
Called in response to a retrievePrintJobStatus() request.
Declaration
Swift
func onPrintJobStatusResponse(_ printJobStatusResponse: PrintJobStatusResponse)
Parameters
printJobStatusResponse
The response to the request.
-
Called in response to a retrievePendingPayment() request.
Declaration
Swift
func onRetrievePendingPaymentsResponse(_ retrievePendingPaymentResponse: RetrievePendingPaymentsResponse)
Parameters
retrievePendingPaymentResponse
The response to the request.
-
Called in response to a readCardData() request.
Declaration
Swift
func onReadCardDataResponse(_ readCardDataResponse: ReadCardDataResponse)
Parameters
readCardDataResponse
The response to the request.
-
Called when a Custom Activity finishes normally.
Declaration
Swift
func onCustomActivityResponse(_ customActivityResponse: CustomActivityResponse)
Parameters
customActivityResponse
The CustomActivityResponse.
-
Called in response to a ResetDevice() request.
Declaration
Swift
func onResetDeviceResponse(_ response: ResetDeviceResponse)
Parameters
response
The response to the request.
-
Called whenever customer provided data is accrued via the Loyalty API. Call the registerForCustomerProvidedData to request that this message be called.
Declaration
Swift
func onCustomerProvidedDataEvent(_ event: CustomerProvidedDataEvent)
-
Called when a Custom Activity sends a message to the POS.
Declaration
Swift
func onMessageFromActivity(_ response: MessageFromActivity)
Parameters
response
The message.
-
Called in response to a RetrievePayment() request.
Declaration
Swift
func onRetrievePaymentResponse(_ response: RetrievePaymentResponse)
Parameters
response
The response to the request.
-
Called in response to a RetrieveDeviceStatus() request.
Declaration
Swift
func onRetrieveDeviceStatusResponse(_ response: RetrieveDeviceStatusResponse)
Parameters
response
The response to the request.
-
Called in response to a DisplayReceiptOptionsRequest
Declaration
Swift
func onDisplayReceiptOptionsResponse(_ response: DisplayReceiptOptionsResponse)
Parameters
response
Response object of type DisplayReceiptOptionsResponse