braintree / braintree-android-google-payment

Google Payment component for our Braintree AndroidSDK
MIT License
3 stars 10 forks source link

getting authentication error #27

Open VanishaGaba opened 1 year ago

VanishaGaba commented 1 year ago

General information

I am trying to do gpay integration in my application, but getting authentication error, dont know what I am missing or where the issue is. Firstly I am initializing gpay with braintree client which works fine.On click on button this function (onGooglePayButtonClick()) get called but then dialog appears with authentication error IMG_20230309_111928

` googlePayClient = GooglePayClient(this, braintreeClient) googlePayClient.setListener(this) googlePayClient.isReadyToPay(requireActivity()) { isReadyToPay, error -> if (isReadyToPay) { vb.rlGpay.visibility = View.VISIBLE } }

fun onGooglePayButtonClick() { val googlePayRequest = GooglePayRequest()

    googlePayRequest.transactionInfo = TransactionInfo.newBuilder()
        .setTotalPrice("1.00")
        .setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
        .setCurrencyCode("USD")
        .build()

    googlePayClient.requestPayment(requireActivity(), googlePayRequest)
}

override fun onGooglePaySuccess(paymentMethodNonce: PaymentMethodNonce) { Log.d("paymentMethodNonce", "$paymentMethodNonce") }

override fun onGooglePayFailure(error: Exception) {
    if (error is UserCanceledException) {
        Log.d("error", "$error")
    } else {
        Log.d("error", "$error")
    }
}

`