Classes

The following classes are available globally.

  • A client for making connections to the Stripe API.

    See more

    Declaration

    Swift

    @objc
    public class STPAPIClient : 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

    Swift

    public class STPAddCardViewController: STPCoreTableViewController, STPAddressViewModelDelegate,
        STPCardScannerDelegate, STPPaymentCardTextFieldDelegate, UITableViewDelegate,
        UITableViewDataSource
  • STPAddress Contains an address as represented by the Stripe API.

    See more

    Declaration

    Swift

    public class STPAddress : NSObject
    extension STPAddress: STPAPIResponseDecodable
    extension STPAddress: STPFormEncodable
    extension STPAddress: NSCopying
  • 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 is STPApplePayPaymentOption {
    // Don't ask the user for their card number; they want to pay with apple pay.
    }
    
    See more

    Declaration

    Swift

    @objc
    public class STPApplePayPaymentOption : NSObject, STPPaymentOption
  • This view controller displays a list of banks of the specified type, allowing the user to select one to pay from. Once a bank is selected, it will return a PaymentMethodParams object, which you can use to confirm a PaymentIntent or inspect to obtain details about the selected bank.

    See more

    Declaration

    Swift

    public class STPBankSelectionViewController: STPCoreTableViewController, UITableViewDataSource,
        UITableViewDelegate
  • Representation of a user’s credit card details that have been tokenized with the Stripe API

    See more

    Declaration

    Swift

    public class STPCard : NSObject, STPAPIResponseDecodable, STPSourceProtocol
    extension STPCard: 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.

    See more

    Declaration

    Swift

    public class STPCoreScrollViewController : STPCoreViewController
  • 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.

    See more

    Declaration

    Swift

    public 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

    Swift

    public class STPCoreViewController : UIViewController
  • 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

    Swift

    open 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

    Swift

    public class STPFakeAddPaymentPassViewController : UIViewController
  • 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

    Swift

    public class STPPaymentActivityIndicatorView : UIView
  • 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

    Swift

    public 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

    Swift

    @objc(STPPaymentContext)
    public class STPPaymentContext: NSObject, STPAuthenticationContext,
        STPPaymentOptionsViewControllerDelegate, STPShippingAddressViewControllerDelegate
  • 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

    Swift

    public class STPPaymentIntentParams : NSObject
    extension STPPaymentIntentParams: STPFormEncodable
    extension STPPaymentIntentParams: NSCopying
  • PaymentMethod objects represent your customer’s payment instruments. They can be used with PaymentIntents to collect payments.

    See more

    Declaration

    Swift

    public class STPPaymentMethod : NSObject, STPAPIResponseDecodable
    extension STPPaymentMethod: STPPaymentOption
  • An object representing parameters used to create a PaymentMethod object. @note To create a PaymentMethod from an Apple Pay PKPaymentToken, see STPAPIClient createPaymentMethodWithPayment:completion:

    See more

    Declaration

    Swift

    public class STPPaymentMethodParams : NSObject, STPFormEncodable
    extension STPPaymentMethodParams: STPPaymentOption
  • 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

    Swift

    public class STPPaymentOptionsViewController: STPCoreViewController,
        STPPaymentOptionsInternalViewControllerDelegate, STPAddCardViewControllerDelegate
  • When you’re using STPPaymentContext to request your user’s payment details, this is the object that will be returned to your application when they’ve successfully made a payment. See https://stripe.com/docs/mobile/ios/basic#submit-payment-intents

    See more

    Declaration

    Swift

    public class STPPaymentResult : NSObject
  • STPAPIClient extensions to manage PIN on Stripe Issuing cards

    See more

    Declaration

    Swift

    public 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

    Swift

    public 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

    Swift

    public class STPPushProvisioningDetailsParams : NSObject
  • 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

    Swift

    public class STPShippingAddressViewController : STPCoreTableViewController
    extension STPShippingAddressViewController:
        STPAddressViewModelDelegate, UITableViewDelegate, UITableViewDataSource,
        STPShippingMethodsViewControllerDelegate
  • Representation of a customer’s payment instrument created with the Stripe API. - seealso: https://stripe.com/docs/api#sources

    See more

    Declaration

    Swift

    public class STPSource : NSObject, STPAPIResponseDecodable, STPSourceProtocol
    extension STPSource: STPPaymentOption
  • STPTheme objects can be used to visually style Stripe-provided UI. See https://stripe.com/docs/mobile/ios/basic#theming for more information.

    See more

    Declaration

    Swift

    final public class STPTheme : NSObject
    extension STPTheme: NSCopying
  • 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

    Swift

    public class STPUserInformation : NSObject, NSCopying
  • Libraries wrapping the Stripe SDK should use this object to provide information about the library, and set it in on STPAPIClient. This information is passed to Stripe so that we can contact you about future issues or critical updates.

    See more

    Declaration

    Swift

    @objc
    public class STPAppInfo : NSObject
  • A top-level class that imports the rest of the Stripe SDK.

    See more

    Declaration

    Swift

    @objc
    public class StripeAPI : NSObject

STPError

  • Top-level class for Stripe error constants.

    See more

    Declaration

    Swift

    @objc
    public class STPError : NSObject
  • A helper class that implements Apple Pay. Usage looks like this:

    1. Initialize this class with a PKPaymentRequest describing the payment request (amount, line items, required shipping info, etc)
    2. Call presentApplePayOnViewController:completion: to present the Apple Pay sheet and begin the payment process 3 (optional): If you need to respond to the user changing their shipping information/shipping method, implement the optional delegate methods
    3. When the user taps ‘Buy’, this class uses the PaymentIntent that you supply in the applePayContext:didCreatePaymentMethod:completion: delegate method to complete the payment
    4. After payment completes/errors and the sheet is dismissed, this class informs you in the applePayContext:didCompleteWithStatus: delegate method

Seealso

https://stripe.com/docs/apple-pay#native for a full guide

Seealso

ApplePayExampleViewController for an example

Declaration

Swift

@objc(STPApplePayContext)
public class STPApplePayContext : NSObject, PKPaymentAuthorizationControllerDelegate