{% import “./macro/weixin-tenpay.md” as WeixinTenpay %}
企业付款
企业付款为企业提供付款至用户零钱的能力,支持通过API接口付款,具体的场景介绍参考微信企业付款场景介绍
企业付款需要到微信支付商户平台中,产品大全 -> 企业付款到零钱 -> 产品设置,配置发起方式,勾选 “使用 API 接口发起付款”,并将以下 IP 加入到接口调用 IP。
52.80.43.20052.80.37.17052.80.57.80
info 使用以下接口时必须根据上述步骤进行配置
BaaS.wxPromotionTransfer({userID, openid, amount, description, checkName, reUserName, gatewayType})
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| userID | Number | 用户 ID (对应 _userprofile 表中的 id 字段) |
| openid | string | 【可选】用户在公众号下的 openid(gatewayType 为 weixin_tenpay_app 的时候必填) |
| amount | Number | 付款金额 |
| description | String | 付款描述 |
| checkName | Boolean | 是否检测真实名字 |
| reUserName | String | 【可选】真实名字(checkName 为 false 时,可不填) |
| gatewayType | GatewayType | 【可选】微信支付商户类型(默认为微信小程序) |
{{WeixinTenpay.getGatewayType()}}
示例代码
BaaS.wxPromotionTransfer({userID: "xxxx",amount: 0.3,description: "test",checkName: true,reUserName: "xxxx",}).then(res => {// success}).catch(e => {// err})
返回示例
调用结果会直接将微信的结果进行返回,开发者可根据返回的信息做处理。(请参考微信企业付款文档)
成功:HTTP:1.1 OK
{"return_code": "SUCCESS","partner_trale_no": "xxx","payment_no": "xxx","payment_time": "2018-01-01 00:00:00"}
失败:HTTP:1.1 OK
{"err_code": "xxx","err_code_des": "xxxx"}
