{"action":"created","issue":{"url":"https://api.github.com/repos/paypal/paypal-checkout/issues/610","repository_url":"https://api.github.com/repos/paypal/paypal-checkout","labels_url":"https://api.github.com/repos/paypal/paypal-checkout/issues/610/labels{/name}","comments_url":"https://api.github.com/repos/paypal/paypal-checkout/issues/610/comments","events_url":"https://api.github.com/repos/paypal/paypal-checkout/issues/610/events","html_url":"https://github.com/paypal/paypal-checkout/issues/610","id":297879287,"number":610,"title":"ppxo_unhandled_error when calling reject method of paypal.Promise","user":{"login":"danechitoaie","id":10779010,"avatar_url":"https://avatars1.githubusercontent.com/u/10779010?v=4","gravatar_id":"","url":"https://api.github.com/users/danechitoaie","html_url":"https://github.com/danechitoaie","followers_url":"https://api.github.com/users/danechitoaie/followers","following_url":"https://api.github.com/users/danechitoaie/following{/other_user}","gists_url":"https://api.github.com/users/danechitoaie/gists{/gist_id}","starred_url":"https://api.github.com/users/danechitoaie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danechitoaie/subscriptions","organizations_url":"https://api.github.com/users/danechitoaie/orgs","repos_url":"https://api.github.com/users/danechitoaie/repos","events_url":"https://api.github.com/users/danechitoaie/events{/privacy}","received_events_url":"https://api.github.com/users/danechitoaie/received_events","type":"User","site_admin":false},"labels":[{"id":419031635,"url":"https://api.github.com/repos/paypal/paypal-checkout/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-02-16T18:31:21Z","updated_at":"2018-03-02T20:39:18Z","closed_at":null,"author_association":"NONE","body":"### Description\r\nI have the following code:\r\n```\r\n        payment() {\r\n            return new paypal.Promise((resolve, reject) => {\r\n                reject(new Error('Invalid form!'));\r\n            });\r\n        },\r\n```\r\nfor the payment handler.\r\nThis is a simplified version of what I have. In reality there's an ajax request being done to the server (as I use the server-side REST method of integrating PayPal) and if the form validation fails (server response has errors) I call reject else I call resolve.\r\n\r\nEverything seems to be working ok, the only problem is that in the browser console I get this error: `ppxo_unhandled_error`\r\n\r\n```\r\nwindow.console.(anonymous function) | @ | index.js:48\r\n-- | -- | --\r\n  | print | @ | logger.js:244\r\n  | log | @ | init.js:34\r\n  | error | @ | checkout.js:151\r\n  | (anonymous) | @ | checkout.js:25202\r\n  | dispatchPossiblyUnhandledError | @ | promise.js:334\r\n  | (anonymous) | @ | child.js:33\r\n  | setTimeout (async) |   |  \r\n  | ZalgoPromise.reject | @ | child.js:23\r\n  | (anonymous) | @ | fallback.js:33\r\n  | ZalgoPromise.dispatch | @ | componentTemplate.jsx:113\r\n  | ZalgoPromise.reject | @ | child.js:36\r\n  | (anonymous) | @ | component.js:26\r\n  | (anonymous) | @ | fallback.js:34\r\n  | ZalgoPromise.dispatch | @ | componentTemplate.jsx:113\r\n  | ZalgoPromise.reject | @ | child.js:36\r\n  | (anonymous) | @ | fallback.js:33\r\n  | ZalgoPromise.dispatch | @ | componentTemplate.jsx:113\r\n  | ZalgoPromise.reject | @ | child.js:36\r\n  | (anonymous) | @ | fallback.js:35\r\n  | ZalgoPromise.dispatch | @ | componentTemplate.jsx:113\r\n  | ZalgoPromise.reject | @ | child.js:36\r\n  | (anonymous) | @ | componentTemplate.jsx:109\r\n  | (anonymous) | @ | fallback.js:34\r\n  | ZalgoPromise.dispatch | @ | componentTemplate.jsx:113\r\n  | ZalgoPromise.reject | @ | child.js:36\r\n  | (anonymous) | @ | promise.js:410\r\n  | respond | @ | browser.js:35\r\n  | _RECEIVE_MESSAGE_TYPE.(anonymous function) | @ | checkout.js:4024\r\n  | receiveMessage | @ | server.js:132\r\n  | messageListener | @ | clean.js:16\r\n  | postMessage (async) |   |  \r\n  | (anonymous) | @ | types.js:30\r\n  | SEND_MESSAGE_STRATEGIES.(anonymous function) | @ | types.js:26\r\n  | (anonymous) | @ | strategies.js:55\r\n  | ZalgoPromise.try | @ | hacks.js:53\r\n  | (anonymous) | @ | strategies.js:49\r\n  | ZalgoPromise.map | @ | hacks.js:40\r\n  | (anonymous) | @ | strategies.js:45\r\n  | ZalgoPromise.try | @ | hacks.js:53\r\n  | sendMessage | @ | checkout.js:4031\r\n  | respond | @ | checkout.js:4008\r\n  | (anonymous) | @ | checkout.js:4019\r\n  | (anonymous) | @ | fallback.js:34\r\n  | ZalgoPromise.dispatch | @ | componentTemplate.jsx:113\r\n  | ZalgoPromise.then | @ | containerTemplate.jsx:50\r\n  | _RECEIVE_MESSAGE_TYPE.(anonymous function) | @ | checkout.js:4016\r\n  | receiveMessage | @ | server.js:132\r\n  | messageListener | @ | clean.js:16\r\n  | postMessage (async) |   |  \r\n  | (anonymous) | @ | types.js:30\r\n  | SEND_MESSAGE_STRATEGIES.(anonymous function) | @ | types.js:26\r\n  | (anonymous) | @ | strategies.js:55\r\n  | ZalgoPromise.try | @ | hacks.js:53\r\n  | (anonymous) | @ | strategies.js:49\r\n  | ZalgoPromise.map | @ | hacks.js:40\r\n  | (anonymous) | @ | strategies.js:45\r\n  | ZalgoPromise.try | @ | hacks.js:53\r\n  | sendMessage | @ | checkout.js:4031\r\n  | (anonymous) | @ | browser.js:137\r\n  | ZalgoPromise | @ | promise.js:403\r\n  | (anonymous) | @ | browser.js:162\r\n  | (anonymous) | @ | fallback.js:12\r\n  | ZalgoPromise.dispatch | @ | componentTemplate.jsx:113\r\n  | ZalgoPromise.then | @ | containerTemplate.jsx:50\r\n  | (anonymous) | @ | browser.js:150\r\n  | ZalgoPromise.try | @ | hacks.js:53\r\n  | request | @ | browser.js:95\r\n  | _send | @ | amd-define.js:1\r\n  | wrapper | @ | log.js:11\r\n  | memoizeWrapper | @ | util.js:22\r\n  | (anonymous) | @ | config.js:289\r\n  | obj.(anonymous function) | @ | checkout.js:25202\r\n  | callOriginal | @ | checkout.js:25202\r\n  | (anonymous) | @ | misc.js:17\r\n  | obj.(anonymous function) | @ | checkout.js:25202\r\n  | renderCheckout | @ | checkout.js:129\r\n  | clickButton | @ | button.js:50\r\n  | (anonymous) | @ | button.js:77\r\n```\r\n\r\n<img width=\"519\" alt=\"screen shot 2018-02-16 at 20 27 36\" src=\"https://user-images.githubusercontent.com/10779010/36322927-dc4cf1c2-1357-11e8-8167-8b7ad9a436fa.png\">\r\n\r\nIs this normal? Is there anyway that I can reject the payment request (so the PayPal window gets closed) but not have this error in the console?\r\n\r\nSo to reiterate I based my code on the following example: https://github.com/paypal/paypal-checkout/blob/master/docs/button.md#advanced-integration\r\n\r\n### Steps to reproduce\r\n\r\nFollow this example https://github.com/paypal/paypal-checkout/blob/master/docs/button.md#advanced-integration and just call reject method.\r\n\r\n### Affected browsers\r\n\r\n- [x] Chrome\r\n- [x] Safari\r\n- [x] Firefox\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/paypal/paypal-checkout/issues/comments/370045811","html_url":"https://github.com/paypal/paypal-checkout/issues/610#issuecomment-370045811","issue_url":"https://api.github.com/repos/paypal/paypal-checkout/issues/610","id":370045811,"user":{"login":"danechitoaie","id":10779010,"avatar_url":"https://avatars1.githubusercontent.com/u/10779010?v=4","gravatar_id":"","url":"https://api.github.com/users/danechitoaie","html_url":"https://github.com/danechitoaie","followers_url":"https://api.github.com/users/danechitoaie/followers","following_url":"https://api.github.com/users/danechitoaie/following{/other_user}","gists_url":"https://api.github.com/users/danechitoaie/gists{/gist_id}","starred_url":"https://api.github.com/users/danechitoaie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danechitoaie/subscriptions","organizations_url":"https://api.github.com/users/danechitoaie/orgs","repos_url":"https://api.github.com/users/danechitoaie/repos","events_url":"https://api.github.com/users/danechitoaie/events{/privacy}","received_events_url":"https://api.github.com/users/danechitoaie/received_events","type":"User","site_admin":false},"created_at":"2018-03-02T20:39:18Z","updated_at":"2018-03-02T20:39:18Z","author_association":"NONE","body":"Same thing with:\r\n\r\n```\r\n<!DOCTYPE html>\r\n\r\n<head>\r\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\r\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\r\n    <script src=\"https://www.paypalobjects.com/api/checkout.js\"></script>\r\n</head>\r\n\r\n<body>\r\n    <div id=\"paypal-button-container\"></div>\r\n\r\n    <script>\r\n        paypal.Button.render({\r\n\r\n            env: 'sandbox', // sandbox | production\r\n\r\n            // Show the buyer a 'Pay Now' button in the checkout flow\r\n            commit: true,\r\n\r\n            // payment() is called when the button is clicked\r\n            payment: function() {\r\n               return new paypal.Promise(function(resolve, reject) {\r\n                    reject(new Error(\"Err!\"));                   \r\n               });\r\n            },\r\n            \r\n            onError: function(err) {\r\n                \r\n            },\r\n\r\n            // onAuthorize() is called when the buyer approves the payment\r\n            onAuthorize: function(data, actions) {\r\n\r\n                // Set up a url on your server to execute the payment\r\n                var EXECUTE_URL = '/demo/checkout/api/paypal/payment/execute/';\r\n\r\n                // Set up the data you need to pass to your server\r\n                var data = {\r\n                    paymentID: data.paymentID,\r\n                    payerID: data.payerID\r\n                };\r\n\r\n                // Make a call to your server to execute the payment\r\n                return paypal.request.post(EXECUTE_URL, data)\r\n                    .then(function (res) {\r\n                        window.alert('Payment Complete!');\r\n                    });\r\n            }\r\n\r\n        }, '#paypal-button-container');\r\n    </script>\r\n</body>\r\n    ```"}}
{"actor":{"display_login":"danechitoaie"}}