collectSetupIntentPaymentMethod

fun collectSetupIntentPaymentMethod(intent: SetupIntent, customerConsentCollected: Boolean, 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

customerConsentCollected

Whether customer consent has been collected to save their card.

config

An optional SetupIntentConfiguration to configure per-collection overrides.

callback

The SetupIntentCallback to be invoked when the command completes