Braintree iOS SDK
Welcome to Braintree's iOS SDK. This library will help you accept card and alternative payments in your iOS app.
A new major version of the SDK is available in beta. See the v5 migration guide for details.
The Braintree iOS SDK requires Xcode 11+. It permits a Deployment Target of iOS 8.0 or higher.
Supported Payment Methods
Installation
We recommend using Swift Package Manager, CocoaPods, or Carthage to integrate the Braintree SDK with your project.
Swift Package Manager (v5 Beta)
This feature is only available in v5.0.0-beta1.
To add the Braintree
package to your Xcode project, select File > Swift Packages > Add Package Dependency and enter https://github.com/braintree/braintree_ios
as the repository URL. Tick the checkboxes for the specific Braintree libraries you wish to include.
If you look at your app target, you will see that the Braintree libraries you chose are automatically linked as a frameworks to your app (see General > Frameworks, Libraries, and Embedded Content).
In your app's source code files, use the following import syntax to include Braintree's libraries. For example:
import BraintreeCore
import BraintreeCard
import BraintreeApplePay
import BraintreePayPal
Binary Dependencies
There is a known Xcode bug, reported in this GitHub issue, on archiving apps that use binary dependencies via SPM. The workaround is to tick the checkbox to include these binary dependencies in your app.
To use the BraintreeDataCollector
library, you must also include the KountDataCollector
library via SPM.
The PayPalDataCollector
, BraintreePaymentFlow
, BraintreeThreeDSecure
, BraintreePayPal
, and BraintreeVenmo
libraries all require the PPRiskMagnes
library be included via SPM.
BraintreeThreeDSecure
To use the BraintreeThreeDSecure
library via SPM, you must manually include the CardinalMobile.framework
located in the Frameworks
dir.
Manually including a framework
- Drag and drop the framework from Finder into your Xcode project
- Select Copy items if needed
- Click Finish.
The result should look like:
- Open your project's settings by selecting your app target in the General tab
- Under the Frameworks, Libraries, and Embedded Content section, make sure each framework is set to “Embed & Sign”
- Under the Frameworks, Libraries, and Embedded Content section, make sure each framework is set to “Embed & Sign”
- Go to the Build Phases tab. Under Link Binary With Libraries, make sure the frameworks are listed. This should be taken care of by step #2 above, but if not, add the frameworks manually via the
+
button.
CocoaPods
# Includes Cards and PayPal
pod 'Braintree'
# Optionally include additional Pods
pod 'Braintree/DataCollector'
pod 'Braintree/Venmo'
Note: If you are using version 4.x.x of the Braintree iOS SDK in Xcode 12, you may see the warning The iOS Simulator deployment target is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99
. This will not prevent your app from compiling. This is a CocoaPods issue with a known workaround.
Carthage
Add github "braintree/braintree_ios"
to your Cartfile
, and add the frameworks to your project.
Note: Long term support for Carthage is not guaranteed. Please update to SPM, if possible. Open a GitHub issue if there are concerns.
Documentation
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, PayPal, and credit card tokenization.
Versions
This SDK abides by our Client SDK Deprecation Policy. For more information on the potential statuses of an SDK check our developer docs.
Major version number | Status | Released | Deprecated | Unsupported |
---|---|---|---|---|
5.x.x | Beta | December 2020 | TBA | TBA |
4.x.x | Active | November 2015 | TBA | TBA |
Demo
A demo app is included in the project. To run it, run pod install
and then open Braintree.xcworkspace
in Xcode.
Contributing
We welcome PRs to this repo. See our development doc.
Feedback
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
Help
- Read the headers
- Read the Braintree docs
- Check out the reference docs
- Find a bug? Open an issue
- Want to contribute? Check out contributing guidelines and submit a pull request.
License
The Braintree iOS SDK is open source and available under the MIT license. See the LICENSE file for more info.
Github
link |
Stars: 464 |
You may find interesting
Releases
5.0.0-beta2 - 2021-01-20T20:24:44
- Add SPM support for
BraintreeDataCollector
andBraintreeThreeDSecure
- Add SPM libraries for
KountDataCollector
andPPRiskMagnes
to workaround Xcode bug (addresses #576) - Bump Kount to v4.0.4.3 pre-release (provides an xcframework for SPM)
- Bump PPRiskMagnes to v5.10.0 (resolves #564)
- Fix Xcode 12.3 issue with building PPRiskMagnes.framework for iOS + iOS Simulator
- Add
accountType
toBTThreeDSecureRequest
- Breaking Changes
- Remove
type
andnonce
params onBTApplePayCardNone
initializer - Replace
uiCustomization
withv2UICustomization
onBTThreeDSecureRequest
- Introduce new classes for 3DS2 UI customization:
BTThreeDSecureV2UICustomization
BTThreeDSecureV2ButtonCustomization
BTThreeDSecureV2LabelCustomization
BTThreeDSecureV2TextBoxCustomization
BTThreeDSecureV2ToolbarCustomization
- Default
versionRequested
onBTThreeDSecureRequest
to 3DS2 instead of 3DS1
- Remove
4.37.0 - 2021-01-20T17:12:47
- Add
paymentTypeCountryCode
toBTLocalPaymentRequest
5.0.0-beta1 - 2020-12-01T20:57:23
- Add support for Swift Package Manager (resolves #462)
- Bump Kount to v4.0.4.2 (supports iOS 9.3+)
- Replace deprecated
SecTrustEvaluate
withSecTrustEvaluateWithError
(fixes #536) - Only check if the Venmo app is installed if the BraintreeVenmo module is being used (resolves #231)
- Breaking Changes
- Bump minimum supported deployment target to iOS 12
- Remove deprecated
BraintreeUI
module - Remove all deprecated methods and properties
- Core
- Remove the
localizedDescription
property onBTPaymentMethodNonce
- Update all methods on
BTAppSwitchDelegate
to be optional - Remove
options
andsourceApplication
params onBTAppSwitch
methods
- Remove the
- PaymentFlow
- Update dismiss button style from done to cancel for
SFSafariViewController
s presented via theBTPaymentFlowDriver
. This update applies to both the 3D Secure and Local Payments payment flows. - Remove the
localizedDescription
property onBTLocalPaymentResult
- Remove unused
BTPaymentFlowDriverErrorTypeInvalidRequestURL
option fromBTPaymentFlowDriverErrorDomain
- Update dismiss button style from done to cancel for
- PayPal
- Remove PayPalOneTouch and PayPalUtils modules
- Remove
authorizeAccountWithCompletion
andauthorizeAccountWithAdditionalScopes
methods fromBTPayPalDriver
- Remove
requestOneTimePayment
andrequestBillingAgreement
overloads with customhandler
parameters fromBTPayPalDriver
- Remove
viewControllerPresentingDelegate
property fromBTPayPalDriver
- Remove use of
SFSafariViewController
from PayPal flow - Replace deprecated
SFAuthenticationSession
withASWebAuthenticationSession
in PayPal flow - Update
requestBillingAgreement
andrequestOneTimePayment
completion blocks to return an error when user cancels the PayPal flow - Remove custom URL scheme requirement for PayPal flow
- Update
BTPayPalDriverErrorType
enum- Remove
BTPayPalDriverErrorTypeIntegrationReturnURLScheme
- Remove
BTPayPalDriverErrorTypeAppSwitchFailed
- Remove
BTPayPalDriverErrorTypeInvalidConfiguration
- Remove
- ThreeDSecure
- Remove deprecated
Braintree3DSecure
module - Restructure
BTThreeDSecureResult
andBTThreeDSecureLookup
- Create a stand-alone 3DS module
- Remove deprecated
- PayPalDataCollector
- Add
PPRiskMagnes.framework
andPPRiskMagnes.xcframework
v5.0.1 (requires Swift 5.1+) - Remove
collectPayPalDeviceInfoWithClientMetadataID
method onPayPalDataCollector.h
- Add
4.36.1 - 2020-11-10T17:49:37
- Update CardinalMobile.framework to v2.2.4-1
- Exclude arm64 simulator architectures via Podspec (fixes Drop-In #233)
4.36.0 - 2020-10-07T21:20:21
- Add
cardholderName
toBTCardNonce
- Add support for
PKPaymentNetworkMaestro
to Apple Pay configuration
4.35.0 - 2020-08-10T20:16:09
- Update CardinalMobile.framework to v2.2.3-1
- Add
expirationMonth
andexpirationYear
toBTCardNonce
- Update PPDataCollector
4.34.0 - 2020-06-09T20:42:57
- Add
environment
property toBTPayPalUAT
4.33.0 - 2020-04-17T16:04:28
- Add support for iOS 13
SceneDelegate
toBTAppSwitch
- Add
lastFour
property toBTCardNonce
- Make
BTURLUtils.h
public - Add support for authorizing the Braintree SDK with a
PayPalUAT
(universal access token) - Remove
AddressBook.framework
from Podspec (thanks @ignotusverum)
4.32.1 - 2020-02-21T20:40:03
- Fix crash when ThreeDSecureRequest amount field is set to NaN (resolves #507)
- Update CardinalMobile.framework to v2.2.2-1 for Carthage users
4.32.0 - 2020-02-18T22:07:12
- Update CardinalMobile.framework to v2.2.2-1
- Update
PPDataCollector
4.31.0 - 2020-01-15T15:38:16
- Add support for basic UI customization of 3DS1 flows. See
BTThreeDSecureV1UICustomization
.
4.30.2 - 2019-11-15T21:20:54
Updated CardinalMobile.framework to v2.2.1-2
4.30.1 - 2019-11-04T21:14:54
- Updated CardinalMobile.framework to v2.2.1
4.30.0 - 2019-10-01T21:20:05
- Fix nullability annotations on
BTPostalAddress
fields (resolves #472) - Add ability to request
AuthenticationInsight
when tokenizing a credit card, which can be used to make a decision about whether to perform 3D Secure verification - Set error message on
BTThreeDSecureInfo
when 3D Secure 2.0 challenge fails
4.29.0 - 2019-09-20T00:06:46
- Fix issue when returning from the Venmo app on iOS13
- Fix crash and return error when threeDSecureRequest.amount is nil and 3DS v1 is requested
4.28.0 - 2019-09-05T21:55:50
- Add ability to customize UI for 3D Secure challenge views
- Add authentication and lookup transaction status information to BTThreeDSecureInfo
4.27.1 - 2019-08-29T21:33:12
- Fix url parsing bug (thanks @pedrocid)
4.27.0 - 2019-08-15T22:54:27
- Remove unneeded pre-processor directives
- Added new fields to BTThreeDSecureInfo
4.26.3 - 2019-07-31T21:57:49
- Fixed issue with Carthage binary spec for CardinalMobile
4.26.2 - 2019-07-31T21:57:31
- Add support for CardinalMobile binary only framework when using Carthage
4.26.1 - 2019-07-26T21:57:14
- Update CardinalMobile to v2.1.4-2
- Fix issue distributing to App Store
4.26.0 - 2019-07-26T15:32:34
- Send analytics timestamps in milliseconds
- Fix crash on apps with deployment targets without minor version (thanks @squall09s)
- Add additional fields to BTThreeDSecureInfo
Please note: If you are using the BTPaymentFlow module, this release cannot be submitted to the App Store. Please use 4.26.1 in this case.
4.25.1 - 2019-07-15T18:52:32
- Correct importing of BTConfiguration+ThreeDSecure (thanks @ejensen)
- Add missing header documentation for BTThreeDSecureLookup
4.25.0 - 2019-07-13T02:20:24
- Update CardinalMobile to v2.1.4
- Remove use of
advertisingIdentifier
- Remove use of
4.24.0 - 2019-07-10T00:08:46
NOTE: This version of the SDK contains a known issue that has prevented some apps from being submitted to the App Store.
- Add 3DS 2 Support
- Update 3DS redirect to newest version
- Update platform to iOS 8.0 in podspec
- Remove location data from analytics collection
4.23.2 - 2019-06-20T17:47:57
- Fix issue that caused a crash when 3DS auth response is invalid
4.23.1 - 2019-06-17T19:03:51
- Update analytics parameters
- Update local payment endpoint
4.23.0 - 2019-03-07T18:48:43
- Add Hiper and Hipercard support
4.22.0 - 2019-01-30T22:21:55
- Add support for
BTPayPalLineItem
- Fix build issue for Demo app
4.21.0 - 2018-12-12T19:09:59
- Fix occasional crash in
libPPRiskComponent.a