Skip to main content
PrimerPaymentMethodSelectionScope manages the payment method list, selection, and vaulted payment methods.

Declaration

@MainActor
public protocol PrimerPaymentMethodSelectionScope: AnyObject

Properties

State

PropertyTypeDescription
stateAsyncStream<PrimerPaymentMethodSelectionState>Stream of selection state changes
dismissalMechanism[DismissalMechanism]Supported dismissal methods
selectedVaultedPaymentMethodVaultedPaymentMethod?Currently selected vaulted method

Customization

PropertyTypeDescription
screenPaymentMethodSelectionScreenComponent?Full screen replacement. Signature: (PrimerPaymentMethodSelectionScope) -> any View
paymentMethodItemPaymentMethodItemComponent?Custom payment method row. Signature: (CheckoutPaymentMethod) -> any View
categoryHeaderCategoryHeaderComponent?Custom section header. Signature: (String) -> any View
emptyStateViewComponent?Shown when no methods are available

Methods

MethodDescription
onPaymentMethodSelected(paymentMethod:)Select a payment method to proceed
cancel()Cancel the selection
payWithVaultedPaymentMethod()Pay with the selected vaulted method
payWithVaultedPaymentMethodAndCvv(_ cvv: String)Pay with vaulted method using CVV
updateCvvInput(_ cvv: String)Update CVV input for vaulted method
showAllVaultedPaymentMethods()Expand the vaulted methods list
showOtherWaysToPay()Show additional payment methods

PrimerPaymentMethodSelectionState

public struct PrimerPaymentMethodSelectionState {
  var paymentMethods: [CheckoutPaymentMethod]
  var isLoading: Bool
  var selectedPaymentMethod: CheckoutPaymentMethod?
  var searchQuery: String
  var filteredPaymentMethods: [CheckoutPaymentMethod]
  var error: String?
  var selectedVaultedPaymentMethod: VaultedPaymentMethod?
  var isVaultPaymentLoading: Bool
  var requiresCvvInput: Bool
  var cvvInput: String
  var isCvvValid: Bool
  var cvvError: String?
  var isPaymentMethodsExpanded: Bool
}
PropertyTypeDescription
paymentMethods[CheckoutPaymentMethod]All available payment methods
isLoadingBoolLoading state
selectedPaymentMethodCheckoutPaymentMethod?Currently selected method
filteredPaymentMethods[CheckoutPaymentMethod]Methods matching search query
errorString?Error message
requiresCvvInputBoolWhether selected vault method needs CVV
isCvvValidBoolCVV validation state

See also

Display saved methods

Work with vaulted payment methods

Layout customization

Customize the checkout layout