公众账号ID
仿真模式开关
密钥
测试用验签密钥
商户号
证书
拉取订单评价数据
pay.batchQueryComment({
begin_time: "20170724000000",
end_time: "20170725000000",
offset: 0
});
关闭订单
pay.closeOrder({
out_trade_no: '120061098828009406'
})
拼接路径
生成 FetchOptions 数据
下载对账单
pay.downloadBill({
bill_date: "20140603",
bill_type: "ALL"
});
下载资金账单
pay.downloadFundFlow({
bill_date: "20140603",
account_type: "Basic",
tar_type: "GZIP"
});
获取私钥
查询订单
pay.orderQuery({
transaction_id: '1009660380201506130728806387'
})
pay.orderQuery({
out_trade_no: '120061098828009406'
});
支付结果通知
router.post("/wechatpay/notify/refund", (req, res) => {
getXMLBody(req, options).then(data => {
pay
.payNotify(data, async parsedData => {
// ...
return {
return_code: "SUCCESS",
return_msg: "OK"
};
})
.then(returnData => {
res.set("Content-Type", "application/xml; charset=utf-8");
res.end(returnData);
});
});
});
申请退款
pay.refund({
out_trade_no: '1217752501201407033233368018',
out_refund_no: '1217752501201407033233368019',
total_fee: 100,
refund_fee: 80
});
退款结果通知处理
router.post("/wechatpay/notify/refund", (req, res) => {
getXMLBody(req, options).then(data => {
pay
.refundNotify(data, async parsedData => {
if (!pay.verifySign(parsedData)) {
// 签名校验失败
}
if (parsedData.result_code === "FAIL") {
// 业务逻辑失败
}
// ...
return {
return_code: "SUCCESS",
return_msg: "OK"
};
})
.then(returnData => {
res.set("Content-Type", "application/xml; charset=utf-8");
res.end(returnData);
});
});
});
查询退款
pay.refundQuery({
transaction_id: '1009660380201506130728806387'
});
pay.refundQuery({
out_trade_no: '120061098828009406'
});
交易保障
pay.report({
interface_url: "https://api.mch.weixin.qq.com/pay/unifiedorder",
execute_time: 1000,
return_code: "SUCCESS",
return_msg: "OK",
result_code: "SUCCESS",
user_ip: "8.8.8.8"
});
仿真模式开关
统一下单
pay.unifiedOrder({
body: "腾讯充值中心-QQ会员充值",
out_trade_no: "1217752501201407033233368018",
total_fee: 888,
spbill_create_ip: "8.8.8.8",
notify_url: "https://example.com/wechatpay/notify",
scene_info: '{"h5_info": {"type":"Wap","wap_url": "https://pay.qq.com","wap_name": "腾讯充值"}}'
});
统一下单
校验 sign
Generated using TypeDoc
H5支付
const pay = new WapPay({ appId: "wxb80e5bddb2d804f3", key: "6Q9VX4N3WTBM9G9XBL7H1L9PB9ANHLY7", mchId: "1434712502", pfx: fs.readFileSync(path.resolve(__dirname, "cert.p12")) });
https://pay.weixin.qq.com/wiki/doc/api/H5.php?chapter=15_1