Home Backend Development PHP Tutorial Alarm notification example of WeChat payment

Alarm notification example of WeChat payment

Dec 29, 2017 pm 06:15 PM
Alarm Example notify

This article mainly introduces how to obtain alarm notifications in WeChat payment, and attaches example codes for reference. I hope I can help those who develop WeChat Pay.

1. Alarm notification

In order to promptly notify merchants of abnormalities and improve merchants’ service quality on the WeChat platform. The WeChat backend will push alarm notifications to merchants, including delivery delays, call failures, notification failures, etc. The notification address is the alarm notification URL filled in by the merchant when applying for payment, which can be found in "Public Platform - Service - Service Center - Merchant Functions - Merchant Basic Information - Alarm Notification URL" can be viewed. After receiving the alarm notification, merchants need to repair the problems mentioned in it as soon as possible to avoid affecting online operations.

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

<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>
Copy after login

2. Program reception

Now is the implementation of the alarm.php function, which can be obtained by imitating the WeChat basic interface SDK. Write detailed information to the database or other storage

$postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
$postObj = simplexml_load_string($postStr, &#39;SimpleXMLElement&#39;, 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(&#39;H:i:s&#39;)." ".$log_content."\r\n", FILE_APPEND);
}
Copy after login

Related recommendations:

WeChat refund function example of PHP WeChat payment development

Detailed explanation of Thinkphp integrating WeChat payment function

10 recommended courses on WeChat payment development

The above is the detailed content of Alarm notification example of WeChat payment. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to clear notifications on iPhone How to clear notifications on iPhone Feb 15, 2024 pm 06:10 PM

While notifications aren't the strongest suite on the iPhone, in recent iOS updates, Apple has fine-tuned how they appear. The new iOS version minimizes the visibility of alerts through Notification Center to ensure users have a better experience. In this article, we will help you clear notifications on iPhone in various different ways. How to turn off incoming notification banners on iPhone When you are on the Home screen or actively using an app, all notifications will appear as banners at the top unless you disable this feature. If you want to check the notification later without interrupting your current task, simply swipe the banner up to dismiss it. This will move the notifications you receive to Notification Center so you can

Windows 11 User Guide: How to disable ad pop-ups Windows 11 User Guide: How to disable ad pop-ups Sep 22, 2023 pm 07:21 PM

Microsoft's Windows 11 operating system may periodically display suggestions as pop-ups on your computer using the notification system. The suggestions system, originally intended to provide users with tips and suggestions for improving their Windows 11 workflows, has almost completely transformed into an advertising system to promote Microsoft services and products. Suggestion pop-ups might advertise a Microsoft 365 subscription to users, suggest linking an Android phone to the device, or set up a backup solution. If these pop-ups annoy you, you can tweak your system to disable them entirely. The following guide provides recommendations on disabling pop-ups on devices running Microsoft’s Windows 11 operating system.

SVM examples in Python SVM examples in Python Jun 11, 2023 pm 08:42 PM

Support Vector Machine (SVM) in Python is a powerful supervised learning algorithm that can be used to solve classification and regression problems. SVM performs well when dealing with high-dimensional data and non-linear problems, and is widely used in data mining, image classification, text classification, bioinformatics and other fields. In this article, we will introduce an example of using SVM for classification in Python. We will use the SVM model from the scikit-learn library

How to turn off Apple TV keyboard reminders on iPhone How to turn off Apple TV keyboard reminders on iPhone Nov 30, 2023 pm 11:41 PM

On AppleTV, if you don't want to use AppleTV Remote to enter text, you can type using a nearby iPhone or iPad. Whenever a text field appears on AppleTV, a notification will appear on your iPhone or iPad. After tapping the notification, you can use the on-screen keyboard on your iOS device to enter text on AppleTV. If you find these notifications annoying, you can disable them on your iPhone or iPad (if you have a few AppleTVs and kids at home, you'll know what we mean). If you're running iOS/iPadOS 15.1 or later, here's how to disable them. Launch on iPhone or iPad

How to convert your website into a standalone Mac app How to convert your website into a standalone Mac app Oct 12, 2023 pm 11:17 PM

In macOS Sonoma and Safari 17, you can turn websites into "web apps," which can sit in your Mac's dock and be accessed like any other app without opening a browser. Read on to learn how it works. Thanks to a new option in Apple's Safari browser, it's now possible to turn any website on the internet you frequently visit into a standalone "web app" that lives in your Mac's dock and is ready for you to access at any time. The web app works with Mission Control and Stage Manager like any app, and can also be opened via Launchpad or SpotlightSearch. How to turn any website into

How to implement message push and notification in uniapp application How to implement message push and notification in uniapp application Oct 18, 2023 am 09:19 AM

Uniapp is a cross-platform development framework based on Vue.js that can be used to develop applications that run on multiple platforms at the same time. When implementing message push and notification functions, Uniapp provides some corresponding plug-ins and APIs. The following will introduce how to use these plug-ins and APIs to implement message push and notification functions. 1. Message push To implement the message push function, we can use the uni-push plug-in provided by Uniapp. This plug-in is based on Tencent Cloud Push Service and can push messages on multiple platforms

How to use check-ins with home, different locations, and timers How to use check-ins with home, different locations, and timers Mar 24, 2024 am 09:31 AM

How to let others know that you have arrived at your destination. Telling others that you have arrived at your destination safely is the most common way of &quot;checking in&quot; and it is easy to operate. Here are the steps to set up before you’re ready to embark on the next leg of your journey. Open a message and start a conversation with the person you want to send a check-in to. Click the plus (+) icon next to the message field. Click Check-in. Click Edit at the bottom of the prompt. Enter the destination you want to go to. Select &quot;Done&quot; in the upper right corner and send &quot;Check-in.&quot; &quot;When entering your destination, you can choose different modes of travel depending on your needs, whether that's by car, public transport or walking. Make sure you choose the device you're using correctly so your device can accurately estimate how long it will take to get to your destination. This allows you to better plan your trip and get you to your destination more conveniently.

VUE3 Getting Started Example: Making a Simple Video Player VUE3 Getting Started Example: Making a Simple Video Player Jun 15, 2023 pm 09:42 PM

As the new generation of front-end frameworks continues to emerge, VUE3 is loved as a fast, flexible, and easy-to-use front-end framework. Next, let's learn the basics of VUE3 and make a simple video player. 1. Install VUE3 First, we need to install VUE3 locally. Open the command line tool and execute the following command: npminstallvue@next Then, create a new HTML file and introduce VUE3: &lt;!doctypehtml&gt;

See all articles