SmartButtons Return URL's not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am currently trying to get Smart Payment Buttons working.
I was following the documentations integration guide. This is my code so far:
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> </head> <body> <h1>PayPal Smart Button Test</h1> <div id="paypal-button-container"></div> <script src="https://www.paypal.com/sdk/js?client-id=myclientid¤cy=USD&disable-funding=credit,card,sepa"></script> <script> paypal.Buttons({ createOrder: function(data, actions) { return actions.order.create({ purchase_units: [{ amount: { value: '0.01' } }], return_urls: { return_url: 'https://www.google.de/', cancel_url: 'https://www.youtube.de/' } }); }, onApprove: function(data, actions) { // Capture the funds from the transaction return actions.order.capture().then(function(details) { // Show a success message to your buyer alert('Transaction completed by ' + details.payer.name.given_name); }); } }).render('#paypal-button-container'); </script> </body> </html>
This renders the button, and I can do the sandbox payment. But neither of the both return url's provided work. It doesnt return to the cancel url when canceling the order, nor does it return to the success url when the payment is completed. I also cannot find any documentation to this.
Why isnt that working properly? Do I have to setup more settings? What am I doing wrong?
Thanks
- Labels:
-
Payments REST APIs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi.
Hope this helps but return and cancel urls are no longer being used.
https://developer.paypal.com/docs/checkout/reference/upgrade-integration/
About half way down the page:
Note: return_url and cancel_url in the /v1/billing-agreements/agreement-tokens API are not used by the PayPal JavaScript SDK integration.
Pass https://www.paypal.com/checkoutnow/error as a placeholder value for these keys, and use on onApprove, onCancel and onError to handle transaction success or failure.
Many Thanks
Kenny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks @southcoastkenny - be nice if they took down code that doesn't work anymore.
Two hours wasted!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- permission_denied response in call to patch order when paying by Card in Braintree Client-side Integration (JS, iOS, Android SDKs)
- Identification data for PayPal Express payments is required to integrate them into an API code in REST APIs
- Suddenly all "Add to Cart' buttons, on my entire website, return error in PayPal Reporting
- How do I set up auto return with advanced checkout in PayPal Payments Standard
- Production account value in Braintree Server-side Integration (PHP, Java, .NET, Ruby, Python, NodeJS SDKs)