Dansteve / react-gladepay

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

react-gladepay

This is a react library for implementing gladepay payment gateway

Demo

Demo

Get Started

This React library provides a wrapper to add Gladepay Payments to your React application

Install

npm install react-gladepay-2 --save

or with yarn

yarn add react-gladepay-2

Usage

    import React, { Component } from 'react';
    //import the library
    import GladepayButton from 'react-gladepay';

    class App extends Component {

    	state = {
    		MID: "GP0000001", //Gladepay Merchant ID
    		email: "demo@gmail.com",// customer email
    		amount: 10000, //equals NGN100,
    		is_production: false //is_production,
    	}

    	callback = (response) => {
    		console.log(response); // card charged successfully, get reference here
    	}

    	close = () => {
    		console.log("Payment closed");
    	}

      render() {
        return (
          <div>
            <p>
              <GladepayButton
                text="Make Payment"
                className="payButton"
                callback={this.callback}
                close={this.close}
                disabled={true} {/*disable payment button*/}
                embed={true} {/*payment embed in your app instead of a pop up*/}
                email={this.state.email}
                amount={this.state.amount}
                MID={this.state.MID}
                tag="button"{/*it can be button or a or input tag */}
              />
            </p>
          </div>
        );
      }
    }

    export default App;

Please checkout Gladepay Documentation for other available options you can add to the tag

Deployment

REMEMBER TO CHANGE THE MID WHEN DEPLOYING ON A LIVE/PRODUCTION SYSTEM

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b feature-name
  3. Commit your changes: git commit -am 'Some commit message'
  4. Push to the branch: git push origin feature-name
  5. Submit a pull request 😉😉

How can I thank you?

Why not star the github repo? I'd love the attention! Why not share the link for this repository on Twitter or Any Social Media? Spread the word!

Don't forget to follow me on twitter!

Thanks! Adekanbi Dansteve.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

License:MIT License


Languages

Language:TypeScript 74.4%Language:JavaScript 13.0%Language:HTML 7.3%Language:CSS 5.3%