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

  • An asynchronous failable initializer for PaymentSheet.FlowController This asynchronously loads the Customer’s payment methods, their default payment method, and the PaymentIntent. You can use the returned PaymentSheet.FlowController instance to e.g. update your UI with the Customer’s default oayment method

    Note

    This can be used to complete a payment - don’t log it, store it, or expose it to anyone other than the customer.

    Declaration

    Swift

    public static func create(
        paymentIntentClientSecret: String,
        configuration: PaymentSheet.Configuration,
        completion: @escaping (Result<PaymentSheet.FlowController, Error>) -> Void
    )

    Parameters

    paymentIntentClientSecret

    The client secret of a Stripe PaymentIntent object

    configuration

    Configuration for the PaymentSheet. e.g. your business name, Customer details, etc.

    completion

    This is called with either a valid PaymentSheet.FlowController instance or an error if loading failed.

  • An asynchronous failable initializer for PaymentSheet.FlowController This asynchronously loads the Customer’s payment methods, their default payment method, and the SetuptIntent. You can use the returned PaymentSheet.FlowController instance to e.g. update your UI with the Customer’s default payment method

    Declaration

    Swift

    public static func create(
        setupIntentClientSecret: String,
        configuration: PaymentSheet.Configuration,
        completion: @escaping (Result<PaymentSheet.FlowController, Error>) -> Void
    )

    Parameters

    setupIntentClientSecret

    The client secret of a Stripe SetupIntent object

    configuration

    Configuration for the PaymentSheet. e.g. your business name, Customer details, etc.

    completion

    This is called with either a valid PaymentSheet.FlowController instance or an error if loading failed.

  • 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.