We've made some big improvements to the Braintree iOS SDK in version 4.0.
Because the Braintree iOS SDK follows Semantic Versioning, version 4.0 contains API and architectural changes that require updates when upgrading from 3.x.
We believe this release will simplify your integration and provide more flexibility.
- Slimmer SDK size: integrate only the payment options you use
- Use PayPal One Touch™ to accept PayPal payments by switching to the mobile browser. If the app/browser has an active session, then login is not required.
- One Touch™ provides a Checkout flow for accepting one-time payments via PayPal
- More ways to integrate: Carthage, static library (coming soon)
- Block-based APIs
- Nullability annotation for improved Swift interop
The Braintree iOS SDK requires Xcode 7+ and a base SDK of 9.0+. It supports devices running iOS 7 and above.
The Getting Started section of the README has more information.
The setup and initialization of the SDK has changed slightly. The
Braintree class has been replaced by
#import "BraintreeCore.h" BTAPIClient *apiClient = [[BTAPIClient alloc] initWithAuthorization:@"<#CLIENT_AUTHORIZATION#>"];
Previously in 3.x,
BTPaymentProvider was a centralized provider of
BTPaymentMethod objects for each payment option. In 4.0, this has been re-architected so that each payment option has its own class responsible for tokenizing payment methods.
These classes are called drivers when they involve some UI interaction, or clients when they are headless:
Payment option clients and drivers use block-based APIs to return
BTPaymentMethodNonce instances that have a
Drivers have a required
viewControllerPresentingDelegate property, which should be set to your view controller, which is responsible for modally presenting and dismissing the view controllers required to finalize payments.
See each class's header file for more information.
BTAPIClient can also be initialized with a tokenization key, which is a static Braintree API key that is specified at compile-time. Tokenization keys support a subset of the client token's capabilities, but they have the advantage of allowing you to start interacting with our services without the overhead of a network call to generate a client token.
The components of the Braintree iOS SDK have been renamed, and each component has an umbrella header that imports the publicly available classes for that component:
|Apple Pay||#import "BraintreeApplePay.h"|
|3D Secure||#import "Braintree3DSecure.h"|
|Data Collector||#import "BraintreeDataCollector.h"|
BTClientCardTokenizationRequesthas been replaced with
BTClientCardRequest's functionality has been squashed into
BTPayPalDriverto initiate PayPal payment flows.
Braintree-PayPal.hhas been replaced with
Braintree-Payments-UI.hhas been replaced with
- Uses a block-based API instead of a delegate to return payment method nonces
paymentProviderTypeshas been replaced with the
- Data has been renamed to DataCollector. For example, if you have
pod 'Braintree/Data'in your Podfile, rename it to
Still have questions?
If you can’t find an answer, contact our Support team.