@kaixian/wechat_pay
v1.2.9
Published
### - install
Downloads
25
Readme
微信支付
- install
npm install @kaixian/wechat_pay --save
- init
wxpay.InitJSAPI(paymentKey, wxAppid, mch_id, notify_url, (err, status) => {
if (err !== null) {
console.log(err)
} else {
console.log('参数配置成功')
}
})| 字段名 | 类型 | 是否必须 | 备注 | | :--------- | :----: | :------: | :--------------------------- | | paymentKey | string | Y | 商户秘钥 | | wxAppid | string | Y | 公众账号ID | | mch_id | string | Y | 商户号(微信支付分配的商户号) | | notify_url | string | Y | 回调地址 |
- use
wxpay.CreateJSAPIpay(openid, body, payMode, spbill_create_ip, total_fee, (err, data) => {
//do something
})| 字段名 | 类型 | 是否必须 | 备注 | | :--------------- | :----: | :-----------------: | ---------------- | | openid | string | payMode=1(Y) 、2(N) | 微信用户的OPENID | | body | string | Y | 订单信息 | | payMode | int | Y | 支付方式 | | spbill_create_ip | string | Y | 客户端IP地址 | | total_fee | int | Y | 支付金额 |
注意:支付金额单位:分
payMode为1时,openid为必填项
支付方式
1: JSAPI支付 2: NATIVE支付 3: MWEB支付
