1👍
Redirecting away from your website is an old way to process payments. Don’t do it; there should be no redirecting away.
Instead, make two routes on your server, one for ‘Create Order’ and one for ‘Capture Order’, documented here; there is a Checkout-Python-SDK you can use. These routes should return only JSON data (no HTML or text). The capture one should (on success) store the payment details in your database before it does the return (particularly purchase_units[0].payments.captures[0].id
, the PayPal transaction ID)
Pair those two routes with the following approval flow, which involves no redirects: https://developer.paypal.com/demo/checkout/#/pattern/server
If, in the success section of that code you want to redirect somewhere else on your site after a transaction is processed (like a thank you and confirmation page), do so with JavaScript.