Skip to content

paypaldev/PayPal-React-Donation-Sample

Repository files navigation

PayPal Developer Cover

Twitter: PayPal Developer
Twitter   -   PayPal   -   Docs   -   Code Samples   -   Blog

PayPal React Donation Sample

screenshot of sample application showing a cat photo, text, and PayPal smart buttons

This sample app shows how to add PayPal donations to your React application using the react-paypal-js npm package.

Open in Codespaces

Open in GitHub Codespaces

When you open this repository in Codespaces, the app will automatically install and open. You can skip the install step and move on to Add environment variables.

Run this project

First, install the frontend and backend dependencies with npm install.

Add environment variables

  • Rename the .env.example file to .env.
  • Inside the .env file, enter the same PayPal client ID for the PAYPAL_CLIENT_ID and VITE_PAYPAL_CLIENT_ID environment variables. Enter your PayPal app secret for the PAYPAL_CLIENT_SECRET environment variable.

Run app

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/

Sample Card

Card Type: Visa

Card Number: 5458406954745076

Expiration Date: 01/2025

CVV: 123

PayPal Developer Community

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.

About

A sample app showing PayPal checkout donations

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published