npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fast-pay-button

v0.1.0

Published

js library for fast pay button

Downloads

3

Readme

This module is a js library for FastPayButton

#Install npm i fast-pay-button

#Usage

Add a element with unique id in your html first

<div
  id="forbsv"
  style={{ height: 36, width: 80 }}
/>

and then use render function to show FastPayButton, the button will be placed inside your html

const FastPayButton = require('fast-pay-button')
const fastPayButton = new FastPayButton()

fastPayButton.render({
  buttonId: 'forbsv',
  buttonFrom: '9d6c****4e73',
  buttonKey: 'F5iG****zR5d',
  outputs: [{
    address: '1K8p****Gt4i',
    amount: 0.01,
    currency: 'BSV'
  }],
  words: {
    process: 'processing',
    success: 'ok',
  },
  styles: {
    initBackColor: 'green',
    textColor: 'white',
  },
  onPayment: () => {
    console.log('succ')
  },
  onError: (err) => {
    console.log(err)
  },
})

The render parameters are as follows

| Option | Type | Required | | ------------- | -------- | -------- | | buttonId | string | true | | buttonFrom | string | true | | buttonKey | string | true | | outputs | array | true | | words | string | false | | styles | string | false | | onPayment | function | false | | onError | function | false |

#Discription

buttonId

This attribute is the unique identifier of FastPayButton and must be consistent with the id of the dom node defined in the html

该属性是FastPayButton的唯一标识,必须与html中定义的dom节点的id保持一致

buttonFrom

This attribute is the client id given to the caller by FastPayButton

该属性是FastPayButton赋予调用方的客户端id

buttonKey

This property is the encrypted string of the client private key and buttonId.

该属性是客户端私钥和buttonId拼接后的加密字符串

outputs

This attribute is used to specify a lists of outputs on the BSV transaction.It is an array of object lists, each element has the following properties.

此属性用于BSV支付的指定目标输出列表,它是个对象列表的数组,每个元素具有如下属性。

| Option | Discription | | -------- | ----------------------- | | user_id | user id of FastPayButton | | address | bsv address | | script | script | | amount | amount | | currency | currency |

words

This property is used to display the text of the button, including sub properties.

此属性用于按钮显示文字,包含以下属性

| Option | Discription | | -------- | ---------------------------------------------------------------------------------------- | | process | Text displayed on the button during payment processing付款处理期间按钮上显示的文字 | | success | The text displayed on the button when the payment is successful付款成功后按钮上显示的文字 |

styles

This property is used to customize the style of the button and contains the following properties.

此属性用于定制按钮的样式,包含以下属性

| Option | Discription | | ------------- | ----------------------------------------------- | | buttonzIndex | z-Index of FastPayButton | | initBackColor | back color of FastPayButton before slide button | | textColor | text color of FastPayButton | | circleSrc | image source of the slide circle button | | backSrc | background image source of FastPayButton |

onPayment

A function that is called when the user makes a successful payment.

用户成功支付时的回调。

onError

A function that is called when an error occurs during the payment.

用户支付期间发生错误时的回调。