STPAuthenticationContext

@protocol STPAuthenticationContext <NSObject>

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

    Objective-C

    - (nonnull UIViewController *)authenticationPresentingViewController;

    Swift

    func authenticationPresentingViewController() -> UIViewController
  • This method is called before presenting a UIViewController for authentication.

    Note

    STPPaymentHandler will not proceed until completion is called.

    Declaration

    Objective-C

    - (void)prepareAuthenticationContextForPresentation:
        (nonnull STPVoidBlock)completion;

    Swift

    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

    Objective-C

    - (void)configureSafariViewController:
        (nonnull SFSafariViewController *)viewController;

    Swift

    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

    Objective-C

    - (void)authenticationContextWillDismissViewController:
        (nonnull UIViewController *)viewController;

    Swift

    optional func authenticationContextWillDismiss(_ viewController: UIViewController)