Getting started with Clover Connector

The Clover Connector SDK

The Clover Connector SDK provides a consolidated asynchronous interface that enables your point-of-sale (POS) software to interact with Clover’s customer-facing payment devices.

ICloverConnector provides the callable interface. Some of its capabilities include:

  • Processing cards as:
    • Sales – Fixed-amount payments
    • Auths – Tip-adjustable payments
    • PreAuths – Pre-authorizations for a specific amount that can be updated before finalizing payment
  • Vaulting card tokens for future payments
  • Processing payment refunds and voids
  • Displaying order details
  • Printing images and text
  • Requesting batch closeouts
  • Requesting device and payment status
  • Starting and communicating with Custom Activities

ICloverConnectorListener provides the callback interface. Some of the events that will call back on ICloverConnectorListener include:

  • Responses to sales, authorizations, and pre-authorizations
  • Responses to card vaulting requests
  • Responses to payment refunds and voids
  • Responses to tip amount adjustments and captured payments for pre-authorizations
  • UI event messages sent as the Clover device changes screens, along with appropriate actions correlating to options on the device (e.g., Cancel, Ok, Done, Yes, No, etc.)
  • Closeout processing events
  • Requests to confirm payments or signatures
  • Events sent when the device disconnects, connects, or is ready
  • Responses to device and payment status requests
  • Responses or messages from Custom Activities

This tutorial will guide you through the process of connecting to your Clover device, initiating a Sale request, and handling the response to your Sale request.


The tutorial assumes you have already:

pod 'CloverConnector', :git => '', :tag => '1.3.1-RC1'



The iOS SDK currently supports network tethering via WebSockets only. The Network Pay Display app must be installed and running on the Clover device.

Configure a connection

Connect your iOS device to the Clover device:

  1. Download the Network Pay Display application onto the Clover device.
  2. Pair the two devices.
    1. Connect your POS to the Clover device. The Clover device will send a pairing code to the POS.
    2. Enter the code your POS received on the Clover device.

The Clover device will send a pairingAuthToken to the POS. The POS uses the pairingAuthToken for the next connection, streamlining the pairing process.

The pairingAuthTokens are single-use. Clover will expire the original pairingAuthToken and send a new one to your POS for each connection.


