Skip to content
This repository has been archived by the owner on Jan 31, 2022. It is now read-only.

bittercoffeetech/wechat-trade-js

Repository files navigation

微信支付客户端API

配置文件

在根目录下创建wechat.config.json文件,格式如下:

{
    "appid": "<appid>",
    "app_secret": "<app安全码>",
    "mch_id": "商户号",
    "mch_key": "商户秘钥",
    "body": "默认商品描述信息",
    "pay_notify_url": "支付成功通知地址",
    "refund_notify_url": "退款成功通知地址",
    "api_cert": "HTTPS证书路径",
    "term_ip": "终端IPv4地址"
}

API列表

trade 交易相关

await wechatClient.trade.<操作>(<参数>: ***Request).then((response?: ***Response) => {
    //你的处理代码
}).catch( (e) => {
    //异常处理
});

sheet 对账单相关

await wechatClient.sheet.<操作>(<参数>: ***Request).then((response?: ***Response) => {
    //你的处理代码
}).catch( (e) => {
    //异常处理
});

notifier 通知相关

wechatClient.notifier.onPayed(<回调时POST的内容>);
wechatClient.notifier.onRefunded(<回调时POST的内容>);

Releases

No releases published

Packages

No packages published