Skip to main content
PrimerPayPalScope manages the PayPal payment flow including redirect handling.

Declaration

@MainActor
public protocol PrimerPayPalScope: PrimerPaymentMethodScope where State == PrimerPayPalState

Properties

PropertyTypeDescription
stateAsyncStream<PrimerPayPalState>Stream of PayPal state changes
presentationContextPresentationContext.direct or .fromPaymentSelection
dismissalMechanism[DismissalMechanism]Supported dismissal methods

Customization

PropertyTypeDescription
screenPayPalScreenComponent?Full screen replacement. Signature: (any PrimerPayPalScope) -> any View
payButtonPayPalButtonComponent?Custom pay button. Signature: (any PrimerPayPalScope) -> any View
submitButtonTextString?Submit button label

Methods

MethodDescription
start()Begin the PayPal flow
submit()Submit the payment
onBack()Navigate back
cancel()Cancel the PayPal flow

PrimerPayPalState

public struct PrimerPayPalState: Equatable {
  public enum Status: Equatable {
    case idle
    case loading
    case redirecting
    case processing
    case success
    case failure(String)
  }

  var status: Status
  var paymentMethod: CheckoutPaymentMethod?
  var surchargeAmount: String?
}
PropertyTypeDescription
statusStatusCurrent payment status
paymentMethodCheckoutPaymentMethod?PayPal payment method details
surchargeAmountString?Formatted surcharge amount

See also

Scopes overview

All available scopes