PayPal documentation always tell to use Node.js, but there is a client-only script that works even better
For PayPal integration all their documentation tells you to call server-side script running on Node.js, and here the client-side call to the CreateOrder function in the server: