微信支付回调地址中处理代码
回调数据参数说明网址:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_7
/** postObj解析出来的数组 *Array * ( * [appid] => wx1c870c0145984d30 * [bank_type] => CFT * [cash_fee] => 100 * [fee_type] => CNY * [is_subscribe] => N * [mch_id] => 1297210301 * [nonce_str] => gkq1x5fxejqo5lz5eua50gg4c4la18vy * [openid] => olSGW5BBvfep9UhlU40VFIQlcvZ0 * [out_trade_no] => SH20190510588796 //商户生成的内部订单号 * [result_code] => SUCCESS * [return_code] => SUCCESS * [sign] => F6890323B0A6A3765510D152D9420EAC * [time_end] => 20180626170839 * [total_fee] => 100 * [trade_type] => JSAPI * [transaction_id] => 4200000134201806265483331660 //微信生成的订单号 * ) */ public function notifypay(){ $postStr = $GLOBALS["HTTP_RAW_POST_DATA"]; $postObj = simplexml_load_string($postStr,'SimpleXMLElement',LIBXML_NOCDATA); if($postObj->result_code == 'SUCCESS'){ $where['ordernumber'] = $postObj->out_trade_no; //获取订单编号,用于订单状态的处理 Db::name('order')->where($where)->update(['status'=>2]); } return json_encode(['code'=>200,'msg'=>'success']); }
版权声明:本站所提供的文章、图片等内容均为用户发布或互联网整理而来,仅供学习参考,如有侵犯您的版权,请联系我们客服人员删除。