0.1.2 • Published 3 years ago

react-nano-payment v0.1.2

Weekly downloads
9
License
MIT
Repository
github
Last release
3 years ago

react-nano-payment

This React component lets you easily accept NANO payments on your website.

Install

npm i --save react-nano-payment

Usage

import {NanoPaymentModal} from 'react-nano-payment';

<NanoPaymentModal
  account={account}
  amount={amount}
  show={show}
  onClose={() => setShow(false)}
  onSuccess={({id, block_hash}) => {...}}
  onError={err => {...}}
/>
Prop nameTypeRequiredDescription
titlestringnoTitle of the modal (default: 'NANO Payment Request')
apiURLstringnoPayment server URL to use (default: 'https://gonano.dev')
accountstringyesAddress of the account to receive on
amountstringyesAmount in NANO to receive
paymentIDstringnoWait on this payment ID instead of creating a new payment
showboolyesWhether to show the modal
onClosefunctionyesHandler when modal is closed
onSuccessfunctionyesHandler when payment is fulfilled
onErrorfunctionyesHandler when an error occurs

If paymentID is supplied then account must be the one returned from the /payment/new API call.