iOS v3 is deprecated. We recommend migrating to the latest version of our iOS SDK. The best way to start is by making an incremental upgrade from v3 to v4.


In order to use the Drop-in UI, you'll first need to generate a client token on your server.


Upgrade to iOS v4 to use a tokenization key, a static form of client authorization obtained from the Control Panel.

Client-side implementation

Once you've set up and initialized the Braintree SDK, you can create and present the Drop-in view controller.

Declare a class that conforms to the BTDropInViewControllerDelegate protocol to receive the user's payment method.

#import <Braintree/Braintree.h>

@interface MyViewController () <BTDropInViewControllerDelegate>

@property (nonatomic, strong) Braintree *braintree;


In your implementation, use the client token obtained from your server to initialize the Braintree SDK. Then, create a BTDropInViewController.

#import "MyViewController.h"

@implementation MyViewController

// ...

// With this example, you should ensure that your users can't tap the pay button until
// the client token has been obtained from your server and has been used to create a
// Braintree instance.

- (IBAction)tappedMyPayButton {

  // If you haven't already, create and retain a `Braintree` instance with the client token.
  // Typically, you only need to do this once per session.
  //self.braintree = [Braintree braintreeWithClientToken:CLIENT_TOKEN_FROM_SERVER];

  // Create a BTDropInViewController
  BTDropInViewController *dropInViewController = [self.braintree dropInViewControllerWithDelegate:self];
  // This is where you might want to customize your Drop in. (See below.)

  // The way you present your BTDropInViewController instance is up to you.
  // In this example, we wrap it in a new, modally presented navigation controller:
  dropInViewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel

  UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:dropInViewController];
  [self presentViewController:navigationController animated:YES completion:nil];

- (void)userDidCancelPayment {
    [self dismissViewControllerAnimated:YES completion:nil];

Then implement BTDropInViewControllerDelegate to obtain the payment method nonce on success, and dismiss the Drop In UI in either case:

- (void)dropInViewController:(__unused BTDropInViewController *)viewController didSucceedWithPaymentMethod:(BTPaymentMethod *)paymentMethod {
    [self postNonceToServer:paymentMethod.nonce]; // Send payment method nonce to your server
    [self dismissViewControllerAnimated:YES completion:nil];

- (void)dropInViewControllerDidCancel:(__unused BTDropInViewController *)viewController {
    [self dismissViewControllerAnimated:YES completion:nil];

Location Permissions

The Braintree iOS SDK uses device and browser location data for fraud detection when available (i.e. when location permissions have already been requested by your app and granted by the user). While you do not need to request location data from users in order to use Braintree, Apple requires a NSLocationWhenInUseUsageDescription key in your Info.plist if your app contains code referencing location APIs. If your app does not request location data, you will still need to include a NSLocationWhenInUseUsageDescription plist entry.

Next steps

Next Page: Customization →