Reputation: 450
I am consuming an internal service which returns a paypal url, it looks like this: https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=xxxxxxx
Currently, I am redirecting the page to this url in order to complete the payment workflow, it is working right. Business requirement does not want full redirection. I've tried to execute it in an iframe but PayPal makes full page redirection due to security implications.
I would like to keep my ui simple, I would like to avoid other implementations which puts logic in the ui EG. client side express checkout. Because I would like to maintain the current logic in the internal service.
Eventually, I could use only the token and change the original ui approach, eg. creating the classic PayPal button. Any option to use an iframe?
Upvotes: 1
Views: 2893
Reputation: 17118
I would like to keep my ui simple, I would like to avoid other implementations which puts logic in the ui EG. client side express checkout. Because I would like to maintain the current logic in the internal service.
Using PayPal's checkout.js is the only way you're able to do a same-page checkout. You can use your existing token from the paypal url you're generating, with checkout.js -- you don't need to change much to get it to work.
See this demo: https://developer.paypal.com/demo/checkout/#/pattern/server
You just need to return the token
in the payment()
function, in place of the id
.
Upvotes: 1