braintree / braintree-web

A suite of tools for integrating Braintree in the browser
https://developer.paypal.com/braintree/docs/start/hello-client/javascript/v3
MIT License
442 stars 134 forks source link

Payment failed. Error 91564 - Cannot use a payment_method_nonce more than once #670

Closed sjh37 closed 1 year ago

sjh37 commented 1 year ago

I have just been sent this error today by a customer: image

I am using the Braintree v5.15.0 nuget package, and the following in the HTML page:

<script src='https://js.braintreegateway.com/web/dropin/1.33.4/js/dropin.min.js'></script>
<script>
    var client_token = "@Model.ClientToken";
    var threeDSecureParameters = {
        amount: '@Model.Total.ToString("F2")',
        email: '@Model.Email',
        billingAddress: {
            givenName: '@Model.FirstName',
            surname: '@Model.LastName',
            streetAddress: '@Model.Address1',
            extendedAddress: '@Model.Address2',
            locality: '@Model.City',
            region: '@Model.Region',
            postalCode: '@Model.PostalCode',
            countryCodeAlpha2: '@Model.CountryCode'
        }
    };
    var form = document.querySelector('#payment-form');

    braintree.dropin.create({
        authorization: client_token,
        container: '#bt-dropin',
        threeDSecure: true
    },
    function(createErr, instance) {
        form.addEventListener('submit',
            function(event) {
                event.preventDefault();
                instance.requestPaymentMethod({
                    threeDSecure: threeDSecureParameters
                }, function(err, payload) {
                    if (err) {
                        console.log('Error', err);
                        return;
                    }

                    // Add the nonce to the form and submit
                    document.querySelector('#PaymentMethodNonce').value = payload.nonce;
                    form.submit();
                });
            });
    });
</script>

Any ideas?

sjh37 commented 1 year ago

Checking the transaction, the customer used an AMEX card, and the transaction went through fine.

sjh37 commented 1 year ago

I have upgraded to version 1.34.0 of the dropin.min.js file. I'll let you know if any other customers see a problem

sjh37 commented 1 year ago

The log contains this, which is odd:

[2023-02-23 08:57:51 INF] CheckoutController.BuyNow: Attempting sale
[2023-02-23 08:57:53 INF] CheckoutController.BuyNow: Successful sale
[2023-02-23 08:57:54 INF] CheckoutController.BuyNow: Attempting sale

It's almost as if the browser tried to post the same sale twice, just 4 seconds apart.

Please close this issue if you think this behaviour was relevant to v1.33.4 of the drop-in.

hollabaq86 commented 1 year ago

please contact support if you're still encountering this issue.