Software
#import "MyViewController.h"
@implementation MyViewController
// ...
- (void)tappedMyPayButton {
// Create and retain a `Braintree` instance with the client token
self.braintree = [Braintree braintreeWithClientToken:self.clientToken];
// 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
target:self
action:@selector(userDidCancelPayment)];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:dropInViewController];
[self presentViewController:navigationController
animated:YES
completion:nil];
}
- (void)userDidCancelPayment {
[self dismissViewControllerAnimated:YES completion:nil];
}