Paypal-checkout-components: trying to set third-party payee fails with status 400, permission denied

Created on 17 Sep 2017  路  20Comments  路  Source: paypal/paypal-checkout-components

Description

When payee for the REST API is set to an email address other than the app's owner, the execute step fails with a status of 400 and a message "contingency":"PERMISSION_DENIED".

According to this: https://devblog.paypal.com/setting-payee/
third-party payees are supported by the REST API now. So as far as I can tell this ought to work.

Demonstration here:

https://www.trocadero.com/_internal/alpha/pptest1.html

The first button works, the second doesn't; it returns a status 400 and a JSON message:

{"ack":"contingency",
 "contingency":"PERMISSION_DENIED",
  "meta":{"calc":"714ba485c8f6f",
          "rlog":"bV%2FSt2LJ1ggR0cjdyk%2FEYJ%2BtrwLRC7ytRaJFcCiXO13TD08xBYvUMjaCyCVkfVmcPdymxkRUFD8aB5fDp0MZIQ_15e8ddf186f"},
          "server":"h_ZPcvYtfE-5CyDtgSWTyHlIud-mdIYwI0NjqkKhq_TrzRACQht1zqIa3PDvRJXCTOFSPmGOUtqHAlWkcDbol5u8PXtX749V1pFdhM_kFauN3VGxqFoaOQwkBCcGu113Xv2-7OmKjn_NkzSv3qkEzsj04fx_EHikydEvAttFxeqtWOvB5PB4DljeQyhet2mEnK8yjiJapHHl4n5gzbcJwnM6DujSmvBZkzmUmgENy6ZJePZCLvX-t-qq9epD7lQl1sE3pGTPmdm"}

(This form is asking me for "the paypal.version from your browser console", but I do not see such as message in my console.)

Console logs -- the error line is highlighted.

