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, BraintreeDataCollector, 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 Payment ButtonsAnchorIcon

You can add PayPal payment buttons in your app through the Braintree SDK. The SDK will handle the loading and disable state of the button, call the `tokenize` methods with your request, and allow you a seamless branded experience in your mobile apps.

The SDK handles the complete payment flow internally, from launching the PayPal authentication to tokenizing the result, so you only need to provide your request configuration and handle the final nonce.

Here's how to integrate using SwiftUI:AnchorIcon

  1. Swift
let payPalRequest = BTPayPalCheckoutRequest(amount: "10.00")

let payPalButtonView = PayPalButton(
    authorization: authorization,
    request: payPalRequest,
    color: .blue, // choose between `.blue`, `.black`, `.white`
    width: 300
) { nonce, error in
    if let nonce {
        // handle successful PayPal payment
    } else if let error {
        // handle PayPal payment error
    }
}

Here's how to integrate using UIKit (wrapped SwiftUI):

  1. Swift
let payPalRequest = BTPayPalCheckoutRequest(amount: "10.00")

let payPalButtonView = PayPalButton(
    authorization: authorization,
    request: payPalRequest,
    color: .blue,
    width: 300
) { nonce, error in
    if let nonce {
        // handle successful PayPal payment
    } else if let error {
        // handle PayPal payment error
    }
}

let hostingController = UIHostingController(rootView: payPalbuttonView)
addChild(hostingController)

Collecting additional dataAnchorIcon

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

Next: Choose your integrationAnchorIcon

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

See a detailed comparison of Vault vs. Checkout.