Capture a pre-auth

United States

Use the CapturePreAuthRequestIntentBuilder class to build an Intent to start an Activity that will guide a user through the capturing a pre-auth steps. The steps may include tip selection, signature collection, payment confirmation, and receipt selection. These options can be customized through the merchant settings or by using options that can be configured on the CapturePreAuthRequestIntentBuilder.

You can build a payment request with a few lines of code.

val paymentId = payment.id // id of a preauth payment
val amount = 1200L // capture amount
val context = this

val builder = CapturePreAuthRequestIntentBuilder(externalPaymentId, amount)
val intent = builder.build(context)
Context context = this;
String paymentId = payment.id; // id of a preauth payment
Long amount = 1200L; // capture amount
 
CapturePreAuthRequestIntentBuilder builder = new CapturePreAuthRequestIntentBuilder(paymentId, amount);
Intent intent = builder.build(context);

The Intent can then be used to start the activity to process the capture pre-auth request.

There are several options that can be set on the builder to provide additional processing instructions:

Prerequisites

TipOptions & SignatureOptions

TipOptions & SignatureOptions are independent options that can be excluded, however, they share the same “location” value (on screen/on paper).

TipOptions

The TipOptions class provides static helper methods to simplify the creation of TipOptions.

MethodDescription
Disable()Sets the options so no tip is requested.
Provided(tipAmount: Long)If the tip amount is known before the payment request, this will add the tip amount to the payment and the payment will be finalized.
PromptCustomer( baseAmount: Long, tipSuggestions: List<TipSuggestion>)Use to set the amount used to calculate the percentage-based tips or override the tip suggestions with fixed amounts or custom percentages.

📘

NOTE

The merchant’s payment gateway settings must be configured for tippable payment for a tip-adjustable payment to be created. On some devices, tips are taken prior to the payment and can be supported without merchant payment gateway settings, as the payment will be finalized by the gateway.

SignatureOptions

The SignatureOptions class provides static helper methods to simplify the creation of SignatureOptions.

MethodDescription
Disable()Set the options so no signature is requested.
PromptCustomer()Use to override the merchant settings for when and if, to prompt for a signature.

Example—Disable tip and signature for a payment

val builder = CapturePreAuthRequestIntentBuilder("<posPaymentId>", 1200)
builder.tipAndSignatureOptions(
   CapturePreAuthRequestIntentBuilder.TipOptions.Disable(),
   CapturePreAuthRequestIntentBuilder.SignatureOptions.Disable(),
   null) // preferOnScreen

val intent = builder.build(context)
CapturePreAuthRequestIntentBuilder builder = new CapturePreAuthRequestIntentBuilder("<posPaymentId>", 1200);
builder.tipAndSignatureOptions(
            CapturePreAuthRequestIntentBuilder.TipOptions.Disable(),
            CapturePreAuthRequestIntentBuilder.SignatureOptions.Disable(),
            null); // preferOnScreen
 
Intent intent = builder.build(context);

ReceiptOptions

The ReceiptOptions class currently only provides one option, to skip the receipt selection screen.

Static MethodDescription
Default(cloverShouldHandleReceipts: Boolean)Sets handling of printing or sending SMS/Email receipts.
SkipReceiptSelection()Configures the flow to skip the receipt selection.
Instance ( cloverShouldHandleReceipts : Boolean, smsReceiptOption : SmsReceiptOption, emailReceiptOption : EmailReceiptOption, printReceiptOption : PrintReceiptOption, noReceiptOption : NoReceiptOption)Allows disabling or enabling of every receipt selection button on the receipt screen. In addition, this can be used to decide if Clover should handle the printing or sending of SMS/Email receipts.

Example—Deactivate SMS and email receipt buttons and set cloverShouldHandleReceipts to true.

val amount = 1000L
val paymentId = "<paymentId-of-preauth-to-be-captured>"
val builder = CapturePreAuthRequestIntentBuilder(paymentId, amount)
val receiptOptions = CapturePreAuthRequestIntentBuilder.ReceiptOptions.Instance(
                true,
                CapturePreAuthRequestIntentBuilder.ReceiptOptions.SmsReceiptOption.Disable(),
                CapturePreAuthRequestIntentBuilder.ReceiptOptions.EmailReceiptOption.Disable(),
                CapturePreAuthRequestIntentBuilder.ReceiptOptions.PrintReceiptOption.Enable(),
                CapturePreAuthRequestIntentBuilder.ReceiptOptions.NoReceiptOption.Enable())
val capturePreauthRequestIntent = builder.receiptOptions(receiptOptions).build(context)
Long amount = 1000L;
String paymentId = "<paymentId-of-preauth-to-be-captured>";
CapturePreAuthRequestIntentBuilder builder = new CapturePreAuthRequestIntentBuilder(paymentId, amount);
CapturePreAuthRequestIntentBuilder.ReceiptOptions receiptOptions = CapturePreAuthRequestIntentBuilder.ReceiptOptions.Instance(
            true,
            CapturePreAuthRequestIntentBuilder.ReceiptOptions.SmsReceiptOption.Disable(),
            CapturePreAuthRequestIntentBuilder.ReceiptOptions.EmailReceiptOption.Disable(),
            CapturePreAuthRequestIntentBuilder.ReceiptOptions.PrintReceiptOption.Enable(),
            CapturePreAuthRequestIntentBuilder.ReceiptOptions.NoReceiptOption.Enable());
Intent capturePreauthRequestIntent = builder.receiptOptions(receiptOptions).build(context);

Result on the device

1280

Capture a pre-auth: Receipt screen

Additional fields

Additional fields for theCapturePreAuthRequestIntentBuilder classes are:

FieldDescription
amount: LongCaptured amount
paymentId: StringPayment ID of the captured preauth

Examples

Custom tips

Example of creating custom tip options of $1.00, $2.00, and 20% and prefer onScreen tips.

val builder = CapturePreAuthRequestIntentBuilder("<posPaymentId>", 1200)

var tipSuggestions = listOf<TipSuggestion>(
   TipSuggestion.Amount("Thanks!", 100),
   TipSuggestion.Amount("Good Job!", 200),
   TipSuggestion.Percentage("Great!", 20)
)
var tipOptions = CapturePreAuthRequestIntentBuilder.TipOptions.PromptCustomer(null, tipSuggestions)

builder.tipAndSignatureOptions(
   tipOptions,
   null, // signature options
   true) // preferOnScreen

val intent = builder.build(context)

Minimal interaction

Example reducing the screens to only the payment screen. This example disables tips, signatures, and payment confirmations, and skips the receipt screen.

val builder = PaymentRequestIntentBuilder("<posPaymentId>", 1200)
builder.tipAndSignatureOptions(
   PaymentRequestIntentBuilder.TipOptions.Disable(),
   PaymentRequestIntentBuilder.SignatureOptions.Disable(),
   true)
builder.cardOptions(
   PaymentRequestIntentBuilder.CardOptions.Instance(
       null,
       null,
       true))
builder.receiptOptions(PaymentRequestIntentBuilder.ReceiptOptions.Disable())
CapturePreAuthRequestIntentBuilder builder = new CapturePreAuthRequestIntentBuilder("<paymentId-of-preauth-to-be-captured>", 1200);
builder.tipAndSignatureOptions(
            CapturePreAuthRequestIntentBuilder.TipOptions.Disable(),
            CapturePreAuthRequestIntentBuilder.SignatureOptions.Disable(),
            true);
builder.receiptOptions(CapturePreAuthRequestIntentBuilder.ReceiptOptions.SkipReceiptSelection());
Intent intent = builder.build(context);