PayPal
Client-Side Implementation
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 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
Get the SDK
Add the following in your app-level build.gradle
:
- Kotlin
- Groovy
dependencies {
implementation("com.braintreepayments.api:paypal:5.8.0")
}
Initialization
Create a PayPalLauncher
inside of your Activity's onCreate()
. Then, create a PayPalClient
with a Tokenization Key or Client Token and an appLinkReturnUrl
that is used to return to your app from the PayPal payment flows.
- Kotlin
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// PayPalLauncher must be initialized in onCreate
payPalLauncher = PayPalLauncher()
// can initialize the PayPalClient outside of onCreate if desired
payPalClient = PayPalClient(
context = this,
authorization = "[TOKENIZATION_KEY or CLIENT_TOKEN]",
appLinkReturnUrl = Uri.parse("https://merchant-app.com") // Merchant App Link
)
}
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.