Client-Side Implementation
Important
The SSL certificates for Braintree Mobile (iOS and Android) SDKs are set to expire on March 30, 2026. 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+ Android SDK to version 4.45.0+ or version 5.0.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.
Setup
Before you can add PayPal, you will need to:
- Create, verify, and link your PayPal account in the Braintree Control Panel
- Set up your Android SDK and obtain your client token
- Declare a URL scheme in your AndroidManifest
Using a Custom UI
You can optionally implement a custom button to start a PayPal flow.
Get the SDK
Add the following in your app-level build.gradle:
- Kotlin
- Groovy
dependencies {
implementation("com.braintreepayments.api:paypal:4.49.1")
}Initialization
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.
- Kotlin
- 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 data
There is additional data you can gather about your customers as they complete the payment process.
Next: Choose your integration
The rest of your configuration will be determined by how you'd like to use PayPal.
- Want a checkout from your cart or product page? Use One-Time Payments.
- Need a combination of features and Pay Later offers? Use Vaulted Payments.
- Want one-click payments for repeat customers? Have a subscription model? Use Recurring Payments.
See a detailed comparison of One-Time Payments, Vaulted Payments, and Recurring Payments.