braintree / braintree-android-drop-in

Braintree Drop-In SDK for Android
https://developers.braintreepayments.com/guides/drop-in/android/v2
MIT License
124 stars 79 forks source link

Tokenization key authorization not allowed for this endpoint. Please use an authentication method with upgraded permissions #301

Closed aanalmehta closed 2 years ago

aanalmehta commented 2 years ago

General information

Issue description I am trying to make payment using Braintree. When I makePayment, add card screen of Braintree is opened successfully but when I entered the information and click on Add Card button, it results error in onActivityResult method with the following error:

Tokenization key authorization not allowed for this endpoint. Please use an authentication method with upgraded permissions

Here is the code I am using:

private fun makePayment() {
        val billingAddress = ThreeDSecurePostalAddress()
            .givenName(Constants.USER?.firstName)
            .surname(Constants.USER?.lastName)
            .phoneNumber(Constants.USER?.mobileNo)
            .streetAddress(viewModel.address?.addr1)
            .extendedAddress(viewModel.address?.addr2)
            .locality(viewModel.address?.city)
            .region(viewModel.address?.state)
            .postalCode(viewModel.address?.zipCode)
            .countryCodeAlpha2(viewModel.address?.country?.let { getCountryCode(it) })

        val additionalInformation = ThreeDSecureAdditionalInformation()
            .accountId("account-id")
        val threeDSecureRequest = ThreeDSecureRequest()
            .amount(productAmount.toString())
            .versionRequested(ThreeDSecureRequest.VERSION_2)
            .email(Constants.USER?.email)
            .mobilePhoneNumber(Constants.USER?.mobileNo)
            .billingAddress(billingAddress)
            .additionalInformation(additionalInformation)

// Optional additional information.
// For best results, provide as many of these elements as possible.

// Optional additional information.
// For best results, provide as many of these elements as possible.

        val dropInRequest = DropInRequest()
            .clientToken(getEnvironmentTokenizationKey(getAppActivity()))
            .requestThreeDSecureVerification(true)
            .threeDSecureRequest(threeDSecureRequest)

        startActivityForResult(dropInRequest.getIntent(context), Constants.DROP_IN_REQUEST)
    }
sshropshire commented 2 years ago

Hi @aanalmehta thanks for using the Braintree SDK for Android. Our 3D Secure feature requires a client token to work. Please refer to the documentation on how to generate a client token.