@1pay/react-1pay
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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)

Parameter Notes
WALLET_ADDRESS string Required
options.chain array Currently support ethereum arbitrum optimism bsc
options.testMode boolean Default false (WIP)
options.currency array Currently support usdt usdc dai

React1pay.pay(params)

Parameter Notes
params.amount number Required payment value
params.token string Required default payment token value
params.note string anything that can help you identify the buyer and the product
params.onSuccess function callback when payment succeeded
params.onError function 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

Package Sidebar

Install

npm i @1pay/react-1pay

Weekly Downloads

21

Version

1.0.1

License

MIT

Unpacked Size

192 kB

Total Files

25

Last publish

Collaborators

  • 1paynet