STPAuthenticationContext

@objc
public protocol STPAuthenticationContext : NSObjectProtocol

STPAuthenticationContext provides information required to present authentication challenges to a user.

  • The Stripe SDK will modally present additional view controllers on top of the authenticationPresentingViewController when required for user authentication, like in the Challenge Flow for 3DS2 transactions.

    Declaration

    Swift

    func authenticationPresentingViewController() -> UIViewController
  • This method is called before presenting a UIViewController for authentication. @note STPPaymentHandler will not proceed until completion is called.

    Declaration

    Swift

    @objc(prepareAuthenticationContextForPresentation:)
    optional func prepare(
      forPresentation completion: @escaping STPVoidBlock)
  • This method is called before presenting an SFSafariViewController for web-based authentication. Implement this method to configure the SFSafariViewController instance, e.g. viewController.preferredBarTintColor = MyBarTintColor @note Setting the delegate property has no effect.

    Declaration

    Swift

    @objc
    optional func configureSafariViewController(_ viewController: SFSafariViewController)
  • This method is called when an authentication UIViewController is about to be dismissed. Implement this method to prepare your UI for the authentication view controller to be dismissed. For example, if you requested authentication while displaying an STPBankSelectionViewController, you may want to hide it to return the user to your desired view controller.

    Declaration

    Swift

    @objc(authenticationContextWillDismissViewController:)
    optional func authenticationContextWillDismiss(_ viewController: UIViewController)