Braintree Android Drop-In is a readymade UI that allows you to accept card and alternative payments in your Android app.
The Android Drop-In SDK is currently inactive and will be unsupported by November 2025. As of December 2024, the Android Drop-In SDK is inactive. No additional features will be added with the exception of security updates. As an alternative, we recommend using the for unbranded checkout.
This SDK abides by our Client SDK Deprecation Policy. For more information on the potential statuses of an SDK check our .
Status | Date |
---|---|
Inactive | December 2024 |
Deprecated | June 2025 |
Unsupported | November 2025 |
Add the dependency in your build.gradle
:
dependencies {
implementation 'com.braintreepayments.api:drop-in:6.16.0'
}
Additionally, add the following Maven repository and (non-sensitive) credentials to your app-level gradle:
repositories {
maven {
url "https://cardinalcommerceprod.jfrog.io/artifactory/android"
credentials {
username 'braintree_team_sdk'
password 'cmVmdGtuOjAxOjIwMzgzMzI5Nzg6Q3U0eUx5Zzl5TDFnZXpQMXpESndSN2tBWHhJ'
}
}
}
To preview the latest work in progress builds, add the following SNAPSHOT dependency in your build.gradle
:
dependencies {
implementation 'com.braintreepayments.api:drop-in:6.16.1-SNAPSHOT'
}
You will also need to add the Sonatype snapshots repo to your top-level build.gradle
to import SNAPSHOT builds:
allprojects {
repositories {
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
}
This SDK abides by our Client SDK Deprecation Policy. For more information on the potential statuses of an SDK, check our developer docs.
Major version number | Status | Released | Deprecated | Unsupported |
---|---|---|---|---|
6.x.x | Inactive | November 2021 | June 2025 | November 2025 |
5.x.x | Unsupported | September 2020 | November 2022 | November 2023 |
4.x.x | Unsupported | February 2019 | September 2021 | September 2022 |
Versions 3 and below are unsupported.
Create a DropInRequest
to start the Drop-in UI with specified options:
val dropInRequest = DropInRequest()
DropInClient
is responsible for launching the Drop-in UI. To launch Drop-in, instantiate a DropInClient
with client authorization and call DropInClient#launchDropInForResult
with the DropInRequest
you configured above and a request code that you have defined for Drop-in:
val dropInClient = DropInClient(this, "<#CLIENT_AUTHORIZATION#>")
dropInClient.setListener(this)
dropInClient.launchDropIn(dropInRequest)
To handle the result of the Drop-in flow, implement DropInListener
methods onDropInSuccess()
and onDropInFailure()
:
override fun onDropInSuccess(result: DropInResult) {
// use the result to update your UI and send the payment method nonce to your server
val paymentMethodNonce = result.paymentMethodNonce?.string
}
override fun onDropInFailure(error: Exception) {
// an error occurred, checked the returned exception
}
Drop-In is currently localized for 25 languages. To view localized text for a specific locale, open its corresponding values-<LOCALE_NAME>/strings.xml
resource file.
Drop-In supports 3D-Secure verification. Assuming you have 3D-Secure configured for your account, create a ThreeDSecureRequest() object, setting ThreeDSecurePostalAddress
and ThreeDSecureAdditionalInformation
fields where possible; the more fields that are set, the less likely a user will be presented with a challenge. For more information, check our 3D Secure Migration Guide. Make sure to attach this object to the BTDropInRequest
before use.
val address = ThreeDSecurePostalAddress()
address.givenName = "Jill" // ASCII-printable characters required, else will throw a validation error
address.surname = "Doe" // ASCII-printable characters required, else will throw a validation error
address.phoneNumber = "5551234567"
address.streetAddress = "555 Smith St"
address.extendedAddress = "#2"
address.locality = "Chicago"
address.region = "IL"
address.postalCode = "12345"
address.countryCodeAlpha2 = "US"
// Optional additional information.
// For best results, provide as many additional elements as possible.
val additionalInformation = ThreeDSecureAdditionalInformation()
additionalInformation.shippingAddress = address
val threeDSecureRequest = ThreeDSecureRequest()
threeDSecureRequest.amount = "1.00"
threeDSecureRequest.email = "test@email.com"
threeDSecureRequest.billingAddress = address
threeDSecureRequest.versionRequested = VERSION_2
threeDSecureRequest.additionalInformation = additionalInformation
val dropInRequest = DropInRequest()
dropInRequest.threeDSecureRequest = threeDSecureRequest
If your user already has an existing payment method, you may not need to show Drop-in. You can check if they have an existing payment method using DropInClient#fetchMostRecentPaymentMethod
. A payment method will only be returned when using a client token created with a customer_id
.
val dropInClient = DropInClient(this, "<#CLIENT_TOKEN_WITH_CUSTOMER_ID>", dropInRequest)
dropInClient.fetchMostRecentPaymentMethod(this) { dropInResult, error ->
error?.let {
// an error occurred
}
dropInResult?.let { result ->
result.paymentMethodType?.let { paymentMethodType ->
// use the icon and name to show in your UI
val icon = paymentMethodType.drawable
val name = paymentMethodType.localizedName
if (paymentMethodType == DropInPaymentMethod.GOOGLE_PAY) {
// The last payment method the user used was Google Pay.
// The Google Pay flow will need to be performed by the
// user again at the time of checkout.
} else {
// Show the payment method in your UI and charge the user
// at the time of checkout.
val paymentMethod = result.paymentMethodNonce
}
}
} ?: run {
// there was no existing payment method
}
}
- Read the javadocs
- Read the docs
- Find a bug? Open an issue
- Want to contribute? Check out contributing guidelines and submit a pull request.
Here are a few ways to get in touch:
- GitHub Issues - For generally applicable issues and feedback
- Braintree Support / Get Help - for personal support at any phase of integration
Braintree Android Drop-In is open source and available under the MIT license. See the LICENSE file for more info.