iOS Integration

    Integrate the Stripe iOS SDK to start accepting in-app card and Apple Pay payments.

    Accepting payments in your app involves three steps:

    1. Install the SDK
    2. Collect card details
    3. Tokenize the card information
    4. Create a charge

    The Stripe iOS SDK has lots of tools to help you with steps 1 and 2. For step 3, we recommend using a networking library such as AFNetworking or Alamofire to talk to your own API.

    To support payments on the iOS Safari browser, get started with Stripe Checkout instead.

    Install and configure the SDK

    You can choose to install the Stripe iOS SDK via your favorite method. We support CocoaPods and Carthage with both static and dynamic frameworks.

    1. If you haven't already, install the latest version of CocoaPods.
    2. Add this line to your Podfile:
      pod 'Stripe'
    3. Run the following command:
      pod install
    4. Don't forget to use the .xcworkspace file to open your project in Xcode, instead of the .xcodeproj file, from here on out.
    5. In the future, to update to the latest version of the SDK, just run:
      pod update Stripe
    1. If you haven't already, install the latest version of Carthage.
    2. Add this line to your Cartfile:
      github "stripe/stripe-ios"
    3. Follow the Carthage installation instructions.
    4. In the future, to update to the latest version of the SDK, run the following command:
      carthage update stripe-ios --platform ios

    Note: This is only compatible with iOS 8 and above.

    1. Head to our GitHub releases page and download and unzip
    2. Drag Stripe.framework to the "Embedded Binaries" section of your Xcode project's "General" settings. Make sure to select "Copy items if needed".
    3. Head to the "Build Phases" section of your Xcode project settings, and create a new "Run Script Build Phase". Paste the following snippet into the text field:
      bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Stripe.framework/"
    4. In the future, to update to the latest version of our SDK, just repeat steps 1 and 2.

    Configure your Stripe integration in your App Delegate

    After you’re done installing the SDK, configure it with your Stripe API keys.

    import UIKit
    import Stripe
    class AppDelegate: UIResponder, UIApplicationDelegate {
        func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
            STPPaymentConfiguration.shared().publishableKey = "pk_test_TYooMQauvdEDq54NiTphI7jx"
            // do any other necessary launch configuration
            return true
    #import "AppDelegate.h"
    #import <Stripe/Stripe.h>
    @implementation AppDelegate
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        [[STPPaymentConfiguration sharedConfiguration] setPublishableKey:@"pk_test_TYooMQauvdEDq54NiTphI7jx"];
        // do any other necessary launch configuration
        return YES;

    Set up Apple Pay (optional)

    Accepting Apple Pay in your app involves some (very quick) setup on the Apple Developer website. Follow the steps in Accepting Apple Pay in Your iOS App to create an Apple Merchant ID.

    After you’ve obtained an Apple Merchant ID, set it in your configuration:

    STPPaymentConfiguration.shared().appleMerchantIdentifier = "your apple merchant identifier"
    [[STPPaymentConfiguration sharedConfiguration] setAppleMerchantIdentifier:@"your apple merchant identifier"];

    Customizing UI components

    Although most users design their own mobile checkouts, Stripe provides prebuilt UI components to help you.

    You can also take our entire checkout flow at once by using STPPaymentContext, a class designed handle collecting, saving, and reusing your user’s payment details, as well as collecting shipping info. See Using Standard UI Components to get started.

    Using Stripe and Apple Pay vs. in-app purchases

    Apple Pay doesn’t replace Apple’s In-App Purchase API. You can use any of Stripe’s supported payment methods and Apple Pay in your iOS app to sell physical goods (e.g., groceries and clothing) or for services your business provides (e.g., club memberships and hotel reservations). These payments are processed through Stripe and you only need to pay Stripe’s processing fee.

    Apple’s developer terms require their In-App Purchase API be used for digital “content, functionality, or services,” such as premium content for your app or subscriptions for digital content. Payments made using the In-App Purchase API are processed by Apple and subject to their transaction fees.

    Strong Customer Authentication

    The Stripe iOS SDK has built-in support for additional customer authentication.

    See our authentication guide for more details on how to prepare your iOS app for SCA.

    Next steps

    Was this page helpful? Yes No


    Thank you for helping improve Stripe's documentation. If you need help or have any questions, please consider contacting support.


    We're always happy to help with code or other questions you might have. Search our documentation, contact support, or connect with our sales team. You can also chat live with other developers in #stripe on freenode.

    On this page