This method allows you get a new instance of StripeAchUserDetailsComponent to initiate Stripe ACH payments.
SWIFT
public func provide<PrimerHeadlessAchComponent>(paymentMethodType: String) throws -> PrimerHeadlessAchComponent? where PrimerCollectableData: Any, PrimerHeadlessStep: Any
An instance of the passed generic type, which could be any of the following available components:
Hide Common API
Implemented by all components
Hide Methods and Properties
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.
PrimerHeadlessErrorableDelegate
Error delegate will be triggered every time an error is thrown in the process.
SWIFT
func didReceiveError(error: PrimerError)
Hide Supported types
PrimerHeadlessAchComponent where Data == ACHUserDetailsCollectableData, Step == ACHUserDetailsStep
Hide API
Update component with collected data by passing an enum representing collectable data. 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 validationDelegate and receive the validation status when it’s updated.In case of ACH, the Data will be of type ACHUserDetailsCollectableData.
Show enum ACHUserDetailsCollectableData
Enum member representing the customer’s first name.
Hide Properties
String
The string value for the customer’s first name.
Enum member representing the customer’s last name.
Hide Properties
String
The string value for the customer’s last name.
Enum member representing the customer’s email address.
Hide Properties
String
The string value for the customer’s email address.
Whenever start or submit methods are called, stepDelegate will trigger the next step in
case the call to the mentioned method was successful.
In the case of STRIPE_ACH, the steps will be of type
ACHUserDetailsStep.
ACHUserDetailsStep is an enum holding different output data for
specific steps.
Show enum ACHUserDetailsStep
Enum member representing the retrieved user details.
Hide Properties
ACHUserDetails
The retrieved user details of type ACHUserDetails
previously sent on client session creation.
Hide Properties
String
The first name previously sent on client session creation.
String
The last name previously sent on client session creation.
String
The email address previously sent on client session creation.
Enum member representing the event of collected user details.
Example:
SWIFT
func didReceiveStep(step: PrimerHeadlessStep) { guard let step = step as? ACHUserDetailsStep else { return } switch step { case .retrievedUserDetails(let userDetails): case .didCollectUserDetails: }}
PrimerHeadlessValidatableDelegate
Validation delegate will be triggered every time collected data is updated.
SWIFT
func didUpdate(validationStatus: PrimerValidationStatus, for data: PrimerCollectableData?)
In the case of STRIPE_ACH, the data will be of type
ACHUserDetailsCollectableData.
Enum
PrimerValidationStatus is an enum that represents the different validation statuses in the Primer SDK. It helps to communicate the state of validation for a particular process, providing clear categorization of validation states.
Show enum PrimerValidationStatus
ACHUserDetailsCollectableData
Enum case representing the ongoing validation state.
This indicates that the validation process is currently in progress.
ACHUserDetailsCollectableData
Enum case representing a successful validation state.
This indicates that the validation process has completed successfully and the data is valid.
ACHUserDetailsCollectableData
Enum case representing an unsuccessful validation state due to validation errors.
This indicates that the validation process has completed but has found one or more errors in the data.
Hide Associated Value
[PrimerValidationError]
An array of PrimerValidationError representing the specific validation errors found.
ACHUserDetailsCollectableData
Enum case representing an error state due to an unexpected issue.
This indicates that an unexpected error has occurred during the validation process.
Hide Associated Value
PrimerError
A PrimerError representing the unexpected error that occurred.
SWIFT
func didUpdate(validationStatus: PrimerValidationStatus, for data: PrimerCollectableData?) { guard let data = data as? ACHUserDetailsCollectableData else { return } switch validationStatus { case .validating: case .valid: case .invalid(errors: let errors): case .error(error: let error): }}
Example
Although the component focuses on collecting user details pertaining to ACH,
it also kicks off the tokenization and payment processes. Because of this,
it should be kept in memory until the checkout is completed.Ensure that the screen implementing this component is not dismissed until the payment
is finished, as the component returned by the manager is optional. As a result,
having a weak reference to it will stop the entire payment flow if the screen is dismissed prematurely.