For a secure connection, you must import the Clover root CA on the iOS device.

 /// To connect over a network, you will need a PairingDeviceConfiguration class
        /// to handle pairing callbacks from the Clover device
        class ExamplePairingDeviceConfig : PairingDeviceConfiguration {
            @objc private func onPairingCode(pairingCode: String) {
                // present pairingCode to the user to be entered on the Clover Device
            @objc private func onPairingSuccess(authToken: String) {
                // The authToken can be used for the next connection
                // WebSocketDeviceConfiguration (see pairingAuthToken below)

        let pdc = ExamplePairingDeviceConfig()
        // ws vs wss must match Network Pay Display setting
        // wss requires Clover root CA
        let endpoint = "ws://" 
        // Network Pay Display must be installed and configured to allow 
        // insecure connections for the above configuration

        // Create a WebSocketDeviceConfiguration with the appropriate
        // remoteApplicationID (see above), POS name, and POS serial number
        let configuration = WebSocketDeviceConfiguration(endpoint: endpoint,
                                                // remoteApplicationID, posName and 
                                                // posSerial are associated with
                                                // pairingAuthToken
                                                remoteApplicationID: <remoteApplicationID>, 
                                                posName: "Aisle 2",
                                                posSerial: "ABC123",
                                                pairingAuthToken: nil, // use token from onPairingSuccess callback
                                                pairingDeviceConfiguration: pdc)

Create a Clover Connector

Create a Clover Connector and pass in the configuration from the previous step.

/// Use instance of WebSocketDeviceConfiguration
        cloverConnector = CloverConnector(config: configuration)


Add a listener to the Clover Connector

1. Define an ICloverConnectorListener that will listen for callbacks when transactions finish and other events occur. Include the connection status methods that will be called.

  • OnDeviceDisconnected() – The Clover device is not available.
  • OnDeviceConnected() – The Clover device is connected, but not available to process requests.
  • OnDeviceReady() – The device is connected and available to process requests. It will automatically pass in a MerchantInfo object with information about the device, merchant, and some potential merchant payment configuration data, such as supportsAuths or supportsVaultCards.


// Create an implementation of ICloverConnectorListener
        class ExampleCloverConnectorListener : DefaultCloverConnectorListener {
            override func onDeviceDisconnected() {
                // Disconnected
            override func onDeviceConnected() {
                // Connected, but not available to process requests
            override func onDeviceReady(merchantInfo: MerchantInfo) {
                // Connected and available to process requests

2. Add the listener to the Clover Connector.


// Add an instance of an ICloverConnectorListener
        let ccl = ExampleCloverConnectorListener(cloverConnector: cloverConnector)

Initialize the connection

Initialize the connection to start communication with the Clover device. Note that you must do this before calling any other methods (other than those that add or remove listeners).



Display a message on the Clover device

Send a test message to the Clover device.

cloverConnector.showMessage("Welcome to Clover Connector!")


Now that you’ve connected to the Clover device and sent a successful test message, you’re ready to start making requests.

Initiate a Sale from your POS software

To make a Sale() request:

1. Define how to handle the SaleResponse in your ICloverConnectorListener. The truncated code below provides a generalized overview of the methods you’ll need to use to get a response to your request for a Sale. (A detailed interpretation of the SaleResponse appears in the Handling the result of a Sale transaction section below.)


public class ExampleCloverConnectorListener:DefaultCloverConnectorListener {
      public override func onSaleResponse(_ response:SaleResponse){
            // check response for success and process accordingly
            // see the ‘Handling the Result of a Sale Transaction’ section below for more detail
      public override func onConfirmPaymentRequest(){
            // must accept or reject the payment using the ICloverConnector
            // see the ‘Handling the Result of a Sale Transaction’ section below for more detail
      public override func onVerifySignatureRequest(_ request:VerifySignatureRequest) {
            // must accept or reject the signature using the ICloverConnector
            // see the ‘Handling the Result of a Sale Transaction’ section below for more detail 


2. Create a SaleRequest and call the Sale() method.


/// hold the pendingPaymentId to track the payment within Clover
self.pendingPaymentId = "\(NSUUID())".stringByReplacingOccurrencesOfString("-", withString: "")
let saleRequest = SaleRequest(amount: 2250, externalId: pendingPaymentId!)



The code snippets in this tutorial are not feature-rich. For the best way to implement the SDK in production, see the Example iOS POS.

Once you call the Sale() method, Clover will contact the payment gateway and return information about the result of the transaction to your POS.

Handling the result of a Sale transaction

After Clover has finished processing the Sale transaction request, OnSaleResponse() will be called. Transaction responses have a boolean Success property, as well as an enum Result property that provides information on the success flag.

If the transaction is successful, the response will also have the Payment object, which may contain the full or partial amount of the Sale request.


A Sale transaction may come back as a tip-adjustable Auth, depending on the payment gateway. The SaleResponse includes a boolean isSale variable that indicates whether the Sale is final, or will be finalized during closeout.


class ExampleCloverConnectorListener:DefaultCloverConnectorListener { 
      override func onSaleResponse(response: SaleResponse) {
          if response.success {
              if let payment = response.payment {
                  if pendingPaymentId == payment.externalPaymentId {
                      // it is the expected payment
                      debugPrint("Got the payment for \(payment.amount ?? -1)")
                  } else {
                      debugPrint("Got a response, but not for the expected payment")
              } else {
                  debugPrint("Something went wrong...No payment found!")
          } else {
              debugPrint("Payment failed: \(response.reason):\(response.message)")
          cloverConnector?.dispose() /// if done using the connector, dispose of it
      // a sale may require payment confirmation requests from the Clover device
      override func onConfirmPaymentRequest(request: ConfirmPaymentRequest) {
          // by default, Clover will just accept the payment
          if let payment = request.payment {
          } else {
              debugPrint("Payment is nil in ConfirmPaymentRequest")
      // a sale may require signature verification requests from the Clover device
      override func onVerifySignatureRequest(signatureVerifyRequest: VerifySignatureRequest)       
          // by default, Clover will just accept the signature

Sale transaction errors

OnSaleResponse() will also return one of the following codes.

  • SUCCESS – The call succeeded and was successfully queued or processed.
  • FAIL – The call failed due to an incorrect value that was passed in, an invalid card, insufficient funds, or another reason.
  • UNSUPPORTED – The current merchant configuration doesn’t support the capability.
  • CANCEL – The merchant or customer has pressed the Cancel or Back button on the Clover device.
  • ERROR – An error that wasn’t expected or handled appropriately occurred. This code is returned when the SDK encounters one of the following problems:
    • Device Connection Error – The Clover device is not connected.
    • Request Validation Error – The request that was passed in for processing is empty.
    • Request Validation Error – The request ExternalId cannot be null or blank.
    • Request Validation Error – The request amount cannot be zero.
    • Request Validation Error – The request tip amount cannot be less than zero.
    • Merchant Configuration Validation Error – Not offered by the merchant-configured gateway.

Test your app

Test your app using the Test card numbers for declines and partial transactions.

For information on Clover’s testing requirements, please see the Testing & validation page.

Additional resources