util.js:71 XHR failed loading: POST "https://www.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16(anonymous function) @ checkout.js:21297immediateFlush @ logger.js:109(anonymous function) @ init.js:34
util.js:71 XHR failed loading: POST "https://www.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16(anonymous function) @ checkout.js:21297immediateFlush @ logger.js:109(anonymous function) @ init.js:29
Navigated to https://www.trocadero.com/_internal/alpha/pptest1.html
util.js:71XHR finished loading: POST "https://www.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16(anonymous function) @ proxy.js:37immediateFlush @ logger.js:109(anonymous function) @ util.js:98(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ util.js:97
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16immediateFlush @ logger.js:109(anonymous function) @ util.js:98(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ util.js:97
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16(anonymous function) @ serialize.js:37ZalgoPromise.try @ promise.js:352(anonymous function) @ serialize.js:36(anonymous function) @ types.js:65ZalgoPromise.try @ promise.js:352_RECEIVE_MESSAGE_TYPE.(anonymous function) @ types.js:53receiveMessage @ index.js:112messageListener @ index.js:138
http.js:127 XHR finished loading: POST "https://cors.api.sandbox.paypal.com/v1/oauth2/token".(anonymous function) @ http.js:127ZalgoPromise @ promise.js:37request @ http.js:25Object.time @ rest.js:32(anonymous function) @ util.js:32createCheckoutToken @ rest.js:167(anonymous function) @ hacks.js:21obj.(anonymous function) @ util.js:275actions.payment.create @ component.jsx:263(anonymous function) @ hacks.js:49obj.(anonymous function) @ util.js:275paypal.Button.render.payment @ pptest1.html:23(anonymous function) @ hacks.js:74ZalgoPromise @ promise.js:37(anonymous function) @ hacks.js:43ZalgoPromise.try @ promise.js:352(anonymous function) @ component.jsx:285value @ props.js:120(anonymous function) @ serialize.js:37ZalgoPromise.try @ promise.js:352(anonymous function) @ serialize.js:36(anonymous function) @ types.js:65ZalgoPromise.try @ promise.js:352_RECEIVE_MESSAGE_TYPE.(anonymous function) @ types.js:53receiveMessage @ index.js:112messageListener @ index.js:138
http.js:127 XHR finished loading: POST "https://cors.api.sandbox.paypal.com/v1/payments/payment".(anonymous function) @ http.js:127ZalgoPromise @ promise.js:37request @ http.js:25(anonymous function) @ rest.js:189(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ rest.js:175(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.resolve @ promise.js:81(anonymous function) @ promise.js:192ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.resolve @ promise.js:81(anonymous function) @ promise.js:39(anonymous function) @ http.js:97
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16(anonymous function) @ serialize.js:37ZalgoPromise.try @ promise.js:352(anonymous function) @ serialize.js:36(anonymous function) @ types.js:65ZalgoPromise.try @ promise.js:352_RECEIVE_MESSAGE_TYPE.(anonymous function) @ types.js:53receiveMessage @ index.js:112messageListener @ index.js:138
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16immediateFlush @ logger.js:109(anonymous function) @ util.js:98(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ util.js:97
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16(anonymous function) @ serialize.js:37ZalgoPromise.try @ promise.js:352(anonymous function) @ serialize.js:36(anonymous function) @ types.js:65ZalgoPromise.try @ promise.js:352_RECEIVE_MESSAGE_TYPE.(anonymous function) @ types.js:53receiveMessage @ index.js:112messageListener @ index.js:138
api.js:104 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/payment/PAY-1Y365014R05018837LG66F7Y/execute".(anonymous function) @ api.js:104ZalgoPromise @ promise.js:37resolver @ promise.js:36request @ api.js:34httpNative @ api.js:841http @ api.js:756getHttpResponse @ api.js:591(anonymous function) @ api.js:497(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ api.js:489(anonymous function) @ promise.js:127(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220attempt @ promise.js:126attemptRequest @ api.js:486(anonymous function) @ api.js:280(anonymous function) @ promise.js:215(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ promise.js:214forEach @ util.js:41first @ promise.js:213call @ api.js:252post @ api.js:222action @ api.js:208executePayment @ api.js:66(anonymous function) @ checkout.js:46memoizeWrapper @ util.js:17(anonymous function) @ serialize.js:37ZalgoPromise.try @ promise.js:352(anonymous function) @ serialize.js:36(anonymous function) @ types.js:65ZalgoPromise.try @ promise.js:352_RECEIVE_MESSAGE_TYPE.(anonymous function) @ types.js:53receiveMessage @ index.js:112messageListener @ index.js:138
pptest1.html:57 The payment was completed!
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16immediateFlush @ logger.js:109(anonymous function) @ util.js:98(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ util.js:97
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16immediateFlush @ logger.js:109(anonymous function) @ init.js:29
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16(anonymous function) @ serialize.js:37ZalgoPromise.try @ promise.js:352(anonymous function) @ serialize.js:36(anonymous function) @ types.js:65ZalgoPromise.try @ promise.js:352_RECEIVE_MESSAGE_TYPE.(anonymous function) @ types.js:53receiveMessage @ index.js:112messageListener @ index.js:138
util.js:71 XHR failed loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16immediateFlush @ logger.js:109(anonymous function) @ init.js:34destroyElement @ dom.js:804(anonymous function) @ drivers.js:80tasks.push.run @ base.js:52run @ base.js:80ParentComponent.destroyComponent @ index.js:987(anonymous function) @ index.js:682(anonymous function) @ fn.js:28
util.js:71 XHR failed loading: POST "https://www.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16(anonymous function) @ proxy.js:33(anonymous function) @ promise.js:158ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.reject @ promise.js:111(anonymous function) @ promise.js:160ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.reject @ promise.js:111cleanUpWindow @ clean.js:17(anonymous function) @ drivers.js:75tasks.push.run @ base.js:52run @ base.js:80ParentComponent.destroyComponent @ index.js:987(anonymous function) @ index.js:682(anonymous function) @ fn.js:28
Navigated to https://www.trocadero.com/_internal/alpha/pptest1.html
util.js:71XHR finished loading: POST "https://www.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16(anonymous function) @ proxy.js:37immediateFlush @ logger.js:109(anonymous function) @ util.js:98(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ util.js:97
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16immediateFlush @ logger.js:109(anonymous function) @ util.js:98(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ util.js:97
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16immediateFlush @ logger.js:109(anonymous function) @ util.js:98(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ util.js:97
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16(anonymous function) @ serialize.js:37ZalgoPromise.try @ promise.js:352(anonymous function) @ serialize.js:36(anonymous function) @ types.js:65ZalgoPromise.try @ promise.js:352_RECEIVE_MESSAGE_TYPE.(anonymous function) @ types.js:53receiveMessage @ index.js:112messageListener @ index.js:138
http.js:127 XHR finished loading: POST "https://cors.api.sandbox.paypal.com/v1/oauth2/token".(anonymous function) @ http.js:127ZalgoPromise @ promise.js:37request @ http.js:25Object.time @ rest.js:32(anonymous function) @ util.js:32createCheckoutToken @ rest.js:167(anonymous function) @ hacks.js:21obj.(anonymous function) @ util.js:275actions.payment.create @ component.jsx:263(anonymous function) @ hacks.js:49obj.(anonymous function) @ util.js:275paypal.Button.render.payment @ pptest1.html:19(anonymous function) @ hacks.js:74ZalgoPromise @ promise.js:37(anonymous function) @ hacks.js:43ZalgoPromise.try @ promise.js:352(anonymous function) @ component.jsx:285value @ props.js:120(anonymous function) @ serialize.js:37ZalgoPromise.try @ promise.js:352(anonymous function) @ serialize.js:36(anonymous function) @ types.js:65ZalgoPromise.try @ promise.js:352_RECEIVE_MESSAGE_TYPE.(anonymous function) @ types.js:53receiveMessage @ index.js:112messageListener @ index.js:138
http.js:127 XHR finished loading: POST "https://cors.api.sandbox.paypal.com/v1/payments/payment".(anonymous function) @ http.js:127ZalgoPromise @ promise.js:37request @ http.js:25(anonymous function) @ rest.js:189(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ rest.js:175(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.resolve @ promise.js:81(anonymous function) @ promise.js:192ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.resolve @ promise.js:81(anonymous function) @ promise.js:39(anonymous function) @ http.js:97
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16(anonymous function) @ serialize.js:37ZalgoPromise.try @ promise.js:352(anonymous function) @ serialize.js:36(anonymous function) @ types.js:65ZalgoPromise.try @ promise.js:352_RECEIVE_MESSAGE_TYPE.(anonymous function) @ types.js:53receiveMessage @ index.js:112messageListener @ index.js:138
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16immediateFlush @ logger.js:109(anonymous function) @ util.js:98(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ util.js:97
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16(anonymous function) @ serialize.js:37ZalgoPromise.try @ promise.js:352(anonymous function) @ serialize.js:36(anonymous function) @ types.js:65ZalgoPromise.try @ promise.js:352_RECEIVE_MESSAGE_TYPE.(anonymous function) @ types.js:53receiveMessage @ index.js:112messageListener @ index.js:138
api.js:104 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/payment/PAY-6VD25615EH407740ELG66LNQ/execute".(anonymous function) @ api.js:104ZalgoPromise @ promise.js:37resolver @ promise.js:36request @ api.js:34httpNative @ api.js:841http @ api.js:756getHttpResponse @ api.js:591(anonymous function) @ api.js:497(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ api.js:489(anonymous function) @ promise.js:127(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220attempt @ promise.js:126attemptRequest @ api.js:486(anonymous function) @ api.js:280(anonymous function) @ promise.js:215(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ promise.js:214forEach @ util.js:41first @ promise.js:213call @ api.js:252post @ api.js:222action @ api.js:208executePayment @ api.js:66(anonymous function) @ checkout.js:46memoizeWrapper @ util.js:17(anonymous function) @ serialize.js:37ZalgoPromise.try @ promise.js:352(anonymous function) @ serialize.js:36(anonymous function) @ types.js:65ZalgoPromise.try @ promise.js:352_RECEIVE_MESSAGE_TYPE.(anonymous function) @ types.js:53receiveMessage @ index.js:112messageListener @ index.js:138
pptest1.html:41 payment 1 completed!
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16immediateFlush @ logger.js:109(anonymous function) @ util.js:98(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ util.js:97
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16(anonymous function) @ serialize.js:37ZalgoPromise.try @ promise.js:352(anonymous function) @ serialize.js:36(anonymous function) @ types.js:65ZalgoPromise.try @ promise.js:352_RECEIVE_MESSAGE_TYPE.(anonymous function) @ types.js:53receiveMessage @ index.js:112messageListener @ index.js:138
http.js:127 XHR finished loading: POST "https://cors.api.sandbox.paypal.com/v1/payments/payment".(anonymous function) @ http.js:127ZalgoPromise @ promise.js:37request @ http.js:25(anonymous function) @ rest.js:189(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ rest.js:175(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220createCheckoutToken @ rest.js:167(anonymous function) @ hacks.js:21obj.(anonymous function) @ util.js:275actions.payment.create @ component.jsx:263(anonymous function) @ hacks.js:49obj.(anonymous function) @ util.js:275paypal.Button.render.payment @ pptest1.html:56(anonymous function) @ hacks.js:74ZalgoPromise @ promise.js:37(anonymous function) @ hacks.js:43ZalgoPromise.try @ promise.js:352(anonymous function) @ component.jsx:285value @ props.js:120(anonymous function) @ serialize.js:37ZalgoPromise.try @ promise.js:352(anonymous function) @ serialize.js:36(anonymous function) @ types.js:65ZalgoPromise.try @ promise.js:352_RECEIVE_MESSAGE_TYPE.(anonymous function) @ types.js:53receiveMessage @ index.js:112messageListener @ index.js:138
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16(anonymous function) @ serialize.js:37ZalgoPromise.try @ promise.js:352(anonymous function) @ serialize.js:36(anonymous function) @ types.js:65ZalgoPromise.try @ promise.js:352_RECEIVE_MESSAGE_TYPE.(anonymous function) @ types.js:53receiveMessage @ index.js:112messageListener @ index.js:138
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16immediateFlush @ logger.js:109(anonymous function) @ util.js:98(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ util.js:97
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16(anonymous function) @ serialize.js:37ZalgoPromise.try @ promise.js:352(anonymous function) @ serialize.js:36(anonymous function) @ types.js:65ZalgoPromise.try @ promise.js:352_RECEIVE_MESSAGE_TYPE.(anonymous function) @ types.js:53receiveMessage @ index.js:112messageListener @ index.js:138

***

api.js:104 POST https://www.sandbox.paypal.com/webapps/hermes/api/payment/PAY-88727500MJ123892SLG66LSA/execute 400 (Bad Request)(anonymous function) @ api.js:104ZalgoPromise @ promise.js:37resolver @ promise.js:36request @ api.js:34httpNative @ api.js:841http @ api.js:756getHttpResponse @ api.js:591(anonymous function) @ api.js:497(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ api.js:489(anonymous function) @ promise.js:127(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220attempt @ promise.js:126attemptRequest @ api.js:486(anonymous function) @ api.js:280(anonymous function) @ promise.js:215(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ promise.js:214forEach @ util.js:41first @ promise.js:213call @ api.js:252post @ api.js:222action @ api.js:208executePayment @ api.js:66(anonymous function) @ checkout.js:46memoizeWrapper @ util.js:17(anonymous function) @ serialize.js:37ZalgoPromise.try @ promise.js:352(anonymous function) @ serialize.js:36(anonymous function) @ types.js:65ZalgoPromise.try @ promise.js:352_RECEIVE_MESSAGE_TYPE.(anonymous function) @ types.js:53receiveMessage @ index.js:112messageListener @ index.js:138

***

api.js:104 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/payment/PAY-88727500MJ123892SLG66LSA/execute".(anonymous function) @ api.js:104ZalgoPromise @ promise.js:37resolver @ promise.js:36request @ api.js:34httpNative @ api.js:841http @ api.js:756getHttpResponse @ api.js:591(anonymous function) @ api.js:497(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ api.js:489(anonymous function) @ promise.js:127(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220attempt @ promise.js:126attemptRequest @ api.js:486(anonymous function) @ api.js:280(anonymous function) @ promise.js:215(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ promise.js:214forEach @ util.js:41first @ promise.js:213call @ api.js:252post @ api.js:222action @ api.js:208executePayment @ api.js:66(anonymous function) @ checkout.js:46memoizeWrapper @ util.js:17(anonymous function) @ serialize.js:37ZalgoPromise.try @ promise.js:352(anonymous function) @ serialize.js:36(anonymous function) @ types.js:65ZalgoPromise.try @ promise.js:352_RECEIVE_MESSAGE_TYPE.(anonymous function) @ types.js:53receiveMessage @ index.js:112messageListener @ index.js:138
util.js:71 XHR failed loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16immediateFlush @ logger.js:109(anonymous function) @ init.js:34destroyElement @ dom.js:804(anonymous function) @ drivers.js:80tasks.push.run @ base.js:52all @ base.js:67(anonymous function) @ index.js:1196ZalgoPromise.try @ promise.js:352ParentComponent.destroy @ index.js:1192(anonymous function) @ index.js:1234ZalgoPromise.try @ promise.js:352ParentComponent.error @ index.js:1231ZalgoPromise.try @ promise.js:352error:promisified @ decorators.js:25(anonymous function) @ component.jsx:483(anonymous function) @ promise.js:158ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.reject @ promise.js:111(anonymous function) @ promise.js:153ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.reject @ promise.js:111(anonymous function) @ promise.js:153ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.reject @ promise.js:111(anonymous function) @ promise.js:160ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.reject @ promise.js:111(anonymous function) @ promise.js:187(anonymous function) @ promise.js:158ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.reject @ promise.js:111(anonymous function) @ promise.js:47responseListener.respond @ client.js:116_RECEIVE_MESSAGE_TYPE.(anonymous function) @ types.js:111receiveMessage @ index.js:112messageListener @ index.js:138
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16(anonymous function) @ serialize.js:37ZalgoPromise.try @ promise.js:352(anonymous function) @ serialize.js:36(anonymous function) @ types.js:65ZalgoPromise.try @ promise.js:352_RECEIVE_MESSAGE_TYPE.(anonymous function) @ types.js:53receiveMessage @ index.js:112messageListener @ index.js:138
util.js:71 XHR failed loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16immediateFlush @ logger.js:109(anonymous function) @ init.js:29
util.js:71 XHR failed loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16(anonymous function) @ serialize.js:37ZalgoPromise.try @ promise.js:352(anonymous function) @ serialize.js:36(anonymous function) @ types.js:65ZalgoPromise.try @ promise.js:352_RECEIVE_MESSAGE_TYPE.(anonymous function) @ types.js:53receiveMessage @ index.js:112messageListener @ index.js:138
www.paypalobjects.com/api/checkout.js:681 XHR failed loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ www.paypalobjects.com/api/checkout.js:681ZalgoPromise @ www.paypalobjects.com/api/checkout.js:7999ajax @ www.paypalobjects.com/api/checkout.js:665transport @ www.paypalobjects.com/api/checkout.js:519immediateFlush @ www.paypalobjects.com/api/checkout.js:371(anonymous function) @ www.paypalobjects.com/api/checkout.js:194destroyElement @ www.paypalobjects.com/api/checkout.js:7271(anonymous function) @ www.paypalobjects.com/api/checkout.js:5083tasks.push.run @ www.paypalobjects.com/api/checkout.js:3864run @ www.paypalobjects.com/api/checkout.js:3892ParentComponent.destroyComponent @ www.paypalobjects.com/api/checkout.js:5866(anonymous function) @ www.paypalobjects.com/api/checkout.js:5725(anonymous function) @ www.paypalobjects.com/api/checkout.js:7463
www.paypalobjects.com/api/checkout.js:681 XHR failed loading: POST "https://www.paypal.com/webapps/hermes/api/logger".(anonymous function) @ www.paypalobjects.com/api/checkout.js:681ZalgoPromise @ www.paypalobjects.com/api/checkout.js:7999ajax @ www.paypalobjects.com/api/checkout.js:665transport @ www.paypalobjects.com/api/checkout.js:519(anonymous function) @ www.paypalobjects.com/api/checkout.js:13021(anonymous function) @ www.paypalobjects.com/api/checkout.js:8064ZalgoPromise.dispatch @ www.paypalobjects.com/api/checkout.js:8078ZalgoPromise.reject @ www.paypalobjects.com/api/checkout.js:8039(anonymous function) @ www.paypalobjects.com/api/checkout.js:8066ZalgoPromise.dispatch @ www.paypalobjects.com/api/checkout.js:8078ZalgoPromise.reject @ www.paypalobjects.com/api/checkout.js:8039cleanUpWindow @ www.paypalobjects.com/api/checkout.js:2416(anonymous function) @ www.paypalobjects.com/api/checkout.js:5080tasks.push.run @ www.paypalobjects.com/api/checkout.js:3864run @ www.paypalobjects.com/api/checkout.js:3892ParentComponent.destroyComponent @ www.paypalobjects.com/api/checkout.js:5866(anonymous function) @ www.paypalobjects.com/api/checkout.js:5725(anonymous function) @ www.paypalobjects.com/api/checkout.js:7463
Navigated to https://www.trocadero.com/_internal/alpha/pptest1.html
util.js:71XHR finished loading: POST "https://www.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16(anonymous function) @ proxy.js:37immediateFlush @ logger.js:109(anonymous function) @ util.js:98(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ util.js:97
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16immediateFlush @ logger.js:109(anonymous function) @ util.js:98(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ util.js:97
util.js:71 XHR finished loading: POST "https://www.sandbox.paypal.com/webapps/hermes/api/logger".(anonymous function) @ util.js:71ZalgoPromise @ promise.js:37ajax @ util.js:35transport @ logger.js:16immediateFlush @ logger.js:109(anonymous function) @ util.js:98(anonymous function) @ promise.js:144ZalgoPromise.dispatch @ promise.js:192ZalgoPromise.then @ promise.js:220(anonymous function) @ util.js:97

Steps to reproduce

This minimal code demonstrates the issue. The first button, where the payee is the app's owner, works fine. The second button, identical except that it sets a third party payee, fails on the execute step. giving the 400 response code.

<html><head><title>PP Button Test</title></head>
<body>
<script src="https://www.paypalobjects.com/api/checkout.js" data-version-4></script>

<div id="myContainerElement1"></div>

<hr>

<div id="myContainerElement2"></div>

<script>

    paypal.Button.render({
        client: {
            sandbox:    'AbRF38w5WaF4qE3nSr_JLsxdGGOEGSpS4wxI8HbW-QYcnISvpmPEc-hJfUemR1k57IrCKwBDNamV9T0O', 
            production: 'xxxxxxxxx'  // from https://developer.paypal.com/developer/applications/
        },
        payment: function(data, actions) {
            return actions.payment.create({
                transactions: [
                    {
                        amount: {
                            total:    '1.00',
                            currency: 'USD'
                        },
                        payee:{email:'[email protected]'},
                    }
                ]
            });
        },
        commit: true,
        locale: 'en_US',
        style: {
            size:   'medium', // tiny, small, medium
            color:  'blue', // orange, blue, silver
            shape:  'pill'    // pill, rect
        },
        env: 'sandbox', // Optional: specify 'sandbox' or 'production'
        onAuthorize: function(data, actions) {
            return actions.payment.execute().then(function(response) {
                console.log('payment 1 completed!');
            });
        },
        onCancel: function(data) {
            console.log('payment 1 was cancelled!');
        }
    }, '#myContainerElement1');


    paypal.Button.render({
        client: {
           sandbox:    'AbRF38w5WaF4qE3nSr_JLsxdGGOEGSpS4wxI8HbW-QYcnISvpmPEc-hJfUemR1k57IrCKwBDNamV9T0O', 
            production: 'xxxxxxxxx'  
        },
        payment: function(data, actions) {
            return actions.payment.create({
                transactions: [
                    {
                        amount: {
                            total:    '1.00',
                            currency: 'USD'
                        },
                        payee:{email:'[email protected]'},
                    }
                ]
            });
        },
        commit: true,
        locale: 'en_US',
        style: {
            size:   'medium', // tiny, small, medium
            color:  'blue', // orange, blue, silver
            shape:  'pill'    // pill, rect
        },
        env: 'sandbox', // Optional: specify 'sandbox' or 'production'
        onAuthorize: function(data, actions) {
            return actions.payment.execute().then(function(response) {
                console.log('payment 2 completed!');
            });
        },
        onCancel: function(data) {
            console.log('payment 2 was cancelled!');
        }
    }, '#myContainerElement2');


</script>


</body></html>

Affected browsers

Seen in Chromium Version 50.0.2661.94 on Fedora.

outdated

All 20 comments

Thanks for the detailed bug report! We'll take a look and let you know.

Looks like this may be an internal issue with the execute api, rather than a specific problem with checkout.js. I'm raising an issue with the relevant team, I'll update here when it gets some traction.

In the short term, if you need to be unblocked, you may want to try making the execute call using a server-side call: https://developer.paypal.com/docs/integration/direct/express-checkout/integration-jsv4/server-side-REST-integration/

Tried to work around by doing the execute step from the server side, but still get errors from within the PHP SDK on calling execute. A 401 rather than a 400 but still, no joy:

 [25-Sep-2017 18:09:44] PHP Fatal error:  Uncaught exception 'PayPal\Exception\PayPalConnectionException' with message 'Got Http response code 401 when accessing https://api.sandbox.paypal.com/v1/oauth2/token.' in /data/trocadero/_internal/alpha/php/PayPal-PHP-SDK/paypal/rest-api-sdk-php/lib/PayPal/Core/PayPalHttpConnection.php:202
Stack trace:
#0 /data/trocadero/_internal/alpha/php/PayPal-PHP-SDK/paypal/rest-api-sdk-php/lib/PayPal/Auth/OAuthTokenCredential.php(241): PayPal\Core\PayPalHttpConnection->execute('grant_type=clie...')
#1 /data/trocadero/_internal/alpha/php/PayPal-PHP-SDK/paypal/rest-api-sdk-php/lib/PayPal/Auth/OAuthTokenCredential.php(266): PayPal\Auth\OAuthTokenCredential->getToken(Array, 'PAYPAL_SANDBOX_...', 'PAYPAL_SECRET', 'grant_type=clie...')
#2 /data/trocadero/_internal/alpha/php/PayPal-PHP-SDK/paypal/rest-api-sdk-php/lib/PayPal/Auth/OAuthTokenCredential.php(210): PayPal\Auth\OAuthTokenCredential->generateAccessToken(Array, NULL)
#3 /data/trocadero/_internal/alpha/php/PayPal-PHP-SDK/paypal/rest-api-sdk-php/lib/PayPal/Auth/OAuthTok in /data/trocadero/_internal/alpha/php/PayPal-PHP-SDK/paypal/rest-api-sdk-php/lib/PayPal/Core/PayPalHttpConnection.php on line 202

This is the code:
```

// Executes a PayPal payment with the REST API.
// Working around a bug in their checkout,js -- see
// https://github.com/paypal/paypal-checkout/issues/464 and the
// note in onAuthorize in cart_checkout_do_custinfo.php
require_once 'Troc.php';
require_once 'PayPal-PHP-SDK/autoload.php';

use PayPal\Api\Amount;
use PayPal\Api\Details;
use PayPal\Api\Payment;
use PayPal\Api\PaymentExecution;
use PayPal\Api\Transaction;

$paymentId=$_POST['paymentID'];

$cred=new \PayPal\Auth\OAuthTokenCredential(
(Troc::test_mode() ? PAYPAL_SANDBOX_CLIENT_ID : // ClientID
PAYPAL_CLIENT_ID),
PAYPAL_SECRET // ClientSecret
);
$apiContext = new \PayPal\Rest\ApiContext($cred);

$payment = Payment::get($paymentId, $apiContext);

// ### Payment Execute
// PaymentExecution object includes information necessary
// to execute a PayPal account payment.
$execution = new PaymentExecution();
$execution->setPayerId($_POST['payerID']);

try {
$result = $payment->execute($execution, $apiContext);
try {
$payment = Payment::get($paymentId, $apiContext);
} catch (Exception $ex) {
error_log("failed to get updated payment: ".print_r($ex,true));
throw $ex;
}
} catch (Exception $ex) {
error_log("failed to execute payment: ".print_r($ex,true));
header($_SERVER["SERVER_PROTOCOL"].' 400 Payment Execution Failed');
}

error_log("pp_execute: got updated payment: ".print_r($payment,true));
header($_SERVER["SERVER_PROTOCOL"].' 200 Payment Execution Failed');

?>
``

Looks like it's failing while calling https://api.sandbox.paypal.com/v1/oauth2/token. Are you sure your client-id and secret are both correct? In your code I only see PAYPAL_SECRET -- is this the production or sandbox secret?

Exactly the same problem here guys.
Any news about it? I am trying in a sandbox env with two sandbox personal accounts, both with a positive PayPal balance (5k$, and trying to perform a payment of 1$).

EDIT: with the PHP SDK it works, but the JS bug is still there.

FYI, we've figured out the cause of this issue and have a known fix. Just need to prioritize some time to make the fix.

Any news about this?
Thanks

What is the cause of the issue?

@bluepnume do you know the cause of the issue?

Exactly same issue in javascript. https://api.sandbox.paypal.com/v1/oauth2/token 400 (Bad Request). Any news about this.

What is the point of this package if this doesn't work?

Any updates here? We're affected by this issue as well.
Thanks!

@nckackerman @bluepnume how does using the REST API look?

Do we use this library to get a payment token, pass that to our own server, and our server makes a call? Or do we make the call straight from the client to paypal rest api?

What's the best way to move forward without any compliance headaches?

UPDATE:

https://github.com/paypal/paypal-checkout/blob/master/docs/paypal-rest-api.md

Is there an update on how to use payee with this or is there an alternative PayPal product I can use to accept payments on behalf of others?

 We've been using this to set up the payment on the client side, but to actually execute it we set up a small script on our server-side using the with the PHP SDK, as suggested above. It is definitely uglier than I'd like but it's working for us.

Michael St Clair notifications@github.com writes:

Is there an update on how to use payee with this or is there an alternative PayPal product I can use to accept payments on behalf of others?

--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
https://github.com/paypal/paypal-checkout/issues/464#issuecomment-411229368

HI @TomSwiss how did you resolved it on server-side? I have same Issues i did try braintree but i have still issues i can't using payee. Could you help me check it?

We've run into this issue as well.

We use it as part of our embeddable app for users to collect payments, and right now, the users can't do anything at all.

We're using the frontend checkout lib.

Our users come to use complaining, no payments can be made, ever.

What's the deal with this?

Hi all,

I'm afraid to say at this point this issue is probably a 'wontfix'. There's a new api being introduced which fill facilitate payments, and not have this issue. This is mostly outside of the control of our sdk team.

Please for now do not rely on client side execute() if you're using payee. To unblock you can do a server-side /execute api call.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings