Home > Article > WeChat Applet > WeChat Pay Development Shipping Notice
This article introduces the implementation of the delivery notification function in WeChat payment.
In order to better track the order status, a third party needs to call the shipping notification API to notify WeChat after receiving the final payment notification. The delivery status of the order in the background.
Delivery time limit: within 24 hours for virtual and service products, and within 72 hours for physical products.
After receiving the payment notification, please deliver the goods on time and use the delivery notification interface to synchronize relevant information to the WeChat backend. If the platform does not receive it within the specified time, it will be treated as a delivery overtime.
The URL of the delivery notification API is:
https://api.weixin.qq.com/pay/delivernotify?access_token=xxxxxx
The parameters in the URL are only Contains the current WeChat public platform credential access_token, and the real data of the shipping notice is placed in PostData, with the following format:
{ "appid" : "wwwwb4f85f3a797777", "openid" : "oX99MDgNcgwnz3zFN3DNmo8uwa-w", "transid" : "111112222233333", "out_trade_no" : "555666uuu", "deliver_timestamp" : "1369745073", "deliver_status" : "1", "deliver_msg" : "ok", "app_signature" : "53cca9d47b883bd4a5c85a9300df3da0cb48565c", "sign_method" : "sha1" }
The description of the above content parameters is shown in Table 6-12.
Parameter Description |
##appid |
openid | |
transid | ## Transaction number;|
##out_trade_no | Third-party order number; |
deliver_timestamp | Delivery timestamp, here refers to Is the Linux timestamp; |
deliver_status | delivery status, 1 indicates success, 0 indicates failure, when failure You need to fill in the failure reason in deliver_msg; |
deliver_msg | delivery status information. You can fill in UTF8 when it fails. Encoded error message, such as "This product has been refunded"; |
app_signature | According to the payment signature (paySign) generated by the signature method mentioned in the generation method, the participating signature fields are: appid, appkey, openid, transid, out_trade_no, deliver_timestamp, deliver_status, deliver_msg; |
sign_method |
Signature method (not counted in signature generation); |
Table 6-12 Shipping notification parameter description After verifying ok, the WeChat public platform will return data to indicate whether the notification is successful, for example: {"errcode":0,"errmsg":"ok"}if If there is an exception, it will be described in errcode and errmsg. If successful, errcode will be 0. |
4962cee6a46084ce6f0c22bffc606e31get_biz_sign($obj); //3. 将构造的json提交给微信服务器,查询 $jsonmenu = ' { "appid" : "'.$obj['appid'].'", "openid" : "'.$obj['openid'].'", "transid" : "'.$obj['transid'].'", "out_trade_no" : "'.$obj['out_trade_no'].'", "deliver_timestamp" : "'.$deliver_timestamp.'", "deliver_status" : "'.$obj['deliver_status'].'", "deliver_msg" : "'.$obj['deliver_msg'].'", "app_signature" : "'.$app_signature.'", "sign_method" : "sha1" }'; $url = "https://api.weixin.qq.com/pay/delivernotify?access_token=".$access_token; $result = https_request($url, $jsonmenu); var_dump($result); function https_request($url, $data = null){ $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); if (!empty($data)){ curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); } curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($curl); curl_close($curl); return $output; }Result returned after running
string(27) "{"errcode":0,"errmsg":"ok"}"
For more WeChat payment development and delivery notices, please pay attention to the PHP Chinese website for related articles!