ON HOLD - Credit (card present only)
United States
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
(noKeyedInCard
details are allowed for credits)
For information about payment methods, see Payments.
Prerequisites
Before you integrate with the Go SDK, complete the following:
- Create a global developer account with a default test merchant account.
- Create additional test merchants, if needed.
- Create an app in the sandbox.
- Create at least one employee role user for the OAuth flow.
- Order a Clover Go reader Developer Kit (Dev Kit) and set it up.
Field descriptions
CreditRequest
Field | Required | Type | Description |
---|---|---|---|
amount | true | Int64 | Amount in cents to be credited to the credit card. Format: Cents; Cannot be null, zero (0), or a negative value Maximum amount = 999999999. |
OrderId | false | String | 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 |
deviceOptions | false | DevicePaymentOptions | See DevicePaymentOptions for details. |
CreditResponse
Field | Type | Description |
---|---|---|
credit | Credit | Credit 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 thePayResponse
. - Error such as a timeout returns
OnCreditPaymentError
.
- Successful request returns
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
Field | Description |
---|---|
OnPaymentChallenge | Indicates a paymentChallenge needs to be addressed and is waiting on delegator to respond back. See Types of PaymentChallenge for details. |
OnPaymentError | Indicates a successful payment. Review PayResponse for the successful payment details. |
OnCreditPaymentError | Indicates 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)
}
}
}
Updated 7 months ago