payx-jssdk

1.0.1 • Public • Published

PayX客户端

安装

npm

npm install payx

<script src="//wxjs.vifii.com/dist/{version}/payx.min.js"></script>

发布源代码

 npm run publish

接口使用

 
import PayX from 'payx';
 
var payX = new PayX({
  clientId: 'test'
});
 
// 登陆判断
if (!payX.isLogined()) {
  payX.login();
}
 
// 获取当前用户信息
payX.profile(function(error, profile) {
  console.log(profile);
});
 
// 支付
payX.pay({
  amount: 1.00,
  subject: '测试商品来一发'
});
 
//微信jssdk使用
payX.wxReady(function() {
  wx.onMenuShareTimeline({
    title: 'hahahahahah', // 分享标题
    link: 'http://127.0.0.1/haha.html', // 分享链接
    imgUrl: 'https://tpc.googlesyndication.com/simgad/5673222705765011533', // 分享图标
    success: function() {
      // 用户确认分享后执行的回调函数
      alert('ok');
    },
    cancel: function() {
      // 用户取消分享后执行的回调函数
      alert('cancel');
    }
  });
 
  wx.onMenuShareAppMessage({
    title: '测试分享链接', // 分享标题
    desc: 'fuck', // 分享描述
    link: 'http://wxjs.vifii.com/test/pay.html', // 分享链接
    imgUrl: 'https://tpc.googlesyndication.com/simgad/5673222705765011533', // 分享图标
    type: 'link', // 分享类型,music、video或link,不填默认为link
    dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
    success: function() {
      // 用户确认分享后执行的回调函数
    },
    cancel: function() {
      // 用户取消分享后执行的回调函数
    }
  });
 
  wx.getNetworkType({
    success: function(res) {
      var networkType = res.networkType; // 返回网络类型2g,3g,4g,wifi
      alert('您的网络' + networkType);
    }
  });
});
 

Readme

Keywords

Package Sidebar

Install

npm i payx-jssdk

Weekly Downloads

0

Version

1.0.1

License

ISC

Last publish

Collaborators

  • payx