Braintree Android Drop-In
Braintree Android Drop-In is a readymade UI that allows you to accept card and alternative payments in your Android app.
Adding it to your project
Add the dependency in your build.gradle
:
To use the latest build from the master
branch use:
Usage
Create a DropInRequest
and use the Intent
to start Drop-In:
Handle the response:
Localization
Drop-In is currently localized for 23 languages. To view localized text for a specific locale, open its corresponding values-<LOCALE_NAME>/strings.xml
resource file.
3D Secure + Drop-in
The new Drop-In supports 3D-Secure verification. Assuming you have 3D-Secure configured for your account, enable it in your client with DropInRequest.requestThreeDSecureVerification(true)
and set an amount. Then, 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.
Fetch last used payment method
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 DropInResult#fetchDropInResult
. Note that a payment method will only be returned when using a client token created with a customer_id
.