Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

yu-wxapi

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yu-wxapi

对微信支付及小程序相关后端API的封装

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

安装

npm install yu-wxapi

导入

const wx = require('yu-wxapi')

初始化

//wx.init()需在首次调用数据库操作之前调用一次即可
//随后跨模块操作数据库可不再调用本方法
//建议在程序入口模块优先调用一次
wx.init(appid, secret, mchid, privateKeyPath, serial_no, apiV3)

调用方法

//注意下列方法均可能抛出错误
//建议使用try catch包裹
await wx.loginForApplet(code)  //小程序登录
await wx.getUserPhoneNumber(code)  //获取用户手机号
await wx.orderPayByJSAPI(description, amountTotal, openid, notify_url = '', support_fapiao = false)  //微信JSAPI下单(小程序或微信内置浏览器)
await wx.orderPayByH5(description, amountTotal, payer_client_ip, notify_url = '', support_fapiao = false)  //微信H5下单(微信之外浏览器)
await wx.orderPayByNative(description, amountTotal, notify_url = '', support_fapiao = false)  //微信Native下单(APP)
await wx.orderQuery(out_trade_no)  //查询订单支付结果
await wx.refund(out_trade_no, reason, refund, total, notify_url = null)  //微信退款申请
await wx.refundQuery(out_trade_no)  //退款信息查询
wx.refundNotify(refundData)  //退款通知解密
wx.payNotify(payData)  //支付通知解密

Keywords

FAQs

Package last updated on 27 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc