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 🙏

© 2025 – Pkg Stats / Ryan Hefner

im-pay

v0.1.0

Published

> im-pay是使用支付服务的必要SDK,通过它可以让您的网站快速集成支付能力

Downloads

49

Readme

im-pay

im-pay是使用支付服务的必要SDK,通过它可以让您的网站快速集成支付能力

集成指南

使用该SDK请确保您传递了“accessToken”参数,并且该SDK在浏览器中已加载完毕,否则将无法正常运作! 获取方式请参考此处

1、符合commonjs规范 2、符合esm规范

获取代码

链接到此SDK的CDN: yarn add im-pay npm i im-pay

初始化

CDN

window.onload = function () {
        const options = {
            accessToken: '12345678',
            lightbox: {
                width: 800,
                height: 700
            },
            // 等同于下面的on方法
            on: {
                load() {},
                beforeClose() {}
            }
        }
        // 必须提前加载cdn上的js
        const PayStation = new window.ImPay(options)
        PayStation.on('load', function () {
            console.log('加载成功le')
        })
        PayStation.on('beforeClose', function () {
            return new Promise((resolve) => {
                const result = confirm('您确定要取消购买吗?')
                resolve(result)
            })
        })
        document.getElementById('pay').addEventListener('click', function () {
            PayStation.open()
        })
    }

CommonJs

const ImPay = require('im-pay')

const PayStation = new ImPay({
    accessToken: '*', // required
    lightbox: {
        width: 800,
        height: 400
    }
})

// open pay ui
PayStation.open()

ESM

import ImPay from 'im-pay'

const PayStation = new ImPay({
    accessToken: '*', // required
    lightbox: {
        width: 800,
        height: 400
    }
})

// open pay ui
PayStation.open()

Props

| 选项 | 默认值 | 描述 | |----------------|---------------|---------------| | accessToken | String | 支付API密钥 | | sandbox | Boolean false | 是否为沙盒测试模式 | | lightbox | Object | 弹窗配置 | | lightbox.width | String auto | 弹窗宽度 | | lightbox.height | String auto | 弹窗高度 | | lightbox.overlay | Boolean true | 是否开启遮罩层 | | lightbox.closeOnClickMask | Boolean true | 是否可以点击遮罩层关闭弹窗 | | lightbox.overlayOpacity | Number 0.6 | 遮罩层透明度 | | lightbox.overlayBackground | String #000 | 遮罩层背景 | | lightbox.closeByKeyboard | Boolean true | 是否可以按ESC键关闭弹窗 | | lightbox.contentBackground | String #fff | 主体背景 | | lightbox.spinner | String 'oval' | 加载器类型 | | lightbox.spinnerColor | String #fff | 加载器颜色 | | lightbox.contentPadding | String 0 | 主体内边距 | | lightbox.zIndex | Number 10 | 整体的z-index | | lightbox.top | String 20% | 主体的top值 |

Events

load

支付UI初始化完毕事件

open

支付弹窗打开完毕事件

beforeClose

支付弹窗关闭前回调,返回一个Promise 结果 true为关闭 false为不关闭

close

支付弹窗完全关闭事件

Methods