小程序
小游戏
企业微信
微信支付
扫描小程序码分享
h5支付回调函数url是能直接访问的,但是接收不到数据,php_ini配置也开了,postman测试,是没问题的,但是就是接收不到数据,这是怎么回事呀
2 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
public function wxpay(){ $money2 = I('money2')*100; if(!empty($money2)){ $money = $money2; } // $money= $money; //充值金额 微信支付单位为分 $userip = get_client_ip(); //获得用户设备IP $appid = "..."; //应用APPID $mch_id = "..."; //微信支付商户号 $key = "..."; //微信商户API密钥 $out_trade_no = date('YmdHis').rand(1000,9999);//平台内部订单号 $nonce_str = createNoncestr();//随机字符串 $body = "H5充值";//内容 $total_fee = $money; //金额 $spbill_create_ip = $userip; //IP $notify_url = "http://tt.demo88.top/Login/wxpayresult"; //回调地址 $trade_type = 'MWEB';//交易类型 具体看API 里面有详细介绍 $scene_info ='{"h5_info":{"type":"Wap","wap_url":"http://tt.demo88.top","wap_name":"支付"}}';//场景信息 必要参数 $signA ="appid=$appid&attach=$out_trade_no&body=$body&mch_id=$mch_id&nonce_str=$nonce_str¬ify_url=$notify_url&out_trade_no=$out_trade_no&scene_info=$scene_info&spbill_create_ip=$spbill_create_ip&total_fee=$total_fee&trade_type=$trade_type"; $strSignTmp = $signA."&key=$key"; //拼接字符串 注意顺序微信有个测试网址 顺序按照他的来 直接点下面的校正测试 包括下面XML 是否正确 $sign = strtoupper(MD5($strSignTmp)); // MD5 后转换成大写 $post_data = "<xml> <appid>$appid</appid> <mch_id>$mch_id</mch_id> <body>$body</body> <out_trade_no>$out_trade_no</out_trade_no> <total_fee>$total_fee</total_fee> <spbill_create_ip>$spbill_create_ip</spbill_create_ip> <notify_url>$notify_url</notify_url> <trade_type>$trade_type</trade_type> <scene_info>$scene_info</scene_info> <attach>$out_trade_no</attach> <nonce_str>$nonce_str</nonce_str> <sign>$sign</sign> </xml>";//拼接成XML 格式 $url = "https://api.mch.weixin.qq.com/pay/unifiedorder";//微信传参地址 $dataxml = postXmlCurl($post_data,$url); //后台POST微信传参地址 同时取得微信返回的参数 $objectxml = (array)simplexml_load_string($dataxml, 'SimpleXMLElement', LIBXML_NOCDATA); //将微信返回的XML 转换成数组 $objectxml['mweb_url'] = $objectxml['mweb_url'] . '&redirect_url=' . $notify_url; // dump($objectxml);die; if($objectxml['result_code']=='SUCCESS'){ $this->assign('money',$money); $this->assign('objectxml',$objectxml); $this->display(); }else{ $this->error('充值错误'); } } public function wxpayresult(){ $testxml = file_get_contents("php://input"); // $testxml = $GLOBALS[‘HTTP_RAW_POST_DATA’]; dump($testxml); $jsonxml = json_encode(simplexml_load_string($testxml, 'SimpleXMLElement', LIBXML_NOCDATA)); dump($jsonxml); $result = json_decode($jsonxml, true);//转成数组, dump($result); if($result){ //如果成功返回了 $out_trade_no = $result['out_trade_no']; if($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS'){ //执行业务逻辑 dump(123); } } }
手机网页唤醒后微信支付,成功支付点击完成后,跳转到回调函数的页面,也是回调函数中还是没有接收到数据,这是咋回事呀?
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
建议你更详细描述一下你的问。提供一下你的参数以及具体截图。
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
public function wxpay(){ $money2 = I('money2')*100; if(!empty($money2)){ $money = $money2; } // $money= $money; //充值金额 微信支付单位为分 $userip = get_client_ip(); //获得用户设备IP $appid = "..."; //应用APPID $mch_id = "..."; //微信支付商户号 $key = "..."; //微信商户API密钥 $out_trade_no = date('YmdHis').rand(1000,9999);//平台内部订单号 $nonce_str = createNoncestr();//随机字符串 $body = "H5充值";//内容 $total_fee = $money; //金额 $spbill_create_ip = $userip; //IP $notify_url = "http://tt.demo88.top/Login/wxpayresult"; //回调地址 $trade_type = 'MWEB';//交易类型 具体看API 里面有详细介绍 $scene_info ='{"h5_info":{"type":"Wap","wap_url":"http://tt.demo88.top","wap_name":"支付"}}';//场景信息 必要参数 $signA ="appid=$appid&attach=$out_trade_no&body=$body&mch_id=$mch_id&nonce_str=$nonce_str¬ify_url=$notify_url&out_trade_no=$out_trade_no&scene_info=$scene_info&spbill_create_ip=$spbill_create_ip&total_fee=$total_fee&trade_type=$trade_type"; $strSignTmp = $signA."&key=$key"; //拼接字符串 注意顺序微信有个测试网址 顺序按照他的来 直接点下面的校正测试 包括下面XML 是否正确 $sign = strtoupper(MD5($strSignTmp)); // MD5 后转换成大写 $post_data = "<xml> <appid>$appid</appid> <mch_id>$mch_id</mch_id> <body>$body</body> <out_trade_no>$out_trade_no</out_trade_no> <total_fee>$total_fee</total_fee> <spbill_create_ip>$spbill_create_ip</spbill_create_ip> <notify_url>$notify_url</notify_url> <trade_type>$trade_type</trade_type> <scene_info>$scene_info</scene_info> <attach>$out_trade_no</attach> <nonce_str>$nonce_str</nonce_str> <sign>$sign</sign> </xml>";//拼接成XML 格式 $url = "https://api.mch.weixin.qq.com/pay/unifiedorder";//微信传参地址 $dataxml = postXmlCurl($post_data,$url); //后台POST微信传参地址 同时取得微信返回的参数 $objectxml = (array)simplexml_load_string($dataxml, 'SimpleXMLElement', LIBXML_NOCDATA); //将微信返回的XML 转换成数组 $objectxml['mweb_url'] = $objectxml['mweb_url'] . '&redirect_url=' . $notify_url; // dump($objectxml);die; if($objectxml['result_code']=='SUCCESS'){ $this->assign('money',$money); $this->assign('objectxml',$objectxml); $this->display(); }else{ $this->error('充值错误'); } } public function wxpayresult(){ $testxml = file_get_contents("php://input"); // $testxml = $GLOBALS[‘HTTP_RAW_POST_DATA’]; dump($testxml); $jsonxml = json_encode(simplexml_load_string($testxml, 'SimpleXMLElement', LIBXML_NOCDATA)); dump($jsonxml); $result = json_decode($jsonxml, true);//转成数组, dump($result); if($result){ //如果成功返回了 $out_trade_no = $result['out_trade_no']; if($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS'){ //执行业务逻辑 dump(123); } } }
手机网页唤醒后微信支付,成功支付点击完成后,跳转到回调函数的页面,也是回调函数中还是没有接收到数据,这是咋回事呀?
建议你更详细描述一下你的问。提供一下你的参数以及具体截图。
$money2 = I('money2')*100;
if(!empty($money2)){
$money = $money2;
}
// $money= $money; //充值金额 微信支付单位为分
$userip = get_client_ip(); //获得用户设备IP
$appid = "..."; //应用APPID
$mch_id = "..."; //微信支付商户号
$key = "..."; //微信商户API密钥
$out_trade_no = date('YmdHis').rand(1000,9999);//平台内部订单号
$nonce_str = createNoncestr();//随机字符串
$body = "H5充值";//内容
$total_fee = $money; //金额
$spbill_create_ip = $userip; //IP
$notify_url = "http://tt.demo88.top/Login/wxpayresult"; //回调地址
$trade_type = 'MWEB';//交易类型 具体看API 里面有详细介绍
$scene_info ='{"h5_info":{"type":"Wap","wap_url":"http://tt.demo88.top","wap_name":"支付"}}';//场景信息 必要参数
$signA ="appid=$appid&attach=$out_trade_no&body=$body&mch_id=$mch_id&nonce_str=$nonce_str¬ify_url=$notify_url&out_trade_no=$out_trade_no&scene_info=$scene_info&spbill_create_ip=$spbill_create_ip&total_fee=$total_fee&trade_type=$trade_type";
$strSignTmp = $signA."&key=$key"; //拼接字符串 注意顺序微信有个测试网址 顺序按照他的来 直接点下面的校正测试 包括下面XML 是否正确
$sign = strtoupper(MD5($strSignTmp)); // MD5 后转换成大写
$post_data = "<xml>
<appid>$appid</appid>
<mch_id>$mch_id</mch_id>
<body>$body</body>
<out_trade_no>$out_trade_no</out_trade_no>
<total_fee>$total_fee</total_fee>
<spbill_create_ip>$spbill_create_ip</spbill_create_ip>
<notify_url>$notify_url</notify_url>
<trade_type>$trade_type</trade_type>
<scene_info>$scene_info</scene_info>
<attach>$out_trade_no</attach>
<nonce_str>$nonce_str</nonce_str>
<sign>$sign</sign>
</xml>";//拼接成XML 格式
$url = "https://api.mch.weixin.qq.com/pay/unifiedorder";//微信传参地址
$dataxml = postXmlCurl($post_data,$url); //后台POST微信传参地址 同时取得微信返回的参数
$objectxml = (array)simplexml_load_string($dataxml, 'SimpleXMLElement', LIBXML_NOCDATA); //将微信返回的XML 转换成数组
$objectxml['mweb_url'] = $objectxml['mweb_url'] . '&redirect_url=' . $notify_url;
// dump($objectxml);die;
if($objectxml['result_code']=='SUCCESS'){
$this->assign('money',$money);
$this->assign('objectxml',$objectxml);
$this->display();
}else{
$this->error('充值错误');
}
}
public function wxpayresult(){
$testxml = file_get_contents("php://input");
// $testxml = $GLOBALS[‘HTTP_RAW_POST_DATA’];
dump($testxml);
$jsonxml = json_encode(simplexml_load_string($testxml, 'SimpleXMLElement', LIBXML_NOCDATA));
dump($jsonxml);
$result = json_decode($jsonxml, true);//转成数组,
dump($result);
if($result){
//如果成功返回了
$out_trade_no = $result['out_trade_no'];
if($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS'){
//执行业务逻辑
dump(123);
}
}
}
手机网页唤醒后微信支付,成功支付点击完成后,跳转到回调函数的页面,也是回调函数中还是没有接收到数据,这是咋回事呀?