Android v1 is deprecated. We recommend migrating to the latest version of our Android SDK. The best way to start is by making an incremental upgrade from v1 to v2.


We have upgraded our 3D Secure integration in preparation for 3DS 2 and PSD2 Strong Consumer Authentication (SCA) compliance requirements in 2019.

See our 3DS 2 Adoption guide for details.

Payment flow

Generate a client token


You must generate a client token if you want to use 3D Secure. Tokenization keys can't be used when processing 3D Secure transactions.

Before you can call Braintree#startThreeDSecureVerification, you will need to setup the SDK and initialize Braintree with a client token generated on your server.

If you are not using Gradle to integrate Braintree, make sure to add the 3D Secure Activity to your AndroidManifest.xml:

<activity android:name="com.braintreepayments.api.threedsecure.ThreeDSecureWebViewActivity" />

Specify a merchant account

If you would like to use a merchant account ID other than your default, specify the merchant_account_id when generating the client token.


This merchant account ID must match the merchant account ID used to create the transaction.

Render a checkout page

You can structure your native checkout flow however you'd like. If you don't already have a credit card form, consider our Drop-in UI.

When the user taps on the final checkout button, but before creating a transaction on your server, you should call Braintree#startThreeDSecureVerification.

Your ErrorListener setup with Braintree should be prepared to handle any errors with the 3D Secure verification.

Verify a credit card

Once you initialize an instance of Braintree, you can verify transactions with Braintree#startThreeDSecureVerification. This call will refer to the card data based on the payment method nonce and challenge the cardholder with a 3D Secure authentication, if the card is enrolled in a 3D Secure program (e.g. Verified by Visa).

The transaction amount is required at verification for two reasons. First of all, it's an additional check to make sure the transaction being verified is the same as the one that is eventually authorized and settled. For this reason, the amount submitted for verification must match the amount sent to the Braintree server for authorization. Additionally, some issuers use the amount to help determine whether they should challenge the user to authenticate.

braintree.startThreeDSecureVerification(activity, requestCode, nonce, amount);

If a user-facing authentication flow is required, an Activity will be presented to the user.

Once the user completes the 3D Secure process, the Activity will receive a call to Activity#onActivityResult with an Activity.RESULT_OK or Activity.RESULT_CANCELED responseCode. If the responseCode is Activity.RESULT_OK you should call Braintree.finishThreeDSecureVerification and be prepared to handle the errors in you ErrorListener or the nonce in your PaymentMethodNonceListener. When your PaymentMethodNonceListener receives a nonce, transmit the nonce to your server and create a transaction.

public void onPaymentMethodNonce(String paymentMethodNonce) {
  // TODO: Upload paymentMethodNonce to your server

public void onRecoverableError(ErrorWithResponse error) {
  // TODO: handle errors

public void onActivityResult(int requestCode, int responseCode, Intent data) {
  if (requestCode = THREE_D_SECURE_REQUEST_CODE) {
    if (responseCode == Activity.RESULT_OK) {
      braintree.finishThreeDSecureVerification(responseCode, data);

If the user cancels the 3D Secure authentication, Activity#onActivityResult will receive Activity.RESULT_CANCELED. In order to perform 3D Secure again, a new nonce or the same card details will need to be supplied to Braintree#startThreeDSecureVerification again.

Verify a vaulted credit card

First, on the server, generate and return a payment method nonce for the vaulted credit card.

Then on the client, you can use the Braintree#startThreeDSecureVerification method just as before and pass it the newly-generated nonce.

braintree.startThreeDSecureVerification(activity, requestCode, NONCE_FROM_YOUR_SERVER, amount);

Verify a card from raw details or a payment method

To perform a verification on raw card details, we provide a convenience method:

CardBuilder cardBuilder = new CardBuilder()

braintree.startThreeDSecureVerification(activity, requestCode, cardBuilder, amount);

Advanced client-side options

We expose additional information about the authentication request that you can use for more advanced UI flows or risk assessment. You should be aware that making such assessments may result in accepting the liability for fraudulent transactions.

These parameters pass through the client-side first and should not be trusted for your server-side risk assessment. They should be used for UI flow only.

public void onPaymentMethodCreated(PaymentMethod paymentMethod) {
  Card card = (Card) paymentMethod;

  boolean liabilityShifted = card.getThreeDSecureInfo().isLiabilityShifted(); // true || false
  boolean liabilityShiftPossible = card.getThreeDSecureInfo().isLiabilityShiftPossible(); // true || false
  1. liabilityShifted indicates that 3D Secure worked and authentication succeeded. This will also be true if the issuing bank does not support 3D Secure, but the payment method does. In both cases, the liability for fraud has been shifted to the bank. You should go on creating a transaction using the new nonce.
  2. liabilityShiftPossible indicates that the payment method was eligible for 3D Secure. If liabilityShifted is false, then the user failed 3D Secure authentication. In this situation, the card brands recommend asking the user for another form of payment. However, if you have server-side risk assessment processes that allow for it, you can still use the new nonce to create a transaction. If you want to use a nonce that did not pass 3D Secure authentication, you need to set the required option to false in your server integration.
  3. If both of the above values are false then this card was ineligible for 3D Secure. You can continue to create the transaction with the new nonce. However, liability shift will not apply to this transaction. This case may be useful if you would like to ask the user for additional verification (AVS, etc).

For American Express SafeKey, liabilityShifted may be returned as true but Amex may later revoke the liability shift for the transaction based on your merchant behavior and fraud rate.

Next Page: Server-side →