Client-Side Implementation

Get the SDKAnchorIcon

CocoaPodsAnchorIcon

Include Braintree in your podfile:

  1. Ruby
pod 'Braintree'

Swift Package ManagerAnchorIcon

Include the BraintreeCard framework.

CarthageAnchorIcon

Include the BraintreeCore and BraintreeCard framework.

InitializationAnchorIcon

To use our card payment processing with your own UI, instantiate a BTCardClient and tokenize the card details.

  1. 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.