Skip to content

Example app demonstrating Smart Payment Buttons integration in React

Notifications You must be signed in to change notification settings

paypal-examples/react-integration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React App PayPal Integration

A sample app demonstrating the use of react-paypal-js to add PayPal buttons to a basic React app.

This project was bootstrapped with Create React App.

Get Started

Install the dependencies...

cd react-integration
npm install

...log in to the developer dashboard and get your client ID from your default application. Change const CLIENT_ID = 'test'; in src/App.js so CLIENT_ID matches your sandbox client ID...

If you need help setting up your developer dashboard or finding your client ID, follow the first step in the getting started documentation to get API credentials

...then start:

npm run start

Navigate to localhost:3000. You should see the app running.

How It Works

  1. Install react-paypal-js by running npm install @paypal/react-paypal-js
  2. Import PayPalScriptProvider into src/App.js and wrap the main app component with the <PayPalScriptProvider options={{ "client-id": CLIENT_ID }}> tag.
  3. Import PayPalButtons into src/Checkout.js and include style, payment, and other desired props on <PayPalButton/>

Further help

For more details and configuration options look at react-paypal-js usasge and the PayPal JavaScript SDK Complete Reference

About

Example app demonstrating Smart Payment Buttons integration in React

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published