微信二维码支付的通知回调处理
获取异步通知数据
$weixin = file_get_contents('php://input');
解析数据 xml转数组
$obj = simplexml_load_string($weixin,"SimpleXMLElement", LIBXML_NOCDATA);
$data = json_decode(json_encode($obj),true);
notify返回的数据
A、支付成功的异步通知
Array (
[appid] => appid
[bank_type] => CCB_DEBIT
[cash_fee] => 1
[fee_type] => CNY
[is_subscribe] => N
[mch_id] => mch_id
[nonce_str] => 5f48558fa41a7
[openid] => o6Yya08PrSfOFS8DsCmBJ_RoURwc
[out_trade_no] => 20200828085335873434
[result_code] => SUCCESS
[return_code] => SUCCESS
[sign] => 2A23DE00DD138E553288F3DBCC49E912
[time_end] => 20200828085403
[total_fee] => 1
[trade_type] => NATIVE
[transaction_id] => 4200000721202008289823097889
)
查询订单的支付状态
A、扫描未支付
Array (
[return_code] => SUCCESS
[return_msg] => OK
[appid] => appid
[mch_id] => mch_id
[device_info] =>
[nonce_str] => GR8mjKXt8tuNsu81
[sign] => 4E348373A478E752400F3593E27C9DAB
[result_code] => SUCCESS
[total_fee] => 1
[out_trade_no] => 20200828150554884809
[trade_state] => NOTPAY
[trade_state_desc] => 订单未支付
)
B、扫描支付成功的
Array (
[return_code] => SUCCESS
[return_msg] => OK
[appid] => appid
[mch_id] => mch_id
[nonce_str] => t4pCO8Nvmr7uqOx0
[sign] => 3876BA2223A99B066787F1D9A551028E
[result_code] => SUCCESS
[openid] => o6Yya076u3kY9ExdgIpi-SDXZOsc
[is_subscribe] => N
[trade_type] => NATIVE
[bank_type] => OTHERS
[total_fee] => 1
[fee_type] => CNY
[transaction_id] => 4200000719202008288009765782
[out_trade_no] => 20200828093538226231
[attach] =>
[time_end] => 20200828095549
[trade_state] => SUCCESS
[cash_fee] => 1
[trade_state_desc] => 支付成功
[cash_fee_type] => CNY
)