Credit Cards
Client-Side Implementation
Important
The SSL certificates for all Braintree SDKs are set to expire by June 30, 2025. This will impact existing versions of the SDK in published versions of your app. To reduce the impact, upgrade the iOS SDK to version 6.17.0+ for the new SSL certifications.
If you do not decommission your app versions that include the older SDK versions or force upgrade your app with the updated certificates by the expiration date, 100% of your customer traffic will fail.Get the SDK
CocoaPods
Include Braintree in your podfile:
- Ruby
pod 'Braintree'
Swift Package Manager
Include the BraintreeCard framework.
Carthage
Include the BraintreeCore and BraintreeCard framework.
Initialization
To use our card payment processing with your own UI, instantiate a BTCardClient and tokenize the card details.
- Swift
// For client authorization,
// get your tokenization key from the Control Panel
// or fetch a client token
let braintreeClient = BTAPIClient(authorization: "<#CLIENT_AUTHORIZATION#>")!
let cardClient = BTCardClient(apiClient: braintreeClient)
let card = BTCard()
card.number = "4111111111111111"
card.expirationMonth = "12"
card.expirationYear = "2025"
cardClient.tokenize(card) { tokenizedCard, error in
// Communicate the tokenizedCard.nonce to your server, or handle error
}
In the completion block, send the resulting nonce to your server for use.
Note
See the reference docs for in-depth documentation.