1.2.5 • Published 5 years ago

whatmode-pay v1.2.5

Weekly downloads
4
License
ISC
Repository
-
Last release
5 years ago

996.icu

LICENSE

LICENSE

安装

npm install git+ssh://git@git.socialeras.com:frontend/payment.git#v0.1.0

用法

    const payment = new Payment('your key')

    payment.createOrder((token, currency) => {
      return pay(token, 111, currency).then(
        res => res.payload.tno
      )
    })

    payment.addApproveListener((approve)=>{
      console.log(approve)
    })

    payment.mount(document.getElementById('root'))
只需要三步
  1. new Payment 并且将你的 public key 传入, public key 每个商户都有
  2. 实现 createOrder 的回调函数,你会收到 token 和 currency 两个参数,将它传给后端,后端需要根据它创建订单。后端的返回里面会有 tno。 记住!!一定要将 tno return 回去
  3. addApproveListener的回调会返回onApprove回来的数据。
  4. 最后找个dom,把这个组件mount 上去

参数

Payment Constructor
参数名接受类型是否必填描述
publicKeystring必填向后端获取,每个商户都有一个
optionsstring选填default 默认选中的支付方式,共有两个选项 一个 paypal 一个是 creditCard

例如

 const payment = new Payment('your key', { default: 'paypal' })
Payment Method
方法名接受类型是否必填描述
createOrderfn必填createOrder 的回调函数
mountdom必填要将组件mount到哪个组件
1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.10

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago