processPaymentIntent

suspend fun Terminal.processPaymentIntent(intent: PaymentIntent, collectConfig: CollectPaymentIntentConfiguration = CollectPaymentIntentConfiguration.Builder().build(), confirmConfig: ConfirmPaymentIntentConfiguration = ConfirmPaymentIntentConfiguration.Builder().build()): PaymentIntent

Return

The processed PaymentIntent

Parameters

intent

The PaymentIntent to process

collectConfig

Configuration for the payment method collection process

confirmConfig

Configuration for the confirmation process

See also

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

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

Example usage:

val job = coroutineScope.launch {
try {
val processedIntent = terminal.processPaymentIntent(
paymentIntent,
collectConfig,
confirmConfig
)
// Handle successful processing
} catch (e: TerminalException) {
// Handle processing failure
}
}

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

Throws

if the processing operation fails