Paypal-checkout-components: Error during payment `Payment could not be executed\n at handleExecuteError....`

Created on 1 Aug 2018  ยท  16Comments  ยท  Source: paypal/paypal-checkout-components

We've got an issue. Could you advice on it...?

Our usage is very simple and is similar to demo app and if to simplify it looks like this :

        paypal.Button.render({
            env: 'production', 
            client: {
                sandbox:    '<client id>',
                production: '<insert production client id>'
            },
            commit: true,

            payment: function(data, actions) {
                return actions.payment.create({
                    payment: {
                        transactions: [
                            {
                                amount: { total: '0.01', currency: 'USD' }
                            }
                        ]
                    }
                });
            },

            onAuthorize: function(data, actions) {
                return actions.payment.execute().then(function() {
                    window.alert('Payment Complete!');
                });
            },

            onError: function(data, actions) {
             saveToLog({ data: data, actions: action });
            }
        }, '#paypal-button-container');

One difference from demo app is that we use onError event to log whatever came in. Recently when end-user complained that he couldn't pay we've checked in logs and this is what we found:

{"data": {"description":"Payment could not be executed\n   at handleExecuteError (https://www.paypalobjects.com/web/res/67a/482409e4f51b8e54feb2b1f84d9c1/js/button.js?build=x:1259:17)\n   at _loop (https://www.paypalobjects.com/api/checkout.js:8341:33)\n   at ZalgoPromise.prototype.dispatch (https://www.paypalobjects.com/api/checkout.js:8355:57)\n   at ZalgoPromise.prototype.reject (https://www.paypalobjects.com/api/checkout.js:8316:17)\n   at _loop (https://www.paypalobjects.com/api/checkout.js:8337:33)\n   at ZalgoPromise.prototype.dispatch (https://www.paypalobjects.com/api/checkout.js:8355:57)\n   at ZalgoPromise.prototype.reject (https://www.paypalobjects.com/api/checkout.js:8316:17)\n   at _loop (https://www.paypalobjects.com/api/checkout.js:8348:79)\n   at ZalgoPromise.prototype.dispatch (https://www.paypalobjects.com/api/checkout.js:8355:57)\n   at ZalgoPromise.prototype.resolve (https://www.paypalobjects.com/api/checkout.js:8292:17)","stack":"Error: Payment could not be executed\n   at handleExecuteError (https://www.paypalobjects.com/web/res/67a/482409e4f51b8e54feb2b1f84d9c1/js/button.js?build=x:1259:17)\n   at _loop (https://www.paypalobjects.com/api/checkout.js:8341:33)\n   at ZalgoPromise.prototype.dispatch (https://www.paypalobjects.com/api/checkout.js:8355:57)\n   at ZalgoPromise.prototype.reject (https://www.paypalobjects.com/api/checkout.js:8316:17)\n   at _loop (https://www.paypalobjects.com/api/checkout.js:8337:33)\n   at ZalgoPromise.prototype.dispatch (https://www.paypalobjects.com/api/checkout.js:8355:57)\n   at ZalgoPromise.prototype.reject (https://www.paypalobjects.com/api/checkout.js:8316:17)\n   at _loop (https://www.paypalobjects.com/api/checkout.js:8348:79)\n   at ZalgoPromise.prototype.dispatch (https://www.paypalobjects.com/api/checkout.js:8355:57)\n   at ZalgoPromise.prototype.resolve (https://www.paypalobjects.com/api/checkout.js:8292:17)\n   at Anonymous function (https://www.paypalobjects.com/api/checkout.js:3503:21)\n   at _loop (https://www.paypalobjects.com/api/checkout.js:8341:33)\n   at ZalgoPromise.prototype.dispatch (https://www.paypalobjects.com/api/checkout.js:8355:57)\n   at ZalgoPromise.prototype.reject (https://www.paypalobjects.com/api/checkout.js:8316:17)\n   at Anonymous function (https://www.paypalobjects.com/api/checkout.js:8353:29)\n   at _loop (https://www.paypalobjects.com/api/checkout.js:8341:33)\n   at ZalgoPromise.prototype.dispatch (https://www.paypalobjects.com/api/checkout.js:8355:57)\n   at ZalgoPromise.prototype.reject (https://www.paypalobjects.com/api/checkout.js:8316:17)\n   at Anonymous function (https://www.paypalobjects.com/api/checkout.js:8274:42)\n   at responseListener.respond (https://www.paypalobjects.com/api/checkout.js:2850:39)"}}

