Get the App
SLTechnology News&Howtos  ›  Development  › 

How to get an alarm notice in WeChat Pay

Shulou Source: shulou.com Published: 2022-06-03 16:16:53 10月01日 Update

This article will explain in detail how to get an alarm notice in WeChat Pay. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

I. alarm notice

In order to timely notify merchants of anomalies and improve the service quality of merchants on Wechat platform. Wechat backend will push alarm notifications to merchants, including delivery delays, failed calls, failed notifications, and so on. The address of the notification is the alarm notification URL entered by merchants when applying for payment, which can be viewed in "Public platform-Services-Service Center-merchant features-merchant basic information-alarm notification URL". After receiving the alarm notice, merchants need to fix the problems mentioned in it as soon as possible, so as not to affect the online business.

The postData received by the alarm notification URL will also contain xml data in the following format:

1001 1393860740

II. Program reception

It has been mentioned in WeChat Pay Development (1) WeChat Pay URL configuration that the alarm notification url is set to

Http://www.doucube.com/wxpay/alarm.php

Now it's time to implement the alarm.php function, which can be obtained by imitating the basic API SDK of Wechat. Write details to a database or other storage

$postStr = $GLOBALS ["HTTP_RAW_POST_DATA"]; $postObj = simplexml_load_string ($postStr, 'SimpleXMLElement', LIBXML_NOCDATA); logger ("error type:". $postObj- > ErrorType. " Misunderstanding description: ". $postObj- > Description." Error details: ". $postObj- > AlarmContent); / / logging function logger ($log_content) {$max_size = 1000000; $log_filename =" log.xml "; if (file_exists ($log_filename) and (abs ($log_filename)) > $max_size)) {unlink ($log_filename);} file_put_contents ($log_filename, date ('Hi function logger').". $log_content. "\ r\ n", FILE_APPEND) } this is the end of the article on "how to get an alarm notice in WeChat Pay". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: Merchant payment article service platform data more error good practical information public content function function background address basic information basic that is Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Huawei Shulou Tech Info vpn macOS