Credit Cards

Client-Side Implementationanchor

Get the SDKanchor

CocoaPodsanchor

Include Braintree in your podfile:

  1. Ruby
pod 'Braintree'

Swift Package Manageranchor

Include the BraintreeCard framework.

Carthageanchor

Include the BraintreeCore and BraintreeCard framework.

Initializationanchor

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.tokenizeCard(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.


Next Page: Server-side