1.0.1 • Published 6 months ago

@1pay/react-1pay v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

React 1pay payment SDK

Install

npm i @1pay/react-1pay

Usage

import React1pay from "@1pay/react-1pay";

React1pay.initialize("your wallet address");

Example

TODO: Add example and test More example can be found in test suite

Reference

React1pay.initialize(WALLET_ADDRESS, options)

ParameterNotes
WALLET_ADDRESSstring Required
options.chainarray Currently support ethereum arbitrum optimism bsc
options.testModeboolean Default false (WIP)
options.currencyarray Currently support usdt usdc dai

React1pay.pay(params)

ParameterNotes
params.amountnumber Required payment value
params.tokenstring Required default payment token value
params.notestring anything that can help you identify the buyer and the product
params.onSuccessfunction callback when payment succeeded
params.onErrorfunction callback when payment failed
PaymentResponse : {
  hash: String,     // transaction hash, maybe undefined if payment failed
  success: Boolean, // true if payment success, otherwise false
  network: String,  // blockchain name
  amount: Number,   // transaction value
  token: String,    // token name
  note: String      // transaction note,
  paymentTime: Date // the date time this payment is processed
}

For detail documents, please refer to 1pay docs

License

MIT