0.0.3 • Published 3 years ago
@thepeer/send.js v0.0.3
@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>
)
}