This sample app shows how to integrate PayPal into your React app to add subscription payments.
- Rename the
.env.examplefile to.env. - Add your environment variables in the .env file.
Follow the instructions below.
First, install the frontend and backend dependencies with npm install.
- Inside the
client/App.jsxfile, enter your PayPalclient-idinside theinitialOptionsobject.
- Rename the
.env.examplefile to .env. - Inside the
.envfile, enter your PayPal client ID for thePAYPAL_CLIENT_ID, your subscription plan id for thePLAN_ID, and your PayPal app secret for thePAYPAL_CLIENT_SECRETenvironment variables.
In the root folder, run npm start in your terminal. This will run the backend and frontend at the same time.
- Navigate in your browser to
http://localhost:3000/
Card Type: Visa
Card Number: 5458406954745076
Expiration Date: 01/2025
CVV: 123
The PayPal Developer community helps you build your career while improving your products and the developer experience. You’ll be able to contribute code and documentation, meet new people, and learn from the open-source community.
- Website: developer.paypal.com
- Twitter: @paypaldev
- GitHub: @paypal
