0.0.1 • Published 4 years ago

@peerstack/send.js v0.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

@peerstack/send.js

Repository for send.js, Peerstack send widget script.

Installation

yarn add @peerstack/send.js

or

npm install @peerstack/send.js

Usage

import React from 'react';
import Peerstack from '@peerstack/send.js';

export default function App() {
  const peerstackSend = React.useMemo(() => {
    const peerstack = new Peerstack({
      onClose: () => console.log('Widget closed'),
      onLoad: () => console.log('Widget loaded successfully'),
      onSuccess: ({ code }) => console.log(`Linked successfully: ${code}`),
      publicKey: "PUBLIC_KEY",
      userHash: "USER_HASH",
      amount: "AMOUNT_IN_KOBO",
      firstName: "USER_FIRST_NAME",
    })

    peerstack.setup()

    return peerstack;
  }, [])

  return (
    <div>
      <button onClick={() => peerstackSend.open()}>
        Send Money
      </button>
    </div>
  )
}
0.0.1

4 years ago