ON HOLD - Credit (card present only)

Types of refunds are:

  • Payments reversal—Reverse the original payment to return funds to the customer. When you make these requests, provide a paymentID as a reference to the payment that needs reversal.
  • Credit—Return funds to a customer without an existing payment. If there is an existing payment, use a Reversal request to return funds to customers.
  • Online Refund Authorization—Refunds and credits are subject to approval or decline by the processor. Configure your app to handle all potential scenarios.

To create a card present payment:

  • Connect the card reader and ensure it has more than 2% of battery power.
  • Use CreditRequest (no KeyedInCard details are allowed for credits)

For information about payment methods, see Payments.

Prerequisites

Field descriptions

CreditRequest

FieldRequiredTypeDescription
amounttrueInt64

Amount in cents to be credited to the credit card.

Format: Cents; Cannot be null, zero (0), or a negative value

Maximum amount = 999999999.

OrderIdfalseString

Clover-assigned, universally unique identifier (UUID) of the order, for which credit is requested.

This value is always null, and in this case, the SDK creates an empty order ID.

Length: Maximum 13

deviceOptionsfalseDevicePaymentOptionsSee DevicePaymentOptions for details.

CreditResponse

FieldTypeDescription
creditCreditCredit details are autopopulated on a successful credit.

Android

To create a credit payment to a credit card:

  • Create a CreditRequest.
    • Successful request returns OnCreditPaymentComplete with the PayResponse.
    • Error such as a timeout returns OnCreditPaymentError.

You may receive a PaymentChallenge. Expect the delegator to respond to the challenge request. The delegator can cancel the challenge and void the payment or act on the challenge before a timeout and proceed with the payment.

Response details

ChargeCardReaderState

FieldDescription
OnPaymentChallengeIndicates a paymentChallenge needs to be addressed and is waiting on delegator to respond back.
See Types of PaymentChallenge for details.
OnPaymentErrorIndicates a successful payment.
Review PayResponse for the successful payment details.
OnCreditPaymentErrorIndicates an error and the payment is voided.

CreditRequest example

fun requestCredit(request: CreditRequest): SharedFlow<ChargeCardReaderState>
override fun sendCreditRequest(amount: Long, deviceOptions: MutableList<CardEntryMethod>?) {
        /** Order will be created by SDK as a new order.
            As of now, integrators don't have a way to create an empty order and pass Clover Order UUID **/
        val orderId = null
 
        val deviceCreditOptions = if (deviceOptions == null) {
            null
        } else {
            DeviceCreditOptions(
                cardEntryMethods = deviceOptions
            )
        }
 
        val request = CreditRequest(
            amount = amount,
            orderId = orderId,
            deviceOptions = deviceCreditOptions
        )
 
        goSdk.requestCredit(
            viewLifecycleOwner,
            request,
            chargeCardReaderStateCallback
        )
 
 
        /** goSdk.requestCredit(creditRequest).collect {
                result = it
                when (it) {
                    is ChargeCardReaderState.OnOnCardReaderApplicationSelect -> onCardReaderApplicationSelector = it.selector
                    else -> Unit /** log info **/
                }
            } **/
 
 
    }
 
 
    private val chargeCardReaderStateCallback = object : GoSdkCallback<ChargeCardReaderState> {
        override fun onError(e: Throwable) {
            Timber.e(e)
            binding.transactionStateTextview.text = "Error on Transaction: ${e.message}"
        }
 
        override fun onNext(result: ChargeCardReaderState) {
            if (result is ChargeCardReaderState.OnPaymentComplete) {
                binding.paymentIdEditText.editText?.setText(result.response.payment?.id)
            }
 
            binding.transactionStateTextview.text = when (result) {
                is ChargeCardReaderState.OnCreditPaymentComplete -> "ChargeCardReaderState.OnCreditPaymentComplete: ${result.response}"
                is ChargeCardReaderState.OnCreditPaymentError -> "ChargeCardReaderState.OnCreditPaymentError: ${result.error}"
                is ChargeCardReaderState.OnOnCardReaderApplicationSelect -> "ChargeCardReaderState.OnOnCardReaderApplicationSelect"
                is ChargeCardReaderState.OnReaderPaymentProgress -> "ChargeCardReaderState.OnReaderPaymentProgress: ${result.event}"
                else -> Timber.i("ChargeCardReaderState UNKNOWN!!!!!: $result)
            }
        }
    }