Skip to main content
PrimerAchScope manages the ACH multi-step payment flow: user details collection, bank account collection, and mandate acceptance.

Declaration

@MainActor
public protocol PrimerAchScope: PrimerPaymentMethodScope where State == PrimerAchState

Properties

PropertyTypeDescription
stateAsyncStream<PrimerAchState>Stream of ACH state changes
presentationContextPresentationContext.direct or .fromPaymentSelection
dismissalMechanism[DismissalMechanism]Supported dismissal methods
bankCollectorViewControllerUIViewController?Bank collection view controller for embedding

Customization

PropertyTypeDescription
screenAchScreenComponent?Full screen replacement. Signature: (any PrimerAchScope) -> any View
userDetailsScreenAchScreenComponent?User details step replacement
mandateScreenAchScreenComponent?Mandate step replacement
submitButtonAchButtonComponent?Custom submit button. Signature: (any PrimerAchScope) -> any View

Methods

MethodDescription
updateFirstName(_ value: String)Update first name
updateLastName(_ value: String)Update last name
updateEmailAddress(_ value: String)Update email address
submitUserDetails()Submit user details to proceed to bank collection
acceptMandate()Accept the ACH mandate
declineMandate()Decline the mandate
onBack()Navigate back
cancel()Cancel the ACH flow

PrimerAchState

public struct PrimerAchState: Equatable {
  public enum Step: Equatable {
    case loading
    case userDetailsCollection
    case bankAccountCollection
    case mandateAcceptance
    case processing
  }

  var step: Step
  var userDetails: UserDetails
  var fieldValidation: FieldValidation?
  var mandateText: String?
  var isSubmitEnabled: Bool
}

Flow

UserDetails

public struct UserDetails: Equatable {
  let firstName: String
  let lastName: String
  let emailAddress: String
}

FieldValidation

public struct FieldValidation: Equatable {
  let firstNameError: String?
  let lastNameError: String?
  let emailError: String?
  var hasErrors: Bool
}
PropertyTypeDescription
stepStepCurrent step in the flow
userDetailsUserDetailsCollected user details
fieldValidationFieldValidation?Validation errors for user details
mandateTextString?ACH mandate text for acceptance
isSubmitEnabledBoolWhether submit is allowed

See also

Scopes overview

All available scopes