Capture and tip adjust

United States

For information about payment methods, see Payments.

Prerequisites

Before you integrate with the Go SDK, complete the following:

  • Claim your Clover account and log in with your Clover credentials so that you can use the Clover standard OAuth flow for authentication.
  • Create and set up a developer account (including your test merchant settings) and an app in Clover sandbox Developer Dashboard.
  • Create at least one employee user to use within the OAuth flow.
  • Order a Clover Go Card Reader Developer Kit (Dev Kit) and set it up.

Field descriptions

TipAdjustRequest fields

FieldRequiredTypeDescription
paymentIdtrueStringClover-assigned universally unique identifier (UUID) of the payment, to which the tip is added.
Minimum and Maximum length: 13 characters

Note: The paymentId displays in the Payment details in PayResponse for which a successful Auth/pre-auth PayRequest was sent.
tiptrueInt64Tip amount in cents.

Format: Cents; cannot be a negative or zero value.

Maximum amount = 999999999

CaptureRequest fields

FieldRequiredTypeDescription
paymentIdtrueStringClover-assigned universally unique identifier (UUID) of the payment, to which the tip is added.

Minimum and Maximum length: 13 characters

Note: The paymentId displays in the Payment details in PayResponse for which a successful auth/pre-auth PayRequest was sent.
amounttrueInt64Total amount payment from pre-auth transaction in cents including taxes.

Format: Cents; cannot be a negative value.

Maximum amount = 999999999.
tipAmounttrueInt64Tip amount in cents.

Format: Cents; cannot be a negative or zero value.

Maximum amount = 999999999.

Android

TipAdjust

To adjust a tip for an open auth or pre-auth payment, enter values in the tipAdjust request parameters. See the TipAdjustRequest.

The following are the response scenarios for the TipAdjustState:

  • Successful request returns the OnComplete state.
  • Invalid input error returns the OnError state with a GenericTransactionError.

TipAdjust request example

fun tipAdjust(request: TipAdjustRequest): Flow<TipAdjustState>
lifecycleScope.launch {
    val request = TipAdjustRequest(
        tip = tipAmount,
        paymentId = paymentId
    )
    goSdk.tipAdjust(
        request
    ).collectLatest { tipAdjustState ->
 
        when(tipAdjustState) {
            is TipAdjustState.OnError -> {
                println("Tip adjust failed: ${tipAdjustState.error}")
                updateUI(tipAdjustState)
            }
            is TipAdjustState.OnComplete -> {
                println("Tip adjust succeeded: ${tipAdjustState.response}")
                updateUI(tipAdjustState)
            }
            else -> {
                //Something unexpected happened
            }
        }
    }
}

Capture

After a pre-auth is tipAdjusted, capture all the pre-auth payment(s).

To capture a pre-auth payment, enter values in the CaptureRequest parameters. See the CaptureRequest.

The following are the response scenarios for the CaptureState:

  • Successful request returns the OnComplete state with a Payment object.

  • Invalid input error returns the OnError state with a GenericTransactionError.

Capture example

fun capture(request: CaptureRequest): Flow<CaptureState>
lifecycleScope.launch {
    val request = TipAdjustRequest(
        tip = tipAmount,
        paymentId = paymentId
    )
    goSdk.tipAdjust(
        request
    ).collectLatest { tipAdjustState ->
 
        when(tipAdjustState) {
            is TipAdjustState.OnError -> {
                println("Tip adjust failed: ${tipAdjustState.error}")
                updateUI(tipAdjustState)
            }
            is TipAdjustState.OnComplete -> {
                println("Tip adjust succeeded: ${tipAdjustState.response}")
                updateUI(tipAdjustState)
            }
            else -> {
                //Something unexpected happened
            }
        }
    }
}

iOS

TipAdjust

To adjust a tip for an open auth or pre-auth payment, enter values in the tipAdjust request parameters. See the TipAdjustRequest.

The following are the response scenarios for the TipAdjustState:

  • Successful request returns the .success result and the TipAdjustResponse.
  • Invalid input error returns the .failure result and a CLVGoError.

TipAdjust example

let tipRequest = TipAdjustRequest(tip: 400, paymentId: "123456789ABCD")
 
do {
   let tipAdjustResponse = try await CloverPaymentSDK.shared.tipAdjust(tipAdjustRequest:tipRequest)
   print("Tip adjust successful")
} catch {
   print("Tip adjust failure: \(error)")
}

Capture

To capture a pre-auth payment, enter values in the CaptureRequest parameters. See the CaptureRequest.

Note: You can add tipAmount optionally at the time of capture. See the TipCapture example. You can also request an independent tip adjustment after capture but before closeout. See TipAdjust example.

The following are the response scenarios for the CaptureState:

  • Successful request returns a .success result with CaptureResponse.

  • Invalid input error returns a .failure result and a CLVGoError.

Capture example

var captureRequest = CaptureRequest(amount: 2000, paymentId: "123456789ABCD")          
 
do {
   let captureResponse = try await CloverPaymentSDK.shared.capture(captureRequest: captureRequest)
   print("Capture successful")
} catch {
   print("Capture failure: \(error)")
}