🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

flutterwave-react-v3

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flutterwave-react-v3

Official React Package for Flutterwave v3 payment APIs

1.0.2
Source
npm
Version published
Weekly downloads
3.3K
33.29%
Maintainers
1
Weekly downloads
 
Created
Source

flutterwave-react-v3

This is a react package for implementing Flutterwave collection gateway

Demo

Alt text

Installation

$ npm install flutterwave-react-v3

# or
$ yarn add flutterwave-react-v3



Usage

Hooks

import React from 'react';
import { useFlutterwave } from 'flutterwave-react-v3';

export default function App() {
  const config = {
    public_key: 'FLWPUBK-ad8d5d4eca114b1255ac7798d3d1787d-X',
    tx_ref: Date.now(),
    amount: 100,
    currency: 'NGN',
    payment_options: 'card,mobilemoney,ussd',
    customer: {
      email: 'user@gmail.com',
      phonenumber: '07064586146',
      name: 'joel ugwumadu',
    },
    customizations: {
      title: 'my Payment Title',
      description: 'Payment for items in cart',
      logo: 'https://st2.depositphotos.com/4403291/7418/v/450/depositphotos_74189661-stock-illustration-online-shop-log.jpg',
    },
  };

  const handleFlutterPayment = useFlutterwave(config);

  return (
    <div className="App">
     <h1>Hello Test user</h1>

      <button
        onClick={() => {
          handleFlutterPayment({
            callback: (response) => {
              console.log(response);
            },
            onClose: () => {},
          });
        }}
      >
        Payment with React hooks
      </button>
    </div>
  );
}

Components

import React from 'react';
import { FlutterWaveButton } from 'flutterwave-react-v3';

export default function App() {
   const config = {
    public_key: 'FLWPUBK-ad8d5d4eca114b1255ac7798d3d1787d-X',
    tx_ref: Date.now(),
    amount: 100,
    currency: 'NGN',
    payment_options: 'card,mobilemoney,ussd',
    customer: {
      email: 'user@gmail.com',
      phonenumber: '07064586146',
      name: 'joel ugwumadu',
    },
    customizations: {
      title: 'My store',
      description: 'Payment for items in cart',
      logo: 'https://st2.depositphotos.com/4403291/7418/v/450/depositphotos_74189661-stock-illustration-online-shop-log.jpg',
    },
  };

  const fwConfig = {
    ...config,
    text: 'Pay with Flutterwave!',
    callback: (response) => {
      console.log(response);
    },
    onClose: () => {},
  };

  return (
    <div className="App">
     <h1>Hello Test user</h1>
      <FlutterWaveButton {...fwConfig} />
    </div>
  );
}

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

License

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

Contributions ✨

  • Fork it!
  • Create your feature branch: git checkout -b feature-name
  • Commit your changes: git commit -am 'Some commit message'
  • Push to the branch: git push origin feature-name
  • Submit a pull request

This project follows the all-contributors specification. Contributions of any kind welcome!

Issues

Looking to contribute? Look for the Good First Issue label.

🐛 Bugs

Please file an issue for bugs, missing documentation, or unexpected behavior.

License

MIT

Keywords

javaScript

FAQs

Package last updated on 26 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts