blic 'return_msg' => string 'OK' (length=2)
public 'appid' => string 'wx406c5455be1a2590' (length=18)
public 'mch_id' => string '1398638602' (length=10)
public 'nonce_str' => string '6cFpzNc5BTyZ02x0' (length=16)
public 'sign' => string 'F01C79BD0FC4BC4FE38231BA92A91201' (length=32)
public 'result_code' => string 'SUCCESS' (length=7)
public 'openid' => string 'ojIdvuCVrweMrgaU-dFobIItTtpk' (length=28)
public 'is_subscribe' => string 'N' (length=1)
public 'trade_type' => string 'NATIVE' (length=6)
public 'bank_type' => string 'CFT' (length=3)
public 'total_fee' => string '1' (length=1)
public 'fee_type' => string 'CNY' (length=3)
public 'transaction_id' => string '4001652001201610116386495939' (length=28)
public 'out_trade_no' => string '1476161468' (length=10)
public 'attach' => string '支付' (length=6)
public 'time_end' => string '20161011125205' (length=14)
public 'trade_state' => string 'SUCCESS' (length=7)
public 'cash_fee' => string '1' (length=1)
*/
if (isset($unifiedOrder->trade_state_desc)){
$msg = "订单未支付";
}
if (isset($unifiedOrder->transaction_id)){
$msg = "已支付";
}
return $msg;
}
protected function notify()
{
$config = array(
'mch_id' => $this->mchid,
'appid' => $this->appid,
'key' => $this->key,
);
$postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
/*
$postStr = '<xml>
<appid><![CDATA[wx00e5904efec77699]]></appid>
<attach><![CDATA[支付测试]]></attach>
<bank_type><![CDATA[CMB_CREDIT]]></bank_type>
<cash_fee><![CDATA[1]]></cash_fee>
<fee_type><![CDATA[CNY]]></fee_type>
<is_subscribe><![CDATA[Y]]></is_subscribe>
<mch_id><![CDATA[1220647301]]></mch_id>
<nonce_str><![CDATA[a0tZ41phiHm8zfmO]]></nonce_str>
<openid><![CDATA[oU3OCt5O46PumN7IE87WcoYZY9r0]]></openid>
<out_trade_no><![CDATA[550bf2990c51f]]></out_trade_no>
<result_code><![CDATA[SUCCESS]]></result_code>
<return_code><![CDATA[SUCCESS]]></return_code>
<sign><![CDATA[F6F519B4DD8DB978040F8C866C1E6250]]></sign>
<time_end><![CDATA[20150320181606]]></time_end>
<total_fee>1</total_fee>
<trade_type><![CDATA[JSAPI]]></trade_type>
<transaction_id><![CDATA[1008840847201503200034663980]]></transaction_id>
</xml>';
*/
$postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
if ($postObj === false) {
die('parse xml error');
}
if ($postObj->return_code != 'SUCCESS') {
die($postObj->return_msg);
}
if ($postObj->result_code != 'SUCCESS') {
die($postObj->err_code);
}
$arr = (array)$postObj;
unset($arr['sign']);
if ($this->getSign($arr, $config['key']) == $postObj->sign) {
// $mch_id = $postObj->mch_id; //微信支付分配的商户号
// $appid = $postObj->appid; //微信分配的公众账号ID
// $openid = $postObj->openid; //用户在商户appid下的唯一标识
// $transaction_id = $postObj->transaction_id;//微信支付订单号
// $out_trade_no = $postObj->out_tra |