Smart Button - Redirect Not Working

New Community Member


We have the following within our Smart Button code, but it isn't redirecting to the URL on success, it's defaulting to the success message that shows on the page. This poses us a problem in relation to how we track conversions, so we'd very much like to figure out how to get it to redirect to a different URL. 

Any help appreciated!





onApprove: function(data, actions) {
return actions.order.capture().then(function(orderData) {

// Full available details
console.log('Capture result', orderData, JSON.stringify(orderData, null, 2));

// Go to another URL:

// Or show a success message within this page, e.g.
const element = document.getElementById('paypal-button-container');
element.innerHTML = '';
element.innerHTML = '<h1>Success!</h1><p>Thank you for buying tickets to our November event.<br>We look forward to meeting you in person on the day.<br><br>You will receive a confirmation email from Paypal shortly.<br>A member of the team will also supply event attendance information.</p>';

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.