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

Cannot use a payment_method_nonce more than once BUT Transaction went through #112

Closed AACKL closed 5 years ago

AACKL commented 5 years ago

General information

Issue description:

Credit and Debit payment is working fine but payment via paypal is throwing me this: "Braintree\Result\Error[errors=[Braintree\Error\ValidationErrorCollection/errors:[( )]], params=transaction=type=sale, amount=99, paymentMethodNonce=69bf1023-ca71-0b65-698c-daa1416a3e66, options=submitForSettlement=true, message=Cannot use a payment_method_nonce more than once., creditCardVerification=, transaction=, subscription=, merchantAccount=, verification=]"

Paypal sandbox and Braintree sandbox shows that the transaction went through: https://drive.google.com/file/d/1naZB-TqvUG9eeHkzshs7zYjrTN8Q0E8x/view?usp=sharing https://drive.google.com/file/d/1WXyp55zxrP4GMmZWPJnQWRhnxWV9w8B3/view?usp=sharing

Also, I've recorded the nonce for the last 2 transaction and it shows that they're completely different to each other: Transaction 1: cabb5b89-db44-0937-5fca-b36f5e6c8764 Transaction 2: b2026353-6edd-07c6-630b-b6b6eca87dab

I've added this on my manifest: <activity android:name="com.braintreepayments.api.BraintreeBrowserSwitchActivity" android:launchMode="singleTask">

    </activity>

OnActivityResult: if (requestCode == REQUEST_CODE){ if (resultCode == RESULT_OK){ DropInResult result = data.getParcelableExtra(DropInResult.EXTRA_DROP_IN_RESULT); PaymentMethodNonce nonce = result.getPaymentMethodNonce(); String strNonce = nonce.getNonce();

            if(!edt_amount.getText().toString().isEmpty()){
                amount = edt_amount.getText().toString();
                paramsHash = new HashMap<>();
                paramsHash.put("amount",amount);
                paramsHash.put("nonce",strNonce);

                sendPayments();
            }
        }

How I send the nonce back to the server: RequestQueue queue = Volley.newRequestQueue(PaymentActivity.this); StringRequest stringRequest = new StringRequest(Request.Method.POST, API_CHECK_OUT, new Response.Listener() { @Override public void onResponse(String response) { if (response.contains("Successful")){ Toast.makeText(PaymentActivity.this, "Transacton successful!", Toast.LENGTH_SHORT).show(); } else{ Toast.makeText(PaymentActivity.this, "Transaction Failed", Toast.LENGTH_SHORT).show(); }

quinnjn commented 5 years ago

Hi @AACKL

Your manifest wasn't posted so I wasn't able to verify it but given that you're getting nonces back so the Android integration looks fine.

Unfortunately thats as much support as I can give here since this is support issues for the SDK itself and not Braintree overall. You can reach out to our Braintree support team who are better equipped to help you with issues with the gateway and transactions.

Please reach out to our support team referencing this issue and your sandbox merchant ID so we can troubleshoot what is going wrong. https://help.braintreepayments.com/