返回错误
New features are all in `APIv3`, there's no reason to continue use this kind client since v2.0.
use WeChatPay\Transformer;
$res = $instance
->v2->mmpaymkttransfers->promotion->transfers
->postAsync([
'xml' => [
'mch_appid' => 'wx8888888888888888',
'mchid' => '1900000109',// 注意这个商户号,key是`mchid`非`mch_id`
'partner_trade_no' => '10000098201411111234567890',
'openid' => 'oxTWIuGaIt6gTKsQRLau2M0yL16E',
'check_name' => 'FORCE_CHECK',
're_user_name' => '王小王',
'amount' => '10099',
'desc' => '理赔',
'spbill_create_ip' => '192.168.0.1',
],
'security' => true, //请求需要双向证书
'debug' => true //开启调试模式
])
->then(static function($response) {
return Transformer::toArray((string)$response->getBody());
})
->otherwise(static function($e) {
// 更多`$e`异常类型判断是必须的,这里仅列出一种可能情况,请根据实际对接过程调整并增加
if ($e instanceof \GuzzleHttp\Promise\RejectionException) {
return Transformer::toArray((string)$e->getReason()->getBody());
}
return [];
})
->wait();
print_r($res);
企业付款至零钱接口比较特殊,接口需要证书并且返回参数没有签名sign,需要进行特殊处理
New features are all in `APIv3` 这个不是报错,只是个提醒,是说新功能如商家券,只在APIv3上有,README上有说明;而且自v1.2.2版本开始是“静默”形式提示的(几乎不会感知到),建议查下你安装的版本。