Welcome to Braintree's v.zero SDK for iOS. This library will help you accept card and PayPal payments in your iOS app.
The Braintree iOS SDK requires Xcode 7+ and a Base SDK of iOS 9+. It permits a Deployment Target of iOS 7.0 or higher.
The current major version is 4.x. If you are upgrading from version 3.x, take a look at our Braintree iOS 3.x to 4.x Migration Guide.
If you're looking to integrate version 4 and you need to accept payments with Venmo, please contact Braintree Support about joining the beta program for Pay with Venmo. If you are using Version 3 of the iOS SDK, it fully supports accepting payments via Venmo One Touch.
We recommend using either CocoaPods or Carthage to integrate the Braintree SDK with your project.
Add to your Podfile
:
pod 'Braintree'
Then run pod install
. This includes everything you need to accept card and PayPal payments. It also includes our Drop-in UI and payment button.
Customize your integration by specifying additional components. For example, add Apple Pay support:
pod 'Braintree'
pod 'Braintree/Apple-Pay'
You can also strip down your integration to only support credit and debit cards:
pod 'Braintree/Card'
See our Podspec
for more information.
Although we recommend upgrading to the latest version of our SDK, you can choose to remain on the 3.x version, e.g.
pod 'Braintree', '~> 3.9'
Add github "braintree/braintree_ios"
to your Cartfile
, and add the frameworks to your project.
Please follow the static library integration instructions.
For v3 integrations, please follow the v3 manual integration instructions.
Complete v4 manual integration instructions are still in-progress. Note that for apps targeting iOS 8+, you may add Braintree.xcodeproj
to your Xcode workspace and add the frameworks to the app target Embedded Binaries section.
Support for iOS 9 requires a few configuration changes with your Xcode project, detailed below.
iOS 9 introduces new security requirements and restrictions. If your app is compiled with iOS 9 SDK, it must comply with Apple's App Transport Security policy.
The Braintree Gateway domain complies with this policy.
3D Secure uses third party domains, which may need to be whitelisted for ATS, as part of the authentication process.
If your app is compiled with iOS 9 SDK and integrates payment options with an app-switch workflow, you must add URL schemes to the whitelist in your application's plist.
If your app supports payments from PayPal:
com.paypal.ppclient.touch.v1
com.paypal.ppclient.touch.v2
If your app supports payments from Venmo:
com.venmo.touch.v2
For example, if your app supports PayPal, you could add the following:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>com.paypal.ppclient.touch.v1</string>
<string>com.paypal.ppclient.touch.v2</string>
</array>
There is a new UIApplicationDelegate
method that you may implement on iOS 9:
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options
Implementing this method is optional. If you do not implement it, the deprecated equivalent will still be called; otherwise, it will not.
In either case, you still need to implement the deprecated equivalent in order to support iOS 8 or earlier:
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
The Braintree SDK works with apps that have bitcode enabled.
Start with 'Hello, Client!' for instructions on basic setup and usage.
Next, read the full documentation for information about integration options, such as Drop-In UI, custom payment button, and credit card tokenization.
Finally, cocoadocs.org/docsets/Braintree hosts the complete, up-to-date API documentation generated straight from the header files.
A demo app is included in project. To run it, run pod install
and then open Braintree.xcworkspace
in Xcode.
- Read the headers
- Read the docs
- Find a bug? Open an issue
- Want to contribute? Check out contributing guidelines and submit a pull request.
The Braintree iOS SDK is in active development, we welcome your feedback!
Here are a few ways to get in touch:
- GitHub Issues - For generally applicable issues and feedback
- Braintree Support / support@braintreepayments.com - for personal support at any phase of integration
The Braintree iOS SDK is open source and available under the MIT license. See the LICENSE file for more info.