0.0.3 • Published 3 years ago

@thepeer/send.js v0.0.3

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

@thepeer/send.js

Repository for send.js, thepeer send widget script.

Installation

yarn add @thepeer/send.js

or

npm install @thepeer/send.js

Usage

import React from 'react';
import ThePeer from '@thepeer/send.js';

export default function App() {
  const send = React.useMemo(() => {
    const thePeer = new ThePeer({
      publicKey: "PUBLIC_KEY",
      userReference: "USER_HASH",
      amount: "AMOUNT_IN_KOBO",
      receiptUrl: "CALLBACK_URL",
      onClose: () => console.log('Widget closed'),
      onLoad: () => console.log('Widget loaded successfully'),
      onSuccess: ({ code }) => console.log(`Linked successfully: ${code}`)
    })

    thePeer.setup()

    return thePeer;
  }, [])

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

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago