Skip to content

向员工付款

给同一个实名用户付款,单笔单日限额200/200元;一个商户同一日付款总额限额10W;不支持给非实名用户打款;单笔最小金额默认为1元。

请求参数类型描述
securitytrue声明加载商户API证书
xmlobject声明请求的XML数据结构
appidstring公众账号appid
mch_idstring商户号
device_infostring设备号
nonce_strstring随机字符串
partner_trade_nostring商户订单号
openidstring用户openid
check_namestring校验用户姓名选项
FORCE_CHECK 枚举值
re_user_namestring收款用户姓名
amountinteger金额
descstring企业付款备注
spbill_create_ipstringIp地址
workwx_signstring企业微信签名
ww_msg_typestring付款消息类型
NORMAL_MSG | APPROVAL_MSG 枚举值之一
approval_numberstring审批单号
approval_typenumber审批类型
1 枚举值
act_namestring项目名称
agentidstring付款的应用id
php
$workwxSign = \strtoupper(
  \WeChatPay\Crypto\Hash::md5(
    \WeChatPay\Formatter::queryStringLike(
        \WeChatPay\Formatter::ksort([
          'amount'           => '10099',
          'appid'            => 'wx8888888888888888',
          'desc'             => '六月出差报销费用',
          'mch_id'           => '1900000109',
          'nonce_str'        => '5K8264ILTKCH16CQ2502SI8ZNMTM67VS',
          'openid'           => 'oxTWIuGaIt6gTKsQRLau2M0yL16E',
          'partner_trade_no' => '10000098201411111234567890',
          'ww_msg_type'      => 'NORMAL_MSG',
        ])
    ),
    $agentSecret, //应用的secret字符串
    '1' //应用agentid字符串
  )
);
$instance->v2->mmpaymkttransfers->promotion->paywwsptrans2pocket->postAsync([
  'security' => true,
  'xml' => [
    'appid'            => 'wx8888888888888888',
    'mch_id'           => '1900000109',
    'device_info'      => '013467007045764',
    'nonce_str'        => '5K8264ILTKCH16CQ2502SI8ZNMTM67VS',
    'partner_trade_no' => '10000098201411111234567890',
    'openid'           => 'oxTWIuGaIt6gTKsQRLau2M0yL16E',
    'check_name'       => 'FORCE_CHECK',
    're_user_name'     => '王小王',
    'amount'           => '10099',
    'desc'             => '六月出差报销费用',
    'spbill_create_ip' => '192.168.0.1',
    'workwx_sign'      => $workwxSign,
    'ww_msg_type'      => 'NORMAL_MSG',
    'approval_number'  => '201705160008',
    'approval_type'    => '1',
    'act_name'         => '产品部门报销',
    'agentid'          => '1',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$workwxSign = \strtoupper(
  \WeChatPay\Crypto\Hash::md5(
    \WeChatPay\Formatter::queryStringLike(
        \WeChatPay\Formatter::ksort([
          'amount'           => '10099',
          'appid'            => 'wx8888888888888888',
          'desc'             => '六月出差报销费用',
          'mch_id'           => '1900000109',
          'nonce_str'        => '5K8264ILTKCH16CQ2502SI8ZNMTM67VS',
          'openid'           => 'oxTWIuGaIt6gTKsQRLau2M0yL16E',
          'partner_trade_no' => '10000098201411111234567890',
          'ww_msg_type'      => 'NORMAL_MSG',
        ])
    ),
    $agentSecret, //应用的secret字符串
    '1' //应用agentid字符串
  )
);
$instance->chain('v2/mmpaymkttransfers/promotion/paywwsptrans2pocket')->postAsync([
  'security' => true,
  'xml' => [
    'appid'            => 'wx8888888888888888',
    'mch_id'           => '1900000109',
    'device_info'      => '013467007045764',
    'nonce_str'        => '5K8264ILTKCH16CQ2502SI8ZNMTM67VS',
    'partner_trade_no' => '10000098201411111234567890',
    'openid'           => 'oxTWIuGaIt6gTKsQRLau2M0yL16E',
    'check_name'       => 'FORCE_CHECK',
    're_user_name'     => '王小王',
    'amount'           => '10099',
    'desc'             => '六月出差报销费用',
    'spbill_create_ip' => '192.168.0.1',
    'workwx_sign'      => $workwxSign,
    'ww_msg_type'      => 'NORMAL_MSG',
    'approval_number'  => '201705160008',
    'approval_type'    => '1',
    'act_name'         => '产品部门报销',
    'agentid'          => '1',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$workwxSign = \strtoupper(
  \WeChatPay\Crypto\Hash::md5(
    \WeChatPay\Formatter::queryStringLike(
        \WeChatPay\Formatter::ksort([
          'amount'           => '10099',
          'appid'            => 'wx8888888888888888',
          'desc'             => '六月出差报销费用',
          'mch_id'           => '1900000109',
          'nonce_str'        => '5K8264ILTKCH16CQ2502SI8ZNMTM67VS',
          'openid'           => 'oxTWIuGaIt6gTKsQRLau2M0yL16E',
          'partner_trade_no' => '10000098201411111234567890',
          'ww_msg_type'      => 'NORMAL_MSG',
        ])
    ),
    $agentSecret, //应用的secret字符串
    '1' //应用agentid字符串
  )
);
$instance['v2/mmpaymkttransfers/promotion/paywwsptrans2pocket']->postAsync([
  'security' => true,
  'xml' => [
    'appid'            => 'wx8888888888888888',
    'mch_id'           => '1900000109',
    'device_info'      => '013467007045764',
    'nonce_str'        => '5K8264ILTKCH16CQ2502SI8ZNMTM67VS',
    'partner_trade_no' => '10000098201411111234567890',
    'openid'           => 'oxTWIuGaIt6gTKsQRLau2M0yL16E',
    'check_name'       => 'FORCE_CHECK',
    're_user_name'     => '王小王',
    'amount'           => '10099',
    'desc'             => '六月出差报销费用',
    'spbill_create_ip' => '192.168.0.1',
    'workwx_sign'      => $workwxSign,
    'ww_msg_type'      => 'NORMAL_MSG',
    'approval_number'  => '201705160008',
    'approval_type'    => '1',
    'act_name'         => '产品部门报销',
    'agentid'          => '1',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$workwxSign = \strtoupper(
  \WeChatPay\Crypto\Hash::md5(
    \WeChatPay\Formatter::queryStringLike(
        \WeChatPay\Formatter::ksort([
          'amount'           => '10099',
          'appid'            => 'wx8888888888888888',
          'desc'             => '六月出差报销费用',
          'mch_id'           => '1900000109',
          'nonce_str'        => '5K8264ILTKCH16CQ2502SI8ZNMTM67VS',
          'openid'           => 'oxTWIuGaIt6gTKsQRLau2M0yL16E',
          'partner_trade_no' => '10000098201411111234567890',
          'ww_msg_type'      => 'NORMAL_MSG',
        ])
    ),
    $agentSecret, //应用的secret字符串
    '1' //应用agentid字符串
  )
);
$response = $instance->v2->mmpaymkttransfers->promotion->paywwsptrans2pocket->post([
  'security' => true,
  'xml' => [
    'appid'            => 'wx8888888888888888',
    'mch_id'           => '1900000109',
    'device_info'      => '013467007045764',
    'nonce_str'        => '5K8264ILTKCH16CQ2502SI8ZNMTM67VS',
    'partner_trade_no' => '10000098201411111234567890',
    'openid'           => 'oxTWIuGaIt6gTKsQRLau2M0yL16E',
    'check_name'       => 'FORCE_CHECK',
    're_user_name'     => '王小王',
    'amount'           => '10099',
    'desc'             => '六月出差报销费用',
    'spbill_create_ip' => '192.168.0.1',
    'workwx_sign'      => $workwxSign,
    'ww_msg_type'      => 'NORMAL_MSG',
    'approval_number'  => '201705160008',
    'approval_type'    => '1',
    'act_name'         => '产品部门报销',
    'agentid'          => '1',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$workwxSign = \strtoupper(
  \WeChatPay\Crypto\Hash::md5(
    \WeChatPay\Formatter::queryStringLike(
        \WeChatPay\Formatter::ksort([
          'amount'           => '10099',
          'appid'            => 'wx8888888888888888',
          'desc'             => '六月出差报销费用',
          'mch_id'           => '1900000109',
          'nonce_str'        => '5K8264ILTKCH16CQ2502SI8ZNMTM67VS',
          'openid'           => 'oxTWIuGaIt6gTKsQRLau2M0yL16E',
          'partner_trade_no' => '10000098201411111234567890',
          'ww_msg_type'      => 'NORMAL_MSG',
        ])
    ),
    $agentSecret, //应用的secret字符串
    '1' //应用agentid字符串
  )
);
$response = $instance->chain('v2/mmpaymkttransfers/promotion/paywwsptrans2pocket')->post([
  'security' => true,
  'xml' => [
    'appid'            => 'wx8888888888888888',
    'mch_id'           => '1900000109',
    'device_info'      => '013467007045764',
    'nonce_str'        => '5K8264ILTKCH16CQ2502SI8ZNMTM67VS',
    'partner_trade_no' => '10000098201411111234567890',
    'openid'           => 'oxTWIuGaIt6gTKsQRLau2M0yL16E',
    'check_name'       => 'FORCE_CHECK',
    're_user_name'     => '王小王',
    'amount'           => '10099',
    'desc'             => '六月出差报销费用',
    'spbill_create_ip' => '192.168.0.1',
    'workwx_sign'      => $workwxSign,
    'ww_msg_type'      => 'NORMAL_MSG',
    'approval_number'  => '201705160008',
    'approval_type'    => '1',
    'act_name'         => '产品部门报销',
    'agentid'          => '1',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$workwxSign = \strtoupper(
  \WeChatPay\Crypto\Hash::md5(
    \WeChatPay\Formatter::queryStringLike(
        \WeChatPay\Formatter::ksort([
          'amount'           => '10099',
          'appid'            => 'wx8888888888888888',
          'desc'             => '六月出差报销费用',
          'mch_id'           => '1900000109',
          'nonce_str'        => '5K8264ILTKCH16CQ2502SI8ZNMTM67VS',
          'openid'           => 'oxTWIuGaIt6gTKsQRLau2M0yL16E',
          'partner_trade_no' => '10000098201411111234567890',
          'ww_msg_type'      => 'NORMAL_MSG',
        ])
    ),
    $agentSecret, //应用的secret字符串
    '1' //应用agentid字符串
  )
);
$response = $instance['v2/mmpaymkttransfers/promotion/paywwsptrans2pocket']->post([
  'security' => true,
  'xml' => [
    'appid'            => 'wx8888888888888888',
    'mch_id'           => '1900000109',
    'device_info'      => '013467007045764',
    'nonce_str'        => '5K8264ILTKCH16CQ2502SI8ZNMTM67VS',
    'partner_trade_no' => '10000098201411111234567890',
    'openid'           => 'oxTWIuGaIt6gTKsQRLau2M0yL16E',
    'check_name'       => 'FORCE_CHECK',
    're_user_name'     => '王小王',
    'amount'           => '10099',
    'desc'             => '六月出差报销费用',
    'spbill_create_ip' => '192.168.0.1',
    'workwx_sign'      => $workwxSign,
    'ww_msg_type'      => 'NORMAL_MSG',
    'approval_number'  => '201705160008',
    'approval_type'    => '1',
    'act_name'         => '产品部门报销',
    'agentid'          => '1',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
返回字典类型描述
return_codestring返回状态码
SUCCESS | FAIL 枚举值之一
return_msgstring返回信息
appidstring公众账号appid
mch_idstring商户号
device_infostring设备号
nonce_strstring随机字符串
result_codestring业务结果
SUCCESS | FAIL 枚举值之一
err_codestring错误代码
err_code_desstring错误代码描述
partner_trade_nostring商户订单号
payment_nostring微信付款单号
payment_timestring付款成功时间

参阅 官方文档

Published on the GitHub by TheNorthMemory