Downloaded the official DEMO of WeChat Pay and paid using Mode 2. There is no problem with the payment now and the payment can be successful. However, the XML data sent by WeChat cannot be received in the callback notify.php;
$input = $GLOBALS['HTTP_RAW_POST_DATA'];
$xml = simplexml_load_string($input, 'SimpleXMLElement', LIBXML_NOCDATA);
var_dump($xml);
The WeChat official account payment authorization directory is as follows:
If yes
PHP7
Use the following method to obtain the WeChat asynchronous notification parameters$GLOBALS['HTTP_RAW_POST_DATA']; It seems that the entire function has been deleted in php7, use file_get_contents('php://input')
1. First check the log in nginx or apache to check whether the WeChat client requested a callback connection after the payment was successful.
2. If a link is requested, check the function logic issues in the callback
Higher versions of PHP are not available
HTTP_RAW_POST_DATA
Please use them consistently