Closeout
United States
Use the CloseoutRequestIntentBuilder
class to build an Intent to initiate an activity to manually closeout the current batch of transactions.
Prerequisites
- Read overview of the Clover platform.
- Create a global developer account with a default test merchant account.
- Order a Clover Developer Kit (Dev Kit) and set it up.
- Use the required Android SDK versions.
Steps
- Build a closeout request.
val builder = CloseoutRequestIntentBuilder()
val intent = builder.build(context)
- Use the Intent to initiate the closeout process.
TipOptions
The TipOptions
class provides static methods to customize the handling of open tip-adjustable payments.
Method | Description |
---|---|
ZeroOutOpenTips() | For open payments, autopopulates all open payments with a tip amount = 0. |
PromptForOpenPayments() | For open payments, prompts the merchant to manually enter tip amounts. |
ReturnOpenPayments() | For open payments, returns payment IDs of outstanding open payments. |
Note
A closeout will not be queued if there are open payments.
Example—Zero out all open tips
Zeroing out of all open tips is a headless process without the user interface.
val builder = CloseoutRequestIntentBuilder()
val tipOptions = CloseoutRequstIntentBuilder.TipOptions.ZeroOutOpenTips()
val intent = builder.tipOptions(tipOptions).build(context)
Example—Prompt for Open Payments
val builder = CloseoutRequestIntentBuilder()
val tipOptions = CloseoutRequstIntentBuilder.TipOptions.PromptForOpenPayments()
val intent = builder.tipOptions(tipOptions).build(context)
Additional field
Additional field for the CloseoutRequestIntentBuilder
class is:
Field | Description |
---|---|
leavePreauthsOpen: Boolean | Indicates whether to keep authorizations open through closeout. |
Response details
When the closeout flow completes, the response is available through onActivityResult()
.
- For a successful request, retrieve the
Batch
object using the Intent:CloseoutRequestIntentBuilder.Response.BATCH
- For an unsuccessful request, retrieve the failure message using the Intent:
CloseoutRequestIntentBuilder.Response.FAILURE_MESSAGE
CloseoutRequestIntentBuilder.Response.PAYMENT_IDS
if the intent fails because of open payments.
Response example
fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == CLOSEOUT_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
val batch: Batch = data?.getParcelableExtra<Batch>(CloseoutRequestIntentBuilder.Response.BATCH) as Batch
val closeoutResult = data?.getStringExtra(CloseoutRequestIntentBuilder.Response.CLOSEOUT_RESULT)
} else {
// closeout failed, check for error
val failureMessage = data?.getStringExtra(CloseoutRequestIntentBuilder.Response.FAILURE_MESSAGE)
val closeoutResult = data?.getStringExtra(CloseoutRequestIntentBuilder.Response.CLOSEOUT_RESULT)
val paymentIds = data?.getStringArrayListExtra(CloseoutRequestIntentBuilder.Response.PAYMENT_IDS)
}
}
}
Updated about 1 month ago