Client-side Implementation

Before you can add PayPal Order, you will need to:
  1. Create, verify, and link your PayPal account in the Braintree Control Panel
  2. Integrate the Braintree iOS SDK and obtain your client token

Invoke PayPal Order flowAnchorIcon

You can provide your own button that starts the PayPal Order flow.
  1. Swift
var braintreeClient: BTAPIClient!

override func viewDidLoad() {
    super.viewDidLoad();
    self.braintreeClient = BTAPIClient(authorization: "<#CLIENT_AUTHORIZATION#>");
    let customPayPalButton = UIButton(frame: CGRect(x: 0, y: 0, width: 60, height: 120));
    customPayPalButton.addTarget(self, action: #selector(customPayPalButtonTapped(button:)), for: UIControlEvents.touchUpInside);
    self.view.addSubview(customPayPalButton);
}

func customPayPalButtonTapped(button: UIButton) {
    let payPalDriver = BTPayPalDriver(apiClient: self.braintreeClient);
    // Start the Checkout flow
    let payPalRequest = BTPayPalCheckoutRequest(amount: "1.00");
    payPalRequest.currencyCode = "USD"; // Optional; see BTPayPalCheckoutRequest.h for more options
    // Specify the intent on the request object
    payPalRequest.intent = .order;
    payPalDriver.tokenizePayPalAccount(with: payPalRequest) { (tokenizedPayPalAccount, error) -> Void in
        // ...
    };
}
After the customer completes the consent flow and the PayPal pop-up closes, successful tokenization will return a nonce. Send the nonce to your server and use a Braintree server SDK call to associate it to a customer's payment method. See the server-side section for various options for doing so.

Country supportAnchorIcon

PayPal is available to merchants in all countries that we support and to customers in 140+ countries.

Currency presentmentAnchorIcon

The currency of the transaction is presented to the customer in the Checkout with PayPal flow. We support all currencies that PayPal REST APIs support. See the server-side section for details on charging a transaction in a specific currency.

If you accept cookies, we’ll use them to improve and customize your experience and enable our partners to show you personalized PayPal ads when you visit other sites. Manage cookies and learn more