Capture a pre-auth

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)

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:

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.

Simple example to 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)

ReceiptOptions

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

Static MethodDescription
Instance(skipReceiptSelection:Boolean)Can optionally configure the flow to skip the receipt selection.

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)

Custom card entry methods

Example of setting the card entry methods to Manual, ICC/EMV, and NFC only.

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

var cardEntryMethods = setOf<CardEntryMethod>(
   CardEntryMethod.MANUAL, 
   CardEntryMethod.EMV, 
   CardEntryMethod.NFC)

var cardOptions = CapturePreAuthRequestIntentBuilder.CardOptions.Instance(
   cardEntryMethods,
   null, // card not present
   null) // auto accept duplicates

builder.cardOptions(cardOptions)
  
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())