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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ping-pay

v2.1.8

Published

### 安装方法 ```linux $ npm i @hetao/hetao-pay -S ```

Readme

npm-hetao-pay

安装方法

    $ npm i @hetao/hetao-pay -S

引用方法

    import { hetaoPay } from "@hetao/hetao-pay";

API

hetaoPay({data | charge})

datacharge 两个参数其中必须存在一个,传入一个参数即可,如果两个同时存在会按charge参数调用支付。

data 参数为创建订单所需要的全部参数,传入data参数后会自动调用getOrder方法并调起支付。

charge参数为ping++ charge信息或nowpay charge信息。

    import { hetaoPay } from "@hetao/hetao-pay";

    // charge 直接调用支付方法
    hetaoPay({charge}).then(res => {
        // pay success && res === 'success'
    }).catch(error => {
        // pay error | fail | cancel | res.err_code !== 0
        // pay error | fail | cancel | res !== 'success'
    });

    //调用招商银行的现在支付需要传入merchantId参数
    hetaoPay({charge: {merchantId: 'nowpay', charge: charge}});

    // data 先下单再调用支付方法
    hetaoPay({data}).then(res => {
        // pay success && res.err_code === 0 && res === 'success'
    }).catch(error => {
        // pay error || fail || cancel || res.err_code !== 0 || res !== 'success'
    });

getOrder(data)

创建订单,返回订单信息

data参数为创建订单所需要的全部参数。

    import { getOrder, hetaoPay } from "@hetao/hetao-pay";

    getOrder(data).then(res => {
        // res.err_code === 0
        let charge = res.data.charge;
        hetaoPay({charge});
    }).catch(error => {
        // error || res.err_code !== 0
    });

payCheck({orderNumber [, i, max, requireType, successUrl]})

根据prderNumber查询订单支付状态.

i 订单查询次数的起始值,默认:0。

max 订单查询的最大次数,默认:4。

requireType 区分course-shop系统订单和shop系统订单,默认shop

successUrl 设置支付成功url后,订单校验为支付成功时页面会直接跳至指定url,否则执行回调函数。

    payCheck({orderNumber}).then(res => {
        // 支付成功 data && data.paid
    }).catch(error => {
        // catch || !data.paid
        // 查询4次无支付成功
    });

    // 验证成功后直接跳转到指定url
    payCheck({
        orderNumber,
        successUrl: `${window.location.origin}/studentInfo?classId=${classId}&activityId=${activityId}`
    });

参数说明

创建订单的data对象分为mdcourse-shopshop三种模式,默认为shop模式。

  • md模式会将请求到发送到node中间层做中转处理广告数据埋点,参数中需要附带广告统计所需参数。
  • course-shop模式会将请求直接发送到course-shop服务获取订单信息。
  • shop模式会将请求直接发送到shop服务获取订单信息,其中又分为微信内和微信外两种数据结构。
/* md模式 */
{
    requireType: 'md',
    orderData: {
        phone_number,
        activity_id,
        pay_channel
    },
    adtag,
    adData: {
        type,
        link,
        clickId,
        phoneNumber,
        adtag
    }
}

/* course-shop模式 */
{
    requireType: 'course-shop',
    itemId,
    userId,
    classId,
    payChannel: 'wx_pub',
    openId
}

/* shop模式 微信内 */
{
    requireType: 'shop',
    course_package_id,
    term_id,
    activity_id,
    phone_number,
    pay_channel,
    verificationcode
}

/* shop模式 微信外 */
{
    requireType: 'shop',
    course_package_id,
    term_id,
    user_id,
    open_id,
    activity_id,
    phone_number,
    pay_channel
}

项目地址

gitlab 本地npm