Client-Side Implementation

SetupAnchorIcon

Before you can add PayPal, you will need to:

  1. Create, verify, and link your PayPal account in the Braintree Control Panel
  2. Set up your Android SDK and obtain your client token
  3. Declare a URL scheme in your AndroidManifest

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 optionally implement a custom button to start a PayPal flow.

Get the SDKAnchorIcon

Add the following in your app-level build.gradle:

  1. Kotlin
  2. Groovy
dependencies {
    implementation("com.braintreepayments.api:paypal:4.49.1")
}

InitializationAnchorIcon

Create a BraintreeClient with a ClientTokenProvider or Tokenization Key. Construct a PayPalClient, and add a click listener to your button to initiate the PayPal flow. For a complete integration example, see the Vault or Checkout pages.

  1. Kotlin
  2. Java
class MyActivity : AppCompatActivity() {

  private lateinit var braintreeClient: BraintreeClient
  private lateinit var payPalClient: PayPalClient

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    braintreeClient = BraintreeClient(this, ExampleClientTokenProvider())
    payPalClient = PayPalClient(this, braintreeClient)
  }

  private fun onPayPalButtonClick(view: View) {
    // The PayPalRequest type will be based on integration type (Checkout vs. Vault)  
    payPalClient.tokenizePayPalAccount(this, payPalRequest) 
  }
}

Collecting additional dataAnchorIcon

There is additional data you can gather 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 One-Time Payments, Vaulted Payments, and Recurring Payments.