using the @paypal/react-paypal-js
react components to integrate paypal buttons in a next.js app
put your paypal client id in the env var NEXT_PUBLIC_PAYPAL_CLIENT_ID
(you can use an .env.local file to let next.js use it)
next.js paypal buttons integration