调用代码:
$unifiedOrder = new WxPayUnifiedOrder();
$unifiedOrder->SetBody($subject);
$unifiedOrder->SetOut_trade_no($out_trade_no);
$unifiedOrder->SetTotal_fee($total);
$unifiedOrder->SetTrade_type("APP");
$result = WxPayApi::unifiedOrder($unifiedOrder);
if (is_array($result)) {
file_put_contents("/tmp/weixin.log",date("Y-m-d H:i:s").":::"."结果:".print_r($result,true)."\n",FILE_APPEND );
return json_encode($result);
}
返回结果:
(
[appid] =>
[noncestr] =>
[package] => Sign=WXPay
[partnerid] =>
[prepayid] =>
[timestamp] => 1653546416
[sign] => D1FD486BB4C67836DD51DA2B8D4C2EBC
)
可以看看我发布的微信对接支付-奶妈级教程:https://developers.weixin.qq.com/community/pay/article/doc/000eae8d940ad00de6fdaecf851c13