PayPal

Client-Side Implementation

SetupAnchorIcon

Before you can add PayPal:

  1. Integrate the Braintree iOS SDK into your app
  2. Create, verify, and link your PayPal account in the Braintree Control Panel

Get the SDKAnchorIcon

CocoaPodsAnchorIcon

Include Braintree in your podfile:
  1. Ruby
pod 'Braintree'

Swift Package ManagerAnchorIcon

Include the BraintreePayPal and PayPalDataCollector frameworks.

CarthageAnchorIcon

Include the BraintreeCore,BraintreePayPal, PayPalDataCollector, and PPRiskMagnes frameworks.

Showing a PayPal buttonAnchorIcon

Initiaiting the PayPal authorization flow will present and dismiss an ASWebAuthenticationSession from your top-most view.

Using our Drop-in UIAnchorIcon

When using the Drop-in UI, a PayPal payment option will be shown alongside any other payment methods you've enabled.

For more details, see the Drop-in UI guide.

Using a custom UIAnchorIcon

You can implement a custom UI, such as your own PayPal button.
  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)

    // Important! Choose either Vault or Checkout flow
    // Start the Vault flow, or...
    let vaultRequest = BTPayPalVaultRequest()
    payPalDriver.tokenizePayPalAccount(with: vaultRequest) { (tokenizedPayPalAccount, error) in
        // ...
    }

    // ...start the Checkout flow
    let checkoutRequest = BTPayPalCheckoutRequest(amount: "1.00")
    payPalDriver.tokenizePayPalAccount(with: checkoutRequest) { (tokenizedPayPalAccount, error) in
        // ...
    }
}

Collecting additional dataAnchorIcon

You can gather additional data about your customers as they complete the payment process.

Note
See Braintree iOS Client SDK PayPal header files for in-depth documentation and additional custom PayPal integration options. See Braintree iOS Client SDK PayPal public properties for in-depth documentation and additional custom PayPal integration options.
Important
The SSL certificates for all Braintree SDKs are set to expire by June 30, 2025. This will impact existing versions of the SDK in published versions of your app. To reduce the impact, upgrade the iOS SDK to version 6.17.0+ for the new SSL certifications.

If you do not decommission your app versions that include the older SDK versions or force upgrade your app with the updated certificates by the expiration date, 100% of your customer traffic will fail.

Next: Choose your integration for iOS v5AnchorIcon

The rest of your configuration will be determined by how you'd like to use PayPal.

  • Want easy payments for repeat customers? Have a subscription model? Use our Vault.
  • Want a one-time payment checkout? Use Checkout with PayPal.
See a detailed comparison of Vault vs. Checkout.
Next Page: Vault

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