processSetupIntent

suspend fun Terminal.processSetupIntent(intent: SetupIntent, allowRedisplay: AllowRedisplay, collectConfig: CollectSetupIntentConfiguration = CollectSetupIntentConfiguration.Builder().build()): SetupIntent

Return

The processed SetupIntent

Parameters

intent

The SetupIntent to process

allowRedisplay

Controls whether the payment method can be redisplayed for future payments

collectConfig

Configuration for the payment method collection process

See also

Processes a SetupIntent by collecting the payment method and confirming it.

This is a convenience method that combines collectSetupIntentPaymentMethod and confirmSetupIntent into a single operation. This suspend function integrates with Kotlin's structured concurrency. If the coroutine calling this function is cancelled, the underlying setup processing operation will automatically be cancelled as well.

Example usage:

val job = coroutineScope.launch {
try {
val processedIntent = terminal.processSetupIntent(
setupIntent,
AllowRedisplay.ALWAYS,
collectConfig
)
// Handle successful processing
} catch (e: TerminalException) {
// Handle processing failure
}
}

// Cancelling the job will cancel the setup processing operation
job.cancel()

Throws

if the processing operation fails