paypal sandbox - In-Context Checkout: No response handler found for post message response error -
i use advanced in-context checkout integration.
i ajax , utilize these functions, docs explain it:
paypal.checkout.setup() paypal.checkout.initxo() paypal.checkout.startflow() paypal.checkout.closeflow()
and annoying error after execute payment step. didn't bother explain anywhere api docs. missing.
new error("no response handler found post message response "+t.name+" in "+window.location.href);
what error mean? kind of response handler post message response expected? how provide it?
my client side code simple following:
oncheckoutbtnclick(ev) { paypal.checkout.initxo(); $.post('/checkout', { user: json.stringify(this.props.user), data: json.stringify(this.props.wcs), }) .done(res => { paypal.checkout.startflow(res.approval_url); }) .fail(err => { paypal.checkout.closeflow(); }); },
and server side follows:
router.post('/checkout', (req, res, next) => { var payment_json = { // huge config create payment // pivotal value "return_url" redirect_urls: { "return_url": "http://example.com:3000/complete_payment", "cancel_url": "http://example.com:3000/cancel_payment" }, } });
and return_url
code
router.get('/complete_payment', (req, res, next) => { paypal.payment.execute(req.query.paymentid, execute_payment_json, function (err, payment) { // after step error in thrown on client res.redirect('http://example.com:3000/show_complete_page_to_buyer'); }) })
it seems sandbox problem only. see error time in sandbox , newer seen in production mode. have mailed paypal developer complaining on many difference between sandbox , production.
Comments
Post a Comment