Sequence of events is payment -> onAuthorize -> onError.
I can't tell you any client info (browser ver. , lib. version, etc) because it's on end-user PC and locally we can't reproduce it and with end-user it happens very-very rarely, but in July it happened like 10 times during whole month while in previous months only ~1-2 times a month. Error message from above is from July, 29th. What is shown to end-user we don't know... :(
I get that this is clatter description but could you tell what can be the root cause of it and why user needs to try 5 times sometimes for the course of 10 hours before the payment will go through?

If you need more info on the issue: maybe some transaction IDs or something else, we'd provide.
Thank you in advance.

๐Ÿž bug

Most helpful comment

Ok I might have solved my own issue. After more trial-and-error; I removed the property "invoice_number" from the payment, all seems to work.

All 16 comments

I facing the same issue since 30 July. The error caused by auth service which return empty access token (https://www.paypal.com/webapps/hermes/api/auth) , even though ack:"success"

{
"ack":"success",
"data":{
"logged_in":false,
"guest":false,
"remembered":false,
"password_less":false,
"auth_state":"ANONYMOUS",
"refresh_token":false,
"access_token_present":true,
"access_token":"undefined",
"is_auth_api_call":true,
"buyer_id":"",
"buyer_ipcountry":"MY",
"idTokenPresent":false,
"upsellOptInDisplayed":false,
"ryiOptIn":{
"termsDisplayed":false
},
"ota":false,
"remembered_device_token":false,
"remembered_partner_assertion":false,
"email":"[email protected]"
}
}

Hi,

So I have a similar issue, with a similar error message whilst running payments in the sandbox. Tested on both Chrome and Firefox, not IE.

1) Click PayPal button on webpage (which includes a script similar to the one below)
2) Login with PayPal test account
3) Click 'Pay Now'

Error: Payment could not be executed at handleExecuteError (https://www.sandbox.paypal.com/webapps/hermes/static/js/button.js?build=2.1.0_20180813114932668.unx:1273:23) at _loop (https://www.paypalobjects.com/api/checkout.js:7786:42) at ZalgoPromise.dispatch (https://www.paypalobjects.com/api/checkout.js:7800:57) at ZalgoPromise.reject (https://www.paypalobjects.com/api/checkout.js:7761:22) at _loop (https://www.paypalobjects.com/api/checkout.js:7782:41) at ZalgoPromise.dispatch (https://www.paypalobjects.com/api/checkout.js:7800:57) at ZalgoPromise.reject (https://www.paypalobjects.com/api/checkout.js:7761:22) at _loop (https://www.paypalobjects.com/api/checkout.js:7793:87) at ZalgoPromise.dispatch (https://www.paypalobjects.com/api/checkout.js:7800:57) at ZalgoPromise.resolve (https://www.paypalobjects.com/api/checkout.js:7737:22)

The script code we use is very similar to:

<script src="https://www.paypalobjects.com/api/checkout.js" data-version-4></script>
<script>
    paypal.Button.render({
        locale: 'en_AU',
        style: {
          size: 'small',
          color: 'blue',
          shape: 'rect',
          label: 'paypal',
          tagline: 'false',
          fundingicons: 'true'
        },
        funding: {
          allowed: [ paypal.FUNDING.CARD ],
          disallowed: [ paypal.FUNDING.CREDIT ]
        },
        env: 'sandbox', 
        client: {
               sandbox: '<sandbox-id>'
        },
        payment: function(data, actions) {
            return actions.payment.create({
                payment: {
                    transactions: [{
                        amount: { 
                            total: '1.10', 
                            currency: 'AUD' 
                        },
                        description: 'some cool stuff'',
                        invoice_number: '12346',
                        item_list: {
                            items: [{
                                name: 'product name',
                                description: 'product description',
                                quantity: '1',
                                price: '1.10',
                                tax: '0.10',
                                sku: 'sku-1234',
                                currency: 'AUD'
                            }],
                        }
                    }],
                    note_to_payer: 'Thank you for your order',
                },
                experience: {
                    input_fields: {
                        no_shipping: 1
                    }
                }                
            });
        },
        // Use the 'Pay Now' option
        commit: true,

         // Wait for the payment to be authorized by the customer
        onAuthorize: function(data, actions) {
            // Execute the payment
            return actions.payment.execute().then(function() {
                console.log('Payment has been processed.');
            });
        },

        onCancel: function(data, actions) {
            window.alert('You\'ve cancelled payment!');
        },

        onError: function(error) {
            window.alert(error);
        }

    }, '#paypal-button-container');
</script>

The browser console log shows the following error:

Failed to load resource: the server responded with a status of 400 (Bad Request) https://www.sandbox.paypal.com/webapps/hermes/api/payment/PAY-8TY49037VT2860721LN7BZQI/execute

with contents:

Cannot GET /webapps/hermes/api/payment/PAY-8TY49037VT2860721LN7BZQI/execute

Ok I might have solved my own issue. After more trial-and-error; I removed the property "invoice_number" from the payment, all seems to work.

@luukau , you can't post payment with invoice number that was already processed earlier, invoice_number is unique in terms of success payments.
But it's a different issue, I'm talking here about transient errors that our end customers encounter in production from time to time.

About the half of our customers generate the same error:

Error: PERMISSION_DENIED

and immediately thereafter:

Payment could not be executed at handleExecuteError (https://www.paypalobjects.com/web/res/b68/a04c217f6513295c043c0faf19ab1/js/button.js?build=x:1273:23) at _loop (https://www.paypalobjects.com/api/checkout.js:7786:42) at ZalgoPromise.dispatch (https://www.paypalobjects.com/api/checkout.js:7800:57) at ZalgoPromise.reject (https://www.paypalobjects.com/api/checkout.js:7761:22) at _loop (https://www.paypalobjects.com/api/checkout.js:7782:41) at ZalgoPromise.dispatch (https://www.paypalobjects.com/api/checkout.js:7800:57) at ZalgoPromise.reject (https://www.paypalobjects.com/api/checkout.js:7761:22) at _loop (https://www.paypalobjects.com/api/checkout.js:7793:87) at ZalgoPromise.dispatch (https://www.paypalobjects.com/api/checkout.js:7800:57) at ZalgoPromise.resolve (https://www.paypalobjects.com/api/checkout.js:7737:22)

Problems started on July 26, 2018 without any changes in our shop software.

@mcntsh can you try to repro this?

@oleksii-vynnychenko, @peterbaral and @boonkit

Are you still seeing these errors with execute/auth? There was a fix out on August 9th that addressed a similar problem. Otherwise, in order for me to best reproduce these errors is if I can have your client ID's and code examples.

I tested on Aug. 26 and the errors were still there.
How can I send you the javascript code and client id privately?

@mcntsh , at this point the last error was on Aug, 08. But we had very few payments from customers in August, so hard to jump to any conclusion.
But thanks for heads-up.

@peterbaral You can send your code to me privately at jmcintosh at paypal dot com.

@oleksii-vynnychenko Feel free to follow up if you start experiencing issues again!

@peterbaral If you are able to reproduce this particular error yourself, could you perhaps send us the debug ID for the execute request?

If you check the network tab in your debugger and inspect that failed request, there should be a Paypal-Debug-Id in the response headers. Providing that to us would help tremendously in tracking this particular error down.

Otherwise, we will continue debugging this on our end.

Jon,

the problems only occur in the live environment and so itโ€™s difficult to try to reproduce without generating lots of orders that have to be revoked.
Is there a way to programatically get the debug id while a customer gets the error (in order to log on the server)?

Cheers,
Peter

Am 14.09.2018 um 03:01 schrieb Jon McIntosh notifications@github.com:

@peterbaral https://github.com/peterbaral If you are able to reproduce this particular error yourself, could you perhaps send us the debug ID for the execute request?

If you check the network tab in your debugger and inspect that failed request, there should be a Paypal-Debug-Id in the response headers. Providing that to us would help tremendously in tracking this particular error down.

Otherwise, we will continue debugging this on our end.

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/paypal/paypal-checkout/issues/769#issuecomment-421197714, or mute the thread https://github.com/notifications/unsubscribe-auth/AAK6TiDvpGhurjqOKRrz1K7KRfAePxiRks5uav_jgaJpZM4VqqUL.

--
Peter Baral
Medienwerkstatt Muehlacker
Verlagsgesellschaft m.b.H.
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท
E-Mail: Peter.[email protected]
Web: http://www.medienwerkstatt-online.de
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท
"Design is not just what it looks like
and feels like.
Design is how it works."- Steve Jobs

The problem disappeared after I followed the advice of @stephen-last in #831 to get the payment details directly from actions.payment.execute().then(function (paymentDetails) and delete the call to actions.payment.get()inside the execute handler.
Now payments work again!

This bug is fixed at last! Response here: https://github.com/paypal/paypal-checkout/issues/831#issuecomment-436429606

Ok I might have solved my own issue. After more trial-and-error; I removed the property "invoice_number" from the payment, all seems to work.

Removing the invoice number worked for me too. Thanx alot

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mtshare picture mtshare  ยท  5Comments

stevedeighton picture stevedeighton  ยท  6Comments

bluepnume picture bluepnume  ยท  3Comments

Warix3 picture Warix3  ยท  4Comments

webdeb picture webdeb  ยท  3Comments