php - Vue/Laravel PayPal integration without smart buttons

one text

Solution:

Not sure if you've looked around https://www.paypal.com/buttons/smart or the manual styling documentation, but there are quite a few design options for almost any site.

I would say the chief benefit is precisely not having to redirect, and instead having that modern 'in-context' experience, with your site kept loaded in the background.

But if you would truly prefer to redirect away from your site, the way I would do it is to return the URL in the ajax call, and then set window.top.location.href with the receiving client-side JS.


The exact problem you are having is that you are redirecting the ajax fetch itself, so it is trying to fetch the PayPal site via XHR. You aren't actually redirecting the client-side window, in your current attempt.

Source