collectSetupIntentPaymentMethod

fun collectSetupIntentPaymentMethod(intent: SetupIntent, allowRedisplay: AllowRedisplay, config: SetupIntentConfiguration = SetupIntentConfiguration.Builder().build(), callback: SetupIntentCallback): Cancelable

Collects a payment method for a SetupIntent.

If collecting a payment method fails, the callback will be called with an error. After resolving the error, you may call collectSetupIntentPaymentMethod again to either try the same card again, or try a different card.

If collecting a payment method succeeds, the callback will be called with a SetupIntent with status REQUIRES_CONFIRMATION, indicating that you should call confirmSetupIntent to finish setting up the payment.

Return

A Cancelable that allows the operation to be canceled at any time

Parameters

intent

The SetupIntent to which the payment method should be attached

allowRedisplay

Field to reflect whether this payment method can be shown again to its customer in a checkout flow.

config

An optional SetupIntentConfiguration to configure per-collection overrides.

callback

The SetupIntentCallback to be invoked when the command completes