Accept a pre-auth

Use the PreAuthRequestIntentBuilder class to build an Intent to start an Activity that will guide a user through a pre-auth payment steps. The resulting pre-auth payment needs to be captured with a CapturePreAuth Request. The steps may include payment confirmation and receipt selection. These options can be customized through the merchant settings or by using options that can be configured on the PreAuthRequestIntentBuilder.

Build a simple pre-auth request

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

val externalPaymentId = "<posPaymentId>" // should be unique for each request
val amount = 5000L
val context = this

val builder = PreAuthRequestIntentBuilder(externalPaymentId, amount)
val intent = builder.build(context)

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

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

  • CardOptions - settings for supported card entry methods and card confirmations
  • TokenizeOptions - settings for pay+tokenize card for use in e-commerce services

CardOptions

The CardOptions class provides a static method to optionally set the supported card entry methods, options to auto-accept duplicate payment challenges, and a cardNotPresent flag.

Static Method

Description

Instance(
   cardEntryMethods : Set<CardEntryMethod>,
   cardNotPresent : Boolean,
   autoAcceptDuplicates : Boolean)

Can optionally set any of these flags to create a CardOptions instance. If null is passed, the default settings for the merchant will be used.

Example setting the card entry method to Manual only and auto-accept duplicate challenges

val builder = PreAuthRequestIntentBuilder("<posPaymentId>", 5000)

builder.cardOptions(
   PreAuthRequestIntentBuilder.CardOptions.Instance(
       CardEntryMethod.Manual(), // manual only
       null, // card not present
       true)) // auto-accept duplicates

val intent = builder.build(context)

Tokenize Options

The TokenizeOptions class contains a single property, suppressConfirmation. However, the presence of TokenizeOptions, regardless of the suppressConfirmation value, indicates that a token for the payment card used should be generated. The tokenize option is secondary to the payment, so, a failed tokenization could still result in a successful payment but a failed payment will not result in a successful tokenization.

Value

Description

Instance(suppressConfirmation:boolean)

Used to create a TokenizeOptions instance with the confirmation being required or not. By default, confirmation is required and will be requested.

Example of requesting a payment token with a payment

val builder = PreAuthRequestIntentBuilder("<posPaymentId>", 5000)

builder.tokenizeOptions(PreAuthRequestIntentBuilder.TokenizeOptions.Instance(
   false // suppressConfirmation
));

val intent = builder.build(context)

Examples of custom card entry methods

These examples set the card entry methods to Manual, Swipe, and NFC only.

val builder = PreAuthRequestIntentBuilder("<posPaymentId>", 5000)

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

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

builder.cardOptions(cardOptions)

val intent = builder.build(context)

Did this page help you?