Classes

The following classes are available globally.

  • A client for making connections to the Stripe API.

    See more

    Declaration

    Objective-C

    @interface STPAPIClient : NSObject

    Swift

    class STPAPIClient : NSObject
  • A top-level class that imports the rest of the Stripe SDK.

    See more

    Declaration

    Objective-C

    @interface Stripe : NSObject

    Swift

    class Stripe : NSObject
  • This view controller contains a credit card entry form that the user can fill out. On submission, it will use the Stripe API to convert the user’s card details to a Stripe token. It renders a right bar button item that submits the form, so it must be shown inside a UINavigationController.

    See more

    Declaration

    Objective-C

    @interface STPAddCardViewController : STPCoreTableViewController

    Swift

    class STPAddCardViewController : STPCoreTableViewController
  • An empty class representing that the user wishes to pay via Apple Pay. This can be checked on an STPPaymentContext, e.g:

    if ([paymentContext.selectedPaymentOption isKindOfClass:[STPApplePayPaymentOption class]]) {
       // Don't ask the user for their card number; they want to pay with apple pay.
    }
    

    Declaration

    Objective-C

    @interface STPApplePayPaymentOption : NSObject <STPPaymentOption>

    Swift

    class STPApplePayPaymentOption : NSObject, STPPaymentOption
  • This is the base class for all Stripe scroll view controllers. It is intended for use only by Stripe classes, you should not subclass it yourself in your app.

    It inherits from STPCoreScrollViewController and changes the type of the created scroll view to UITableView, as well as other shared table view logic.

    Declaration

    Objective-C

    @interface STPCoreTableViewController : STPCoreScrollViewController

    Swift

    class STPCoreTableViewController : STPCoreScrollViewController
  • This is the base class for all Stripe view controllers. It is intended for use only by Stripe classes, you should not subclass it yourself in your app.

    It theming, back/cancel button management, and other shared logic for Stripe view controllers.

    See more

    Declaration

    Objective-C

    @interface STPCoreViewController : UIViewController

    Swift

    class STPCoreViewController : UIViewController
  • An STPCustomer represents a deserialized Customer object from the Stripe API. You shouldn’t need to instantiate an STPCustomer – you should instead use STPCustomerContext to manage retrieving and updating a customer.

    See more

    Declaration

    Objective-C

    @interface STPCustomer : NSObject <STPAPIResponseDecodable>

    Swift

    class STPCustomer : NSObject, STPAPIResponseDecodable
  • Use STPCustomerDeserializer to convert a response from the Stripe API into an STPCustomer object. STPCustomerDeserializer expects the JSON response to be in the exact same format as the Stripe API.

    See more

    Declaration

    Objective-C

    @interface STPCustomerDeserializer : NSObject

    Swift

    class STPCustomerDeserializer : NSObject
  • An STPCustomerContext retrieves and updates a Stripe customer and their attached payment methods using an ephemeral key, a short-lived API key scoped to a specific customer object. If your current user logs out of your app and a new user logs in, be sure to either create a new instance of STPCustomerContext or clear the current instance’s cache. On your backend, be sure to create and return a new ephemeral key for the Customer object associated with the new user.

    See more

    Declaration

    Objective-C

    @interface STPCustomerContext : NSObject <STPBackendAPIAdapter>

    Swift

    class STPCustomerContext : NSObject, STPBackendAPIAdapter
  • This class is a piece of fake UI that is intended to mimic PKAddPaymentPassViewController. That class is restricted to apps with a special entitlement from Apple, and as such can be difficult to build and test against. This class implements the same public API as PKAddPaymentPassViewController, and can be used to develop against the Stripe API in testmode only. (Obviously it will not actually place cards into the user’s Apple Pay wallet either.) When it’s time to go to production, you may simply replace all references to STPFakeAddPaymentPassViewController in your app with PKAddPaymentPassViewController and it will continue to function. For more information on developing against this API, please see https://stripe.com/docs/issuing/cards/digital-wallets .

    See more

    Declaration

    Objective-C

    @interface STPFakeAddPaymentPassViewController : UIViewController

    Swift

    class STPFakeAddPaymentPassViewController : UIViewController
  • This class lets you access card icons used by the Stripe SDK. All icons are 32 x 20 points.

    See more

    Declaration

    Objective-C

    @interface STPImageLibrary : NSObject

    Swift

    class STPImageLibrary : NSObject
  • This class can be used wherever you’d use a UIActivityIndicatorView and is intended to have a similar API. It renders as a spinning circle with a gap in it, similar to what you see in the App Store app or in the Apple Pay dialog when making a purchase. To change its color, set the tintColor property.

    See more

    Declaration

    Objective-C

    @interface STPPaymentActivityIndicatorView : UIView

    Swift

    class STPPaymentActivityIndicatorView : UIView
  • STPPaymentCardTextField is a text field with similar properties to UITextField, but specialized for collecting credit/debit card information. It manages multiple UITextFields under the hood to collect this information. It’s designed to fit on a single line, and from a design perspective can be used anywhere a UITextField would be appropriate.

    See more

    Declaration

    Objective-C

    @interface STPPaymentCardTextField : UIControl <UIKeyInput>

    Swift

    class STPPaymentCardTextField : UIControl, UIKeyInput
  • An STPPaymentConfiguration represents all the options you can set or change around a payment.

    You provide an STPPaymentConfiguration object to your STPPaymentContext when making a charge. The configuration generally has settings that will not change from payment to payment and thus is reusable, while the context is specific to a single particular payment instance.

    See more

    Declaration

    Objective-C

    @interface STPPaymentConfiguration : NSObject <NSCopying>

    Swift

    class STPPaymentConfiguration : NSObject, NSCopying
  • An STPPaymentContext keeps track of all of the state around a payment. It will manage fetching a user’s saved payment methods, tracking any information they select, and prompting them for required additional information before completing their purchase. It can be used to power your application’s payment confirmation page with just a few lines of code.

    STPPaymentContext also provides a unified interface to multiple payment methods - for example, you can write a single integration to accept both credit card payments and Apple Pay.

    STPPaymentContext saves information about a user’s payment methods to a Stripe customer object, and requires an STPCustomerContext to manage retrieving and modifying the customer.

    See more

    Declaration

    Objective-C

    @interface STPPaymentContext : NSObject <STPAuthenticationContext>

    Swift

    class STPPaymentContext : NSObject, STPAuthenticationContext
  • STPPaymentHandler is a utility class that confirms PaymentIntents/SetupIntents and handles any authentication required, such as 3DS1/3DS2 for Strong Customer Authentication. It can present authentication UI on top of your app or redirect users out of your app (to e.g. their banking app).

    See more

    Declaration

    Objective-C

    
    @interface STPPaymentHandler : NSObject

    Swift

    class STPPaymentHandler : NSObject
  • An object representing parameters used to confirm a PaymentIntent object.

    A PaymentIntent must have a PaymentMethod or Source associated in order to successfully confirm it.

    That PaymentMethod or Source can either be:

  • created during confirmation, by passing in a STPPaymentMethodParams or STPSourceParams object in the paymentMethodParams or sourceParams field
  • a pre-existing PaymentMethod or Source can be associated by passing its id in the paymentMethodId or sourceId field
  • or already set via your backend, either when creating or updating the PaymentIntent

  • See more

    Declaration

    Objective-C

    @interface STPPaymentIntentParams : NSObject <NSCopying, STPFormEncodable>

    Swift

    class STPPaymentIntentParams : NSObject, NSCopying, STPFormEncodable
  • This view controller presents a list of payment method options to the user, which they can select between. They can also add credit cards to the list.

    It must be displayed inside a UINavigationController, so you can either create a UINavigationController with an STPPaymentOptionsViewController as the rootViewController and then present the UINavigationController, or push a new STPPaymentOptionsViewController onto an existing UINavigationController‘s stack. You can also have STPPaymentContext do this for you automatically, by calling presentPaymentOptionsViewController or pushPaymentOptionsViewController on it.

    See more

    Declaration

    Objective-C

    @interface STPPaymentOptionsViewController : STPCoreViewController

    Swift

    class STPPaymentOptionsViewController : STPCoreViewController
  • STPAPIClient extensions to manage PIN on Stripe Issuing cards

    See more

    Declaration

    Objective-C

    @interface STPPinManagementService : NSObject

    Swift

    class STPPinManagementService : NSObject
  • This class makes it easier to implement Push Provisioning, the process by which an end-user can add a card to their Apple Pay wallet without having to type their number. This process is mediated by an Apple class called PKAddPaymentPassViewController; this class will help you implement that class’ delegate methods. Note that this flow requires a special entitlement from Apple; for more information please see https://stripe.com/docs/issuing/cards/digital-wallets .

    See more

    Declaration

    Objective-C

    @interface STPPushProvisioningContext : NSObject

    Swift

    class STPPushProvisioningContext : NSObject
  • A helper class for turning the raw certificate array, nonce, and nonce signature emitted by PKAddPaymentPassViewController into a format that is understandable by the Stripe API. If you are using STPPushProvisioningContext to implement your integration, you do not need to use this class.

    See more

    Declaration

    Objective-C

    @interface STPPushProvisioningDetailsParams : NSObject

    Swift

    class STPPushProvisioningDetailsParams : NSObject
  • This is a helper class for handling redirects associated with STPSource and STPPaymentIntents.

    Init and retain an instance with the Source or PaymentIntent you want to handle, then choose a redirect method. The context will fire the completion handler when the redirect completes.

    Due to the nature of iOS, very little concrete information can be gained during this process, as all actions take place in either the Safari app or the sandboxed SFSafariViewController class. The context attempts to detect when the user has completed the necessary redirect action by listening for both app foregrounds and url callbacks received in the app delegate. However, it is possible the when the redirect is completed, the user may have not actually completed the necessary actions to authorize the charge.

    You should not use either this class, nor STPAPIClient, as a way to determine when you should charge the Source or to determine if the redirect was successful. Use Stripe webhooks on your backend server to listen for Source state changes and to make the charge.

    Note

    You must retain this instance for the duration of the redirect flow. This class dismisses any presented view controller upon deallocation.

    See https://stripe.com/docs/sources/best-practices

    See more

    Declaration

    Objective-C

    
    @interface STPRedirectContext : NSObject

    Swift

    class STPRedirectContext : NSObject
  • An object representing parameters to confirm a SetupIntent object.

    For example, you would confirm a SetupIntent when a customer hits the “Save” button on a payment method management view in your app.

    If the selected payment method does not require any additional steps from the customer, the SetupIntent’s status will transition to STPSetupIntentStatusSucceeded. Otherwise, it will transition to STPSetupIntentStatusRequiresAction, and suggest additional actions via nextAction. Instead of passing this to [STPAPIClient confirmSetupIntent...] directly, we recommend using STPPaymentHandler to handle any additional steps for you.

    See more

    Declaration

    Objective-C

    @interface STPSetupIntentConfirmParams : NSObject <NSCopying, STPFormEncodable>

    Swift

    class STPSetupIntentConfirmParams : NSObject, NSCopying, STPFormEncodable
  • This view controller contains a shipping address collection form. It renders a right bar button item that submits the form, so it must be shown inside a UINavigationController. Depending on your configuration’s shippingType, the view controller may present a shipping method selection form after the user enters an address.

    See more

    Declaration

    Objective-C

    @interface STPShippingAddressViewController : STPCoreTableViewController

    Swift

    class STPShippingAddressViewController : STPCoreTableViewController
  • STPThreeDSCustomizationSettings provides customization options for 3DS2 authentication flows in your app.

    See more

    Declaration

    Objective-C

    @interface STPThreeDSCustomizationSettings : NSObject

    Swift

    class STPThreeDSCustomizationSettings : NSObject
  • The Challenge view displays a footer with additional details that expand when tapped. This object configures the appearance of that view.

    See more

    Declaration

    Objective-C

    @interface STPThreeDSFooterCustomization : NSObject

    Swift

    class STPThreeDSFooterCustomization : NSObject
  • A customization object that configures the appearance of radio buttons and checkboxes.

    See more

    Declaration

    Objective-C

    @interface STPThreeDSSelectionCustomization : NSObject

    Swift

    class STPThreeDSSelectionCustomization : NSObject
  • The STPThreeDSUICustomization provides configuration for UI elements displayed during 3D Secure authentication.

    Note: It’s important to configure this object appropriately before calling any STPPaymentHandler APIs. The API makes a copy of the customization settings you provide; it ignores any subsequent changes you make to your STPThreeDSUICustomization instance.

    See more

    Declaration

    Objective-C

    @interface STPThreeDSUICustomization : NSObject

    Swift

    class STPThreeDSUICustomization : NSObject
  • You can use this class to specify information that you’ve already collected from your user. You can then set the prefilledInformation property on STPPaymentContext, STPAddCardViewController, etc and it will pre-fill this information whenever possible.

    See more

    Declaration

    Objective-C

    @interface STPUserInformation : NSObject <NSCopying>

    Swift

    class STPUserInformation : NSObject, NSCopying