iOS Integration
Accept payments in iPhone and iPad apps, with built-in support for Apple Pay.
The Stripe iOS SDK makes it easy to build an excellent payment experience in your iOS app. It provides powerful, customizable, UI elements to use out-of-the-box to collect your users' payment details.
We also expose the low-level APIs that power those elements to make it easy to build fully custom forms. This guide will take you all the way from integrating our SDK to accepting payments from your users via both credit cards and Apple Pay.


If you'd like to see a complete iOS example, check out Rocket Rides, built using the iOS SDK and Stripe Connect.
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.
- If you haven't already, install the latest version of CocoaPods.
- Add this line to your
Podfile
:pod 'Stripe'
- Run the following command:
pod install
- Don't forget to use the
.xcworkspace
file to open your project in Xcode, instead of the.xcodeproj
file, from here on out. - In the future, to update to the latest version of the SDK, just run:
pod update Stripe
- If you haven't already, install the latest version of Carthage.
- Add this line to your
Cartfile
:github "stripe/stripe-ios"
- Follow the Carthage installation instructions.
- 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.
- Head to our GitHub releases page and download and unzip Stripe.framework.zip.
- Drag Stripe.framework to the "Embedded Binaries" section of your Xcode project's "General" settings. Make sure to select "Copy items if needed".
- 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/integrate-dynamic-framework.sh"
- In the future, to update to the latest version of our SDK, just repeat steps 1 and 2.
Note: We only recommend this approach if you need to support iOS 7 in your application.
- Head to our GitHub releases page and download and unzip StripeiOS-Static.zip.
- In Xcode, with your project open, click on "File" then "Add files to Project...".
- Select
Stripe.framework
in the directory you just unzipped. - Make sure "Copy items if needed" is checked.
- Click "Add".
- In Xcode, click on "File", then "Add files to Project...".
- Select
Stripe.bundle
, located withinStripe.framework
. - Make sure "Copy items if needed" is checked.
- Click "Add".
- In the future, to update to the latest version of our SDK, just repeat steps 1-9.
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
@UIApplicationMain
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;
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[STPPaymentConfiguration sharedConfiguration] setPublishableKey:@"pk_test_TYooMQauvdEDq54NiTphI7jx"];
// do any other necessary launch configuration
return YES;
}
@end
Set up Apple Pay (optional)
Getting ready to accept Apple Pay in your app involves some (very quick) setup on the Apple Developer website, which we have as a separate guide to help get started. 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"];
Using Stripe and Apple Pay vs. in-app purchases
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 that the In-App Purchase API must 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 with a fee of 30% of the total transaction.
Next steps
- The simplest way to integrate our SDK is using
STPPaymentContext
, a class designed to make building your app's checkout flow as easy as possible. It handles collecting, saving, and reusing your user's payment details, and can also be used to collect shipping info. If you'd like to useSTPPaymentContext
, please read our Standard Integration Guide. - If you find that
STPPaymentContext
isn't flexible enough for your needs, you can use the individual components that it uses under the hood. For this, please refer to our Custom Integration Guide. - If you'd like to use Sources with the iOS SDK, we have a separate guide to help you get started.