ICloverConnector
public protocol ICloverConnector : AnyObject
The CloverConnector API serves as the interface for connecting to a Clover device.
This document defines the available methods.
-
Declaration
Swift
var CARD_ENTRY_METHOD_MAG_STRIPE: Int { get }
-
Declaration
Swift
var CARD_ENTRY_METHOD_ICC_CONTACT: Int { get }
-
Declaration
Swift
var CARD_ENTRY_METHOD_NFC_CONTACTLESS: Int { get }
-
Declaration
Swift
var CARD_ENTRY_METHOD_MANUAL: Int { get }
-
Declaration
Swift
var CARD_ENTRY_METHODS_DEFAULT: Int { get }
-
Declaration
Swift
var MAX_PAYLOAD_SIZE: Int { get }
-
Adds a Clover Connector listener.
Declaration
Swift
func addCloverConnectorListener(_ cloverConnectorListener: ICloverConnectorListener)
Parameters
cloverConnectorListener
The connection listener.
-
Removes a Clover Connector listener.
Declaration
Swift
func removeCloverConnectorListener(_ cloverConnectorListener: ICloverConnectorListener)
Parameters
cloverConnectorListener
The connection listener.
-
Initializes the connection and starts communication with the Clover device. This is called after the connector is created and listeners have been added to it. initializeConnection() must be called before calling any other method, other than those that add or remove listeners.
Declaration
Swift
func initializeConnection()
-
Requests a Sale transaction (purchase).
Declaration
Swift
func sale(_ saleRequest: SaleRequest)
Parameters
saleRequest
A SaleRequest object containing basic information for the transaction.
-
Requests an Auth transaction. The tip for an Auth can be adjusted through the TipAdjustAuth() call until the batch Closeout is processed. Note: The MerchantInfo.SupportsAuths boolean must be set to true.
Declaration
Swift
func auth(_ authRequest: AuthRequest)
Parameters
authRequest
The request details.
-
Initiates a PreAuth transaction (a pre-authorization for a certain amount). This transaction lets the merchant know whether the account associated with a card has sufficient funds, without actually charging the card. When the merchant is ready to charge a final amount, the POS will call CapturePreAuth() to complete the Payment. Note: The MerchantInfo.SupportsPreAuths boolean must be set to true.
Declaration
Swift
func preAuth(_ preAuthRequest: PreAuthRequest)
Parameters
preAuthRequest
The request details.
-
Marks a PreAuth Payment for capture by a Closeout process. After a PreAuth is captured, it is effectively the same as an Auth Payment. Note: Should only be called if the request’s PaymentID is from a PreAuthResponse.
Declaration
Swift
func capturePreAuth(_ capturePreAuthRequest: CapturePreAuthRequest)
Parameters
capturePreAuthRequest
The request details.
-
Request to increase the amount of an existing pre-auth
Declaration
Swift
func incrementPreAuth(_ incrementPreAuthRequest: IncrementPreauthRequest)
Parameters
amount
The amount by which to increment the pre-authorization
paymentId
The pre-authorization to be incremented
-
Adjusts the tip for a previous Auth transaction. This call can be made until the Auth Payment has been finalized by a Closeout. Note: Should only be called if the request’s PaymentID is from an AuthResponse.
Declaration
Swift
func tipAdjustAuth(_ authTipAdjustRequest: TipAdjustAuthRequest)
Parameters
authTipAdjustRequest
The request details.
-
Voids a transaction.
Declaration
Swift
func voidPayment(_ voidPaymentRequest: VoidPaymentRequest)
Parameters
voidPaymentRequest
A VoidRequest object containing basic information needed to void the transaction.
-
Refunds the full or partial amount of a Payment.
Declaration
Swift
func refundPayment(_ refundPaymentRequest: RefundPaymentRequest)
Parameters
refundPaymentRequest
The request details.
-
Void a payment refund
Declaration
Swift
func voidPaymentRefund(_ request: VoidPaymentRefundRequest)
Parameters
request
The details of the void payment refund
-
Initiates a Manual Refund transaction (a “Refund” or credit that is not associated with a previous Payment).
Declaration
Swift
func manualRefund(_ manualRefundRequest: ManualRefundRequest)
Parameters
manualRefundRequest
A ManualRefundRequest object with the request details.
-
Sends a request to the Clover server to close out all transactions.
Declaration
Swift
func closeout(_ closeoutRequest: CloseoutRequest)
Parameters
closeoutRequest
The request details.
-
Displays the customer-facing receipt options (print, email, etc.) for a Payment on the Clover device.
Declaration
Swift
@available(*, deprecated, message: "Use the new 'displayReceiptOptions(﹚' instead") func displayPaymentReceiptOptions(orderId: String, paymentId: String)
Parameters
orderId
The ID of the Order associated with the receipt.
paymentId
The ID of the Payment associated with the receipt.
-
Display receipt options for a Credit, Refund, or Payment
Declaration
Swift
func displayReceiptOptions(_ receiptOptionsRequest: DisplayReceiptOptionsRequest)
Parameters
receiptOptionsRequest
The request details for the credit, refund, or payment
-
If a signature is captured during a transaction, this method accepts the signature as entered.
Declaration
Swift
func acceptSignature(_ signatureVerifyRequest: VerifySignatureRequest)
Parameters
signatureVerifyRequest
The accepted VerifySignatureRequest the device passed to onVerifySignatureRequest().
-
If a signature is captured during a transaction, this method rejects the signature as entered.
Declaration
Swift
func rejectSignature(_ signatureVerifyRequest: VerifySignatureRequest)
Parameters
signatureVerifyRequest
The rejected VerifySignatureRequest() the device passed to onVerifySignatureRequest().
-
Asks the Clover device to capture card information and request a payment token from the payment gateway. The payment token can be used for future Sale and Auth requests in place of the card details. The merchant account must be configured to allow payment tokens. Note: The MerchantInfo.SupportsVaultCards boolean must be set to true.
Declaration
Swift
func vaultCard(_ vaultCardRequest: VaultCardRequest)
Parameters
vaultCardRequest
The VaultCardRequest details, including the card entry methods allowed to capture the payment token. If the card entry methods are null, the default values (CARD_ENTRY_METHOD_MAG_STRIPE, CARD_ENTRY_METHOD_ICC_CONTACT, and CARD_ENTRY_METHOD_NFC_CONTACTLESS) will be used.
-
Sends a print request using the PrintRequest object. Used to print text, images, and images from a URL using the specified printer.
Declaration
Swift
func print(_ request: PrintRequest)
Parameters
request
The PrintRequest details.
-
Queries available printers attached to the Clover device.
Declaration
Swift
func retrievePrinters(_ request: RetrievePrintersRequest)
Parameters
request
The RetrievePrintersRequest details.
-
Queries the status of a print job.
Declaration
Swift
func retrievePrintJobStatus(_ request: PrintJobStatusRequest)
Parameters
request
A PrintJobStatusRequest object containing the request details.
-
Opens the first cash drawer found connected to the Clover device. The reason for opening the cash drawer must be set on OpenCashDrawerRequest.
Declaration
Swift
func openCashDrawer(_ request: OpenCashDrawerRequest)
Parameters
request
The OpenCashDrawerRequest object defining the reason the cash drawer is being opened, and an optional device identifier.
-
Displays a string-based message on the Clover device’s screen.
Declaration
Swift
func showMessage(_ message: String)
Parameters
message
The string message to display.
-
Sends request to the clover device to send the log to the clover server
Declaration
Swift
func sendDebugLog(_ message: String)
Parameters
message
The message to send
-
Displays the welcome screen on the Clover device.
Declaration
Swift
func showWelcomeScreen()
-
Displays the thank you screen on the Clover device.
Declaration
Swift
func showThankYouScreen()
-
Displays an Order and associated lineItems on the Clover device. Will replace an Order that is already displayed on the device screen.
Declaration
Swift
func showDisplayOrder(_ order: DisplayOrder)
Parameters
order
The Order to display.
-
Removes the DisplayOrder object from the Clover device’s screen.
Declaration
Swift
func removeDisplayOrder(_ order: DisplayOrder)
Parameters
order
The Order to remove.
-
Sends a request to reset the Clover device back to the welcome screen. Can be used when the device is in an unknown or invalid state from the perspective of the POS. Note: This request could cause the POS to miss a transaction or other information. Use cautiously as a last resort.
Declaration
Swift
func resetDevice()
-
Sends a keystroke to the Clover device that invokes an input option (OK, CANCEL, DONE, etc.) on the customer’s behalf. InputOptions are on the CloverDeviceEvent passed to onDeviceActivityStart().
Declaration
Swift
func invokeInputOption(_ inputOption: InputOption)
Parameters
inputOption
The input option to invoke.
-
Requests card information (specifically Track 1 and Track 2 card data).
Declaration
Swift
func readCardData(_ request: ReadCardDataRequest)
Parameters
request
The ReadCardDataRequest details.
-
If Payment confirmation is required during a transaction due to a Challenge, this method accepts the Payment. A Challenge may be triggered by a potential duplicate Payment or an offline Payment.
Declaration
Swift
func acceptPayment(_ payment: CLVModels.Payments.Payment)
Parameters
payment
The Payment to accept.
-
If Payment confirmation is required during a transaction due to a Challenge, this method rejects the Payment. A Challenge may be triggered by a potential duplicate Payment or an offline Payment.
Declaration
Swift
func rejectPayment(_ payment: CLVModels.Payments.Payment, challenge: Challenge)
Parameters
payment
The Payment to reject.
challenge
The Challenge that resulted in Payment rejection.
-
Retrieves a list of unprocessed Payments that were taken offline and are pending submission to the server.
Declaration
Swift
func retrievePendingPayments()
-
Disposes the connection to the Clover device. After this is called, the connection to the device is severed, and the CloverConnector object is no longer usable. Instantiate a new CloverConnector object in order to call initializeConnection().
Declaration
Swift
func dispose()
-
Starts a Custom Activity on the Clover device.
Declaration
Swift
func startCustomActivity(_ request: CustomActivityRequest)
Parameters
request
The CustomActivityRequest details.
-
Sends a message to a Custom Activity running on a Clover device.
Declaration
Swift
func sendMessageToActivity(_ request: MessageToActivity)
Parameters
request
The MessageToActivity request with the message to send to the Custom Activity.
-
Sends a message requesting the current status of the Clover device.
Declaration
Swift
func retrieveDeviceStatus(_ _request: RetrieveDeviceStatusRequest)
Parameters
request
The RetrieveDeviceStatusRequest details.
-
Requests the Payment information corresponding to the externalPaymentId passed in. Only valid for Payments made in the past 24 hours on the Clover device queried.
Declaration
Swift
func retrievePayment(_ _request: RetrievePaymentRequest)
Parameters
request
The RetrievePaymentRequest details.
-
Requests that callbacks be provided whenever customer provided data is accrued via the Loyalty API. Provides a list of acceptable data types that the Loyalty API may request from the customer.
Declaration
Swift
func registerForCustomerProvidedData(_ _request: RegisterForCustomerProvidedDataRequest)
-
Provides customer information back to the Clover device. Typically this will be called upon receipt of a customer provided data message, with the results of a lookup into a customer database.
Declaration
Swift
func setCustomerInfo(_ _request: SetCustomerInfoRequest?)