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

xpay_sdk

v1.0.18

Published

Xpay JS SDK

Downloads

6

Readme

XPay JS SDK

简介

example 文件夹里面是一个简单的接入示例,该示例仅供参考。

安装

npm i xpay_sdk

使用说明

引入 JS 文件

  • script 标签方式

    <script src="/path/to/xpay.js"></script>
  • Browserify 打包方式

    首先使用 npm 下载

    npm install xpay_sdk

    使用

    var XPay = require('xpay_sdk');

引入SDK后,需要先给SDK配置对应的全局Host(包含协议名)和Secret。

XPay.setHost('host_string')
XPay.setSecret('secret_string')

支付

XPay.createPayment({       
    order_no:  '1526950047', // 推荐使用 8-20 位,要求数字或字母,不允许其他字符
    app:       { id:  'app_YeZ5uzBpD8u37t8PXBeAu54g' },
    channel:   'qr_wxpay', // 支付使用的第三方支付渠道取值请参考:https://xpay-1255692419.cos-website.ap-guangzhou.myqcloud.com/doc/#header-支付渠道属性值
    amount:    100, //订单总金额, 人民币单位:分(如订单总金额为 1 元,此处请填 100)
    client_ip: '127.0.0.1', // 发起支付请求客户端的 IP 地址,格式为 IPV4,如: 127.0.0.1
    subject:   'Your Subject',
    body:      'Your Body'
}; function(err, charge) {
    // YOUR CODE
});

查询

XPay.showPayment(
  'ch_Vd3B3Gbovhfp7nqqD3cy6kSP',    //订单对象 id ,由 XPay 生成的支付对象 ID, 27 位字符串
  function(err, charge) {
    // YOUR CODE
  }
);
XPay.listPayment(
  { app : { id: 'app_YeZ5uzBpD8u37t8PXBeAu54g' } },
  function(err, charges) {
     // YOUR CODE
  }
);

退款

XPay.createRefund(
  "ch_KoovNNNqD5dMH4jvKXb35g3c",   
  { 
    refund_no: 100,               // refund_no 商户退款订单号,必须唯一
    description: "Refund Description" 
  },
  function(err, refund) {
    // YOUR CODE
  }
);

退款查询

XPay.showRefund(
  'ch_MZxenugAzGm9JYtW6z7wBfVH',  //订单对象 id ,由 XPay 生成的支付对象 ID, 27 位字符串
  're_2nkL93DeZzidp4Ja5mvbDi5Z',  //退款对象 id
  function(err, refund) {
    // YOUR CODE
  }
);
XPay.listRefunds(
  "ch_MZxenugAzGm9JYtW6z7wBfVH",    //订单对象 id ,由 XPay 生成的支付对象 ID, 27 位字符串
    function(err, refunds) {
       // YOUR CODE
    }
);

设置Host

XPay.setHost('host_string')

设置Secret

XPay.setSecret('secret_string')

设置APPID

XPay.setAppID('appid_string')

**详细信息请参考 API 文档 **