This method allows you get a new instance of StripeAchUserDetailsComponent
to initiate Stripe ACH payments.
1
fun <T : PrimerHeadlessAchComponent<out PrimerCollectableData, out PrimerHeadlessStep>> provide(paymentMethodType: String): T
Parameters
A unique string identifier for the payment method. Supported payment methods for current client session are returned in onAvailablePaymentMethodsLoaded callback.
Type parameters
The type of the PrimerHeadlessAchComponent
implementation to return.
Supported types
Type | paymentMethodType |
---|---|
StripeAchUserDetailsComponent | STRIPE_ACH |
Returns
An instance of the passed generic type T
, which could be any of the following available components:
Common API and available components
Common API
Initialize the component by calling the start
function. This method should be called only once.
Call submit
function in order to process collected data and move component to next state.
Get a Flow of PrimerError objects that represent errors emitted by this component. Subscribers can observe and handle errors using this Flow.
Supported types
API
Update component with collected data by passing implementations of sealed interface. This method can be called at any point, even if you have only partially collected data. To validate the partially collected data, you can refer to the componentValidationStatus and receive the validation status when it's updated.
sealed interface AchUserDetailsCollectableData
Properties
Properties
Properties
AchUserDetailsStep
is a class holding different output data for specific steps. Whenever start or submit methods are called, componentStep
will trigger the next step in case the call to the mentioned method was successful.
sealed interface AchUserDetailsStep
Properties
The PrimerValidationStatus
interface encompasses a range of validation statuses.
sealed interface PrimerValidationStatus
Properties
The data being validated.
Properties
The successfully validated data.
Properties
List of PrimerValidationError
objects that represent data validation errors emitted by this component.
Properties
The data that failed validation.
Properties
The specific PrimerError
that occurred during validation.
The data for which the error occurred.
Example
123456789101112131415
class CheckoutActivity : AppCompatActivity() { // 👇 Add this private val stripeAchUserDetailsComponent by lazy { /** Note: Although the component focuses on collecting user details pertaining to ACH, it also kicks off the tokenization and payment processes and because of that it should be kept in memory until the checkout is completed. This component implements Android's ViewModel class, therefore keeping a reference to it is not enough. Instead, pass a long lifecycle ViewModelStoreOwner when you initialize PrimerHeadlessUniversalCheckoutAchManager, such as that of your activity or parent fragment. */ PrimerHeadlessUniversalCheckoutAchManager(viewModelStoreOwner) .provide<StripeAchUserDetailsComponent>(paymentMethodType = "STRIPE_ACH") }}