array(7) {
["combine_appid"]=>
string(18) "wx948d4e11762e6bac"
["combine_mchid"]=>
string(10) "1606143582"
["combine_out_trade_no"]=>
string(23) "810688748219833539-mini"
["time_expire"]=>
string(25) "2021-10-28T16:14:00+08:00"
["notify_url"]=>
string(80) "https://mlsldshop.codechain.shop/cmobile/api/payment/xcx_jsapi_v3/notify_url.php"
["sub_orders"]=>
array(2) {
[0]=>
array(7) {
["mchid"]=>
string(10) "1606143582"
["attach"]=>
string(23) "product_buy-wxpay_jsapi"
["out_trade_no"]=>
string(23) "810688748219833539-mini"
["sub_mchid"]=>
string(10) "1606794343"
["description"]=>
string(31) "实物订单_810688748219833539"
["amount"]=>
array(2) {
["total_amount"]=>
int(1)
["currency"]=>
string(3) "CNY"
}
["settle_info"]=>
array(2) {
["profit_sharing"]=>
bool(true)
["subsidy_amount"]=>
int(0)
}
}
[1]=>
array(7) {
["mchid"]=>
string(10) "1606143582"
["attach"]=>
string(23) "product_buy-wxpay_jsapi"
["out_trade_no"]=>
string(23) "810688748219833539-mini"
["sub_mchid"]=>
string(10) "1606995864"
["description"]=>
string(31) "实物订单_810688748219833539"
["amount"]=>
array(2) {
["total_amount"]=>
int(1)
["currency"]=>
string(3) "CNY"
}
["settle_info"]=>
array(2) {
["profit_sharing"]=>
bool(true)
["subsidy_amount"]=>
int(0)
}
}
}
["combine_payer_info"]=>
array(1) {
["openid"]=>
string(28) "o4baQ0njOxeXDO4yZ0fPXH3lgkuc"
}
}
w我是这样拼的,报错Client error: `POST https:
<?php interface Native { /** * 合单下单-Native支付(同步模式) * @param array<string,mixed> $options * @link https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/combine/chapter3_10.shtml */ public function post(array $options = [ 'json' => [ 'combine_appid' => 'wxd678efh567hg6787', 'combine_mchid' => '1900000109', 'combine_out_trade_no' => 'P20150806125346', 'scene_info' => [ 'device_id' => 'POS1:1', 'payer_client_ip' => '14.17.22.32', ], 'sub_orders' => [[ 'mchid' => '1900000109', 'attach' => '深圳分店', 'amount' => [ 'total_amount' => 100, 'currency' => 'CNY', ], 'out_trade_no' => '20150806125346', 'sub_mchid' => '1900000109', 'goods_tag' => 'WXG', 'description' => '腾讯充值中心-QQ会员充值', 'settle_info' => [ 'profit_sharing' => true, 'subsidy_amount' => 10, ], ],], 'time_start' => '2019-12-31T15:59:60+08:00', 'time_expire' => '2019-12-31T15:59:60+08:00', 'notify_url' => 'https://yourapp.com/notify', ], ]): ResponseInterface; /** * 合单下单-Native支付(异步模式) * @param array<string,mixed> $options * @link https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/combine/chapter3_10.shtml#async */ public function postAsync(array $options = [ 'json' => [ 'combine_appid' => 'wxd678efh567hg6787', 'combine_mchid' => '1900000109', 'combine_out_trade_no' => 'P20150806125346', 'scene_info' => [ 'device_id' => 'POS1:1', 'payer_client_ip' => '14.17.22.32', ], 'sub_orders' => [[ 'mchid' => '1900000109', 'attach' => '深圳分店', 'amount' => [ 'total_amount' => 100, 'currency' => 'CNY', ], 'out_trade_no' => '20150806125346', 'sub_mchid' => '1900000109', 'goods_tag' => 'WXG', 'description' => '腾讯充值中心-QQ会员充值', 'settle_info' => [ 'profit_sharing' => true, 'subsidy_amount' => 10, ], ],], 'time_start' => '2019-12-31T15:59:60+08:00', 'time_expire' => '2019-12-31T15:59:60+08:00', 'notify_url' => 'https://yourapp.com/notify', ], ]): PromiseInterface; }以函数默认值的形式,说明参数数据格式如上,composer require iwechatpay/openapi 可能适合你。
为 wechatpay-php 增加IDE提示的接口描述包 iwechatpay/openapi 介绍wechapay-php 开发包的辅助包
<?php'sub_orders' => [['mchid' => '1900000109','attach' => '深圳分店','amount' => ['total_amount' => 100,'currency' => 'CNY',],'out_trade_no' => '20150806125346','sub_mchid' => '1900000109','goods_tag' => 'WXG','description' => '腾讯充值中心-QQ会员充值','settle_info' => ['profit_sharing' => true,'subsidy_amount' => 10,],],['mchid' => '1900000109','attach' => '深圳分店','amount' => ['total_amount' => 100,'currency' => 'CNY',],'out_trade_no' => '20150806125346','sub_mchid' => '1900000119','goods_tag' => 'WXG','description' => '腾讯充值中心-QQ会员充值','settle_info' => ['profit_sharing' => true,'subsidy_amount' => 10,],],['mchid' => '1900000109','attach' => '深圳分店','amount' => ['total_amount' => 100,'currency' => 'CNY',],'out_trade_no' => '20150806125346','sub_mchid' => '1900000129','goods_tag' => 'WXG','description' => '腾讯充值中心-QQ会员充值','settle_info' => ['profit_sharing' => true,'subsidy_amount' => 10,],],],$data = ['combine_appid' => 'wx948d4e11762e6bac','combine_mchid' => '1606143582','combine_out_trade_no' => '230688813079966539','sub_orders' => [['mchid' => '1606143582','attach' => 'product_buy-wxpay_jsapi','amount' => ['total_amount' => 100,'currency' => 'CNY',],'out_trade_no' => '2306888130799665391','sub_mchid' => '1606794343','goods_tag' => 'WXG','description' => '实物订单_230688813079966539','settle_info' => ['profit_sharing' => true,'subsidy_amount' => 0,],],],'combine_payer_info' => ['openid' => 'o4baQ0njOxeXDO4yZ0fPXH3lgkuc',],'time_start' => '2021-10-29T15:59:60+08:00','time_expire' => '2021-12-29T15:59:60+08:00','notify_url' => 'https://mlsldshop.codechain.shop/cmobile/api/payment/xcx_jsapi_v3/notify_url.php',];访问接口:$resp = $this->client->request('POST', 'https://api.mch.weixin.qq.com/v3/combine-transactions/jsapi', ['headers' => ['Accept' => 'application/json','Content-type' => 'application/json',],'json' => $data,]);