您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

微信支付开发 告警通知

2024/4/18 23:40:23发布13次查看
本文介绍微信支付中如何获得告警通知。
一、告警通知
为了及时通知商户异常,提高商户在微信平台的服务质量。微信后台会向商户推送告警通知,包括发货延迟、调用失败、通知失败等情况,通知的地址是商户在申请支付时填写的告警通知url,在“公众平台-服务-服务中心-商户功能-商户基本资料-告警通知url”可以查看。商户接收到告警通知后需要尽快修复其中提到的问题,以免影响线上经营。
告警通知url接收的postdata中还将含xml数据,格式如下:
<xml> <appid><![cdata[wxf8b4f85f3a794e77]]></appid> <errortype>1001</errortype> <description><![cdata[错识描述]]></description> <alarmcontent><![cdata[错误详情]]></alarmcontent> <timestamp>1393860740</timestamp> <appsignature><![cdata[f8164781a303f4d5a944a2dfc68411a8c7e4fbea]]></appsignature> <signmethod><![cdata[sha1]]></signmethod> </xml>
二、程序接收
在微信支付开发(1) 微信支付url配置中已提到,设置了告警通知url为
http://www.doucube.com/wxpay/alarm.php
现在就是alarm.php函数的实现了,仿照微信基础接口sdk获取即可。将详细信息写入数据库或其他存储
$poststr = $globals["http_raw_post_data"]; $postobj = simplexml_load_string($poststr, 'simplexmlelement', libxml_nocdata); logger("错误类型:".$postobj->errortype."错识描述:".$postobj->description."错误详情:".$postobj->alarmcontent); //日志记录 function logger($log_content) { $max_size = 100000; $log_filename = "log.xml"; if(file_exists($log_filename) and (abs(filesize($log_filename)) > $max_size)){unlink($log_filename);} file_put_contents($log_filename, date('h:i:s')." ".$log_content."\r\n", file_append); }
更多微信支付开发 告警通知。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product