coinforbarter-v1-react

CoinForBarter v1 React Package

Usage no npm install needed!

<script type="module">
  import coinforbarterV1React from 'https://cdn.skypack.dev/coinforbarter-v1-react';
</script>

README

CoinForBarter V1 NodeJs Library

How to use

npm install coinforbarter-v1-react

For staging, Use TEST API Keys. For production, use LIVE API KEYS. You can get your PUBLIC_KEY from the CoinForBarter dashboard.

Go here to get your API Keys.

Turn on Test Mode to get TEST API KEYS and Turn off Test Mode to get LIVE API KEYS

Using Hooks

import React from 'react';
import { useCoinForBarter } from 'coinforbarter-v1-react';

function App() {
  const config = {
    publicKey: 'xxxxxxxxxxxx',
    txRef: 'xxxxxxxxxxx',
    amount: 10000,
    currency: 'NGN',
    customer: 'example@example.com',
    customerFullName: 'John Doe',
    callback: (data) => {
      console.log(data);
    },
    currencies: ['BTC', 'DOGE'],
  };


  const pay = useCoinForBarter(config);

  return (
    <div>
      <button
        onClick={(e) => {
          e.preventDefault();
          pay();
        }}
      >
        Custom Pay
      </button>
    </div>
  );
}

export default App;

Using Button Component

import React from 'react';
import { CoinForBarterButton } from 'coinforbarter-v1-react';

function App() {
  const config = {
    publicKey: 'xxxxxxxxxxxx',
    txRef: 'xxxxxxxxxxx',
    amount: 10000,
    currency: 'NGN',
    customer: 'example@example.com',
    customerFullName: 'John Doe',
    callback: (data) => {
      console.log(data);
    },
    currencies: ['BTC', 'DOGE'],
  };


  return (
    <div>
      <CoinForBarterButton config={config} text="Pay" />
    </div>
  );
}

export default App;


For more information on the services listed above, visit the CoinForBarter documentation

CoinForBarter V1 React Package is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

CoinForBarter is MIT licensed.