Express Checkout Client-Side REST, onError function is not executing on retries

CSolorzano
Contributor
Contributor

Hi everyone,

 

I detect a possible bug in the Express Checkout Client-Side REST integration:

 

I malformed the payment object adding an extra unexpected element. When I click the paypal button onError function is called and the process is interrupted. But if I retry clicking again the paypal button, the process is interruptep but onError function is NOT called again.

 

I was testing the sandbox environment so I don't know if this bug exists or not in production environment.

 

You can replicate this possible bug using the interactive demo with the next code:

<!DOCTYPE html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="https://www.paypalobjects.com/api/checkout.js"></script>
</head>
<body>
    <div id="paypal-button-container"></div>
    <script>
        paypal.Button.render({
            env: 'sandbox', // sandbox | production
            // PayPal Client IDs - replace with your own
            // Create a PayPal app: https://developer.paypal.com/developer/applications/create
            client: {
                sandbox:    'AZDxjDScFpQtjWTOUtWKbyN_bDt4OgqaF4eYXlewfBP4-8aqX3PiV8e1GWU6liB2CUXlkA59kJXE7M6R',
                production: '<insert production client id>'
            },
            // Show the buyer a 'Pay Now' button in the checkout flow
            commit: true,
            // payment() is called when the button is clicked
            payment: function(data, actions) {
                // Make a call to the REST api to create the payment
                return actions.payment.create({
                    payment: {
                        transactions: [
                            {
                                amount: { total: '0.01', currency: 'USD' }
                            }
                        ],
                        testError: true
                    }
                });
            },
            // onAuthorize() is called when the buyer approves the payment
            onAuthorize: function(data, actions) {
                // Make a call to the REST api to execute the payment
                return actions.payment.execute().then(function() {
                    window.alert('Payment Complete!');
                });
            },
            onError: function(err){
                window.alert(err.message);
            }
        }, '#paypal-button-container');
    </script>
</body>
Login to Me Too
3 REPLIES 3

MTS_Andre
Moderator
Moderator

Hi, checking with some testing.

Login to Me Too

Alaysor
New Community Member

Are there any updates on this issue? It's the critical bug in UX and the only workaround I see here is to reload the page right after the error but that's insane!

Login to Me Too

nodeguy
New Community Member

Any update on this issue? I'm still experiencing this almost a year later...

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.