FlowController

@available(iOSApplicationExtension, unavailable)
@available(macCatalystApplicationExtension, unavailable)
public class FlowController

A class that presents the individual steps of a payment flow

Public properties

Public methods

  • Presents a sheet where the customer chooses how to pay, either by selecting an existing payment method or adding a new one Call this when your “Select a payment method” button is tapped

    Declaration

    Swift

    public func presentPaymentOptions(
        from presentingViewController: UIViewController,
        completion: (() -> ())? = nil
    )

    Parameters

    presentingViewController

    The view controller that presents the sheet.

    completion

    This is called after the sheet is dismissed. Use the paymentOption property to get the customer’s desired payment option.

  • Completes the payment or setup.

    Declaration

    Swift

    public func confirm(
        from presentingViewController: UIViewController,
        completion: @escaping (PaymentSheetResult) -> ()
    )

    Parameters

    presentingViewController

    The view controller used to present any view controllers required e.g. to authenticate the customer

    completion

    Called with the result of the payment after any presented view controllers are dismissed

  • A button which presents a sheet for a customer to select a payment method. This is a convenience wrapper for the .paymentOptionsSheet() ViewModifier.

    See more

    Declaration

    Swift

    public struct PaymentOptionsButton<Content> : View where Content : View

    Parameters

    paymentSheetFlowController

    A PaymentSheet.FlowController to present.

    onSheetDismissed

    Called after the payment method selector is dismissed.

    content

    The content of the view.

  • A button which confirms the payment or setup. Depending on the user’s payment method, it may present a confirmation sheet. This is a convenience wrapper for the .paymentConfirmationSheet() ViewModifier.

    See more

    Declaration

    Swift

    public struct ConfirmButton<Content> : View where Content : View

    Parameters

    paymentSheetFlowController

    A PaymentSheet.FlowController to present.

    onCompletion

    Called with the result of the payment/setup confirmation, after the PaymentSheet (if any) is dismissed.

    content

    The content of the view.