Giter VIP home page Giter VIP logo

react-paypal-button's Introduction

React-Paypal-Button

A button component to implement PayPal's Express Checkout in React

Prerequisites

To use PayPal's Express Checkout you must have a PayPal Business account set up and verified. After this is done, you'll have access to your API credentials to use with this button.

Once you have your account set up you will have 2 different sets of credentials for sandbox mode and prouduction mode. Both will have a clientID, this is what you will use for the productionID prop or the sandboxID prop.

Installation

$ npm install react-paypal-button --save

Usage

When using button in Production mode, usage will look like this...

import PayPalButton from 'react-paypal-button'

export default class App extends Component {
  render(){
    return (
      <PayPalButton>
        env='production'
        productionID='abcdef123456'
        amount={0.01}
        currency='USD'
        commit={true}
      />
    )
  }
}

When testing in Sandbox mode, usage will look like this...

import PayPalButton from 'react-paypal-button'

export default class App extends Component {
  render(){
    return (
      <PayPalButton>
        env='sandbox'
        sandboxID='abcdef123456'
        amount='0.01'
        currency='USD'
        commit={true}
      />
    )
  }
}

Options

option type description
env string Declares the environment. Will either be set to 'production' for live or 'sandbox' for testing.
sandboxID string This will be your clientID from your PayPal Sandbox API credentials found in your PayPal Business account info.
productionID string This will be your clientID from your PayPal Live API credentials found in your PayPal Business account info.
amount integer The amount of the transaction.
currency string The currency of the transaction. See PayPal docs for list of accepted currencies.
commit bool If set to true then the PayPal checkout flow will display a 'Pay Now' button at the end of transaction. There's no real reason to set it to false.

Development

Install dependencies:

$ npm install

Run the example app at http://localhost:8080:

$ npm start

Run tests and watch for code changes using jest:

$ npm test

Lint src and test files:

$ npm run lint

Generate UMD output in the lib folder (runs implicitly on npm version):

$ npm run build

License

MIT

react-paypal-button's People

Stargazers

Roman avatar AlexHolden avatar IleZdravev avatar Gru avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.