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

shouqianba-mini-pay

v1.0.0-beta.3

Published

按照[微信小程序 npm 支持](https://developers.weixin.qq.com/miniprogram/dev/devtools/npm.html)文中描述安装和使用.

Downloads

5

Readme

小程序支付 JS SDK

按照微信小程序 npm 支持文中描述安装和使用.

安装

安装生产环境版本:shouqianba-mini-pay@stable

npm install shouqianba-mini-pay@stable --production --save

安装测试环境版本:shouqianba-mini-pay@staging

npm install shouqianba-mini-pay@staging --production --save

使用

请求支付

调用收钱吧开发者文档#预下单接口下单成功后,发起微信支付.

以在小程序某个页面的 js 内调用为例:

const { requestPayment } = require('shouqianba-mini-pay');

Page({
  myMethod() {
    const req = {
      // req对象属性字段详见预下单接口`请求参数说明`
    };

    // requestPayment返回Promise类型
    requestPayment(req)
      .then(res => {
        // 预下单明确成功
        // res对象属性字段详见预下单接口`同步返回参数说明`
      })
      .catch(error => {
        /**
         * 以下情况会进到Promise catch分支:
         * + 微信小程序内部错误或微信小程序API fail回调函数被执行;
         * + 收钱吧支付网关服务不可用:响应非200HTTP状态码;
         * + 收钱吧支付网关业务异常:预下单业务执行失败
         * + 未通过客户端(SDK)参数校验,比如:必填参数未填,参数类型错误,参数值非法等等.
         *
         * error为JS Error对象,结构如下:
         * + error.code为错误码,`string`类型,有以下值:
         *   + "201": 收钱吧预下单接口返回:业务结果码 !== 'PRECREATE_SUCCESS',详见收钱吧开发者文档附录
         *   + "400": 收钱吧预下单接口返回:通讯状态码 === '400'(必填参数未填,参数类型错误,参数值非法等等)
         *   + "401": 微信小程序全局对象: wx不存在(undefined);
         *   + "402": 使用微信小程序: `wx.request`API请求收钱吧支付网关预下单时`fail`回调函数被执行
         *   + "403": 使用微信小程序: `wx.requestPayment`发起微信支付时`fail`回调函数被执行
         *   + "500": 收钱吧预下单接口不可用或返回:通讯状态码 === '500'.
         * + error.message为微信或SDK或服务端返回的错误信息,`string`类型.
         */
        console.log(error.code, error.message);
      });
  },
});

代码贡献

区分环境

  • 生产:当package.json文件中,version字段格式为:x.x.x时,按stable版本构建并发布.

  • 测试:当package.json文件中,version字段格式为:x.x.x-beta.x时,按staging版本构建并发布.