Protocols

The following protocols are available globally.

  • Objects conforming to STPAPIResponseDecodable can be automatically converted from a JSON dictionary that was returned from the Stripe API.

    See more

    Declaration

    Objective-C

    @protocol STPAPIResponseDecodable <NSObject>

    Swift

    protocol STPAPIResponseDecodable : NSObjectProtocol
  • An STPAddCardViewControllerDelegate is notified when an STPAddCardViewController successfully creates a card token or is cancelled. It has internal error-handling logic, so there’s no error case to deal with.

    See more

    Declaration

    Objective-C

    @protocol STPAddCardViewControllerDelegate <NSObject>

    Swift

    protocol STPAddCardViewControllerDelegate : NSObjectProtocol
  • STPAuthenticationContext provides information required to present authentication challenges to a user.

    See more

    Declaration

    Objective-C

    @protocol STPAuthenticationContext <NSObject>

    Swift

    protocol STPAuthenticationContext : NSObjectProtocol
  • Typically, you will not need to implement this protocol yourself. You should instead use STPCustomerContext, which implements and manages retrieving and updating a Stripe customer for you.

    See

    STPCustomerContext.h

    If you would prefer retrieving and updating your Stripe customer object via your own backend instead of using STPCustomerContext, you should make your application’s API client conform to this interface. It provides a bridge from the prebuilt UI we expose (such as STPPaymentOptionsViewController) to your backend to fetch the information it needs to power those views.

    See more

    Declaration

    Objective-C

    @protocol STPBackendAPIAdapter <NSObject>

    Swift

    protocol STPBackendAPIAdapter : NSObjectProtocol
  • An STPBankSelectionViewControllerDelegate is notified when a user selects a bank.

    See more

    Declaration

    Objective-C

    @protocol STPBankSelectionViewControllerDelegate <NSObject>

    Swift

    protocol STPBankSelectionViewControllerDelegate : NSObjectProtocol
  • You should make your application’s API client conform to this interface. It provides a way for Stripe utility classes to request a new ephemeral key from your backend, which it will use to retrieve and update Stripe API objects.

    See more

    Declaration

    Objective-C

    @protocol STPCustomerEphemeralKeyProvider <NSObject>

    Swift

    protocol STPCustomerEphemeralKeyProvider : NSObjectProtocol
  • You should make your application’s API client conform to this interface. It provides a way for Stripe utility classes to request a new ephemeral key from your backend, which it will use to retrieve and update Stripe API objects.

    See more

    Declaration

    Objective-C

    @protocol STPIssuingCardEphemeralKeyProvider <NSObject>

    Swift

    protocol STPIssuingCardEphemeralKeyProvider : NSObjectProtocol
  • Deprecated

    STPEphemeralKeyProvider has been renamed to STPCustomerEphemeralKeyProvider

    You should make your application’s API client conform to this interface. It provides a way for Stripe utility classes to request a new ephemeral key from your backend, which it will use to retrieve and update Stripe API objects. @deprecated use STPCustomerEphemeralKeyProvider or STPIssuingCardEphemeralKeyProvider depending on the type of key that will be fetched.

    Declaration

    Objective-C

    @protocol STPEphemeralKeyProvider <STPCustomerEphemeralKeyProvider>

    Swift

    protocol STPEphemeralKeyProvider : STPCustomerEphemeralKeyProvider
  • Objects conforming to STPFormEncodable can be automatically converted to a form-encoded string, which can then be used when making requests to the Stripe API.

    See more

    Declaration

    Objective-C

    @protocol STPFormEncodable <NSObject>

    Swift

    protocol STPFormEncodable : NSObjectProtocol
  • This protocol allows a delegate to be notified when a payment text field’s contents change, which can in turn be used to take further actions depending on the validity of its contents.

    See more

    Declaration

    Objective-C

    @protocol STPPaymentCardTextFieldDelegate <NSObject>

    Swift

    protocol STPPaymentCardTextFieldDelegate : NSObjectProtocol
  • Implement STPPaymentContextDelegate to get notified when a payment context changes, finishes, encounters errors, etc. In practice, if your app has a checkout screen view controller, that is a good candidate to implement this protocol.

    See more

    Declaration

    Objective-C

    @protocol STPPaymentContextDelegate <NSObject>

    Swift

    protocol STPPaymentContextDelegate : NSObjectProtocol
  • This protocol represents a payment method that a user can select and use to pay.

    The classes that conform to it and are supported by the UI:

  • STPApplePay, which represents that the user wants to pay with Apple Pay
  • STPPaymentMethod. Only STPPaymentMethod.type == STPPaymentMethodTypeCard and STPPaymentMethod.type == STPPaymentMethodTypeFPX are supported by STPPaymentContext and STPPaymentOptionsViewController
  • STPPaymentMethodParams. This should be used with non-reusable payment method, such as FPX and iDEAL. Instead of reaching out to Stripe to create a PaymentMethod, you can pass an STPPaymentMethodParams directly to Stripe when confirming a PaymentIntent.

  • Note

    card-based Sources, Cards, and FPX support this protocol for use in a custom integration.

    See more

    Declaration

    Objective-C

    @protocol STPPaymentOption <NSObject>

    Swift

    protocol STPPaymentOption : NSObjectProtocol
  • An STPPaymentOptionsViewControllerDelegate responds when a user selects a payment option from (or cancels) an STPPaymentOptionsViewController. In both of these instances, you should dismiss the view controller (either by popping it off the navigation stack, or dismissing it).

    See more

    Declaration

    Objective-C

    @protocol STPPaymentOptionsViewControllerDelegate <NSObject>

    Swift

    protocol STPPaymentOptionsViewControllerDelegate : NSObjectProtocol