Skip to content

shrutikapoor08/react-paypal-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

694dc21 · Oct 9, 2020

History

30 Commits
Oct 7, 2020
Oct 9, 2020
Oct 5, 2020
Oct 9, 2020
Aug 13, 2020
Jul 31, 2020
Aug 13, 2020
Jul 31, 2020
Oct 9, 2020
Aug 13, 2020
Oct 8, 2020
Oct 9, 2020
Aug 13, 2020
Aug 13, 2020

Repository files navigation

React PayPal JS

React components for the PayPal JS SDK.

npm version github license dependencies dev dependencies

https://paypal.github.io/react-paypal-js/

Installation

To get started, install react-paypal-js with npm.

npm install @paypal/react-paypal-js

Usage

This PayPal React library consists of two main parts:

  1. Context Provider - this <PayPalScriptProvider /> component manages loading the JS SDK script. Add it to the root of your React app. It uses the Context API for managing state and communicating to child components. It also supports reloading the script when parameters change.
  2. SDK Components - components like <PayPalButtons /> are used to render the UI for PayPal products served by the JS SDK.
// App.js
import { PayPalScriptProvider, PayPalButtons } from "@paypal/react-paypal-js";

export default function App() {
    return (
        <PayPalScriptProvider options={{ "client-id": "sb" }}>
            <PayPalButtons style={{ layout: "horizontal" }} />
        </PayPalScriptProvider>
    );
}

Browser Support

This library supports all popular browsers, including IE 11. It provides the same browser support as the JS SDK. Here's the full list of supported browsers.