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
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 class provides a static method to optionally set the supported card entry methods, options to auto-accept duplicate payment challenges, and a cardNotPresent flag.
Can optionally set any of these flags to create a
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)
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.
Used to create a TokenizeOptions instance with the confirmation being required or not. By default, confirmation is required and will be requested.
val builder = PreAuthRequestIntentBuilder("<posPaymentId>", 5000) builder.tokenizeOptions(PreAuthRequestIntentBuilder.TokenizeOptions.Instance( false // suppressConfirmation )); val intent = builder.build(context)
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)
Updated about 2 months ago