微信:
我用的即时到账模式二:扫码支付
流程:网上很多
回调问题:
public functionwxpayNotifyUrl()
{
// 获取微信支付的结果
$xml=$GLOBALS['HTTP_RAW_POST_DATA'];
$this->load->config('wxpay_config');
$wxconfig['appid']=$this->config->item('appid');
$wxconfig['mch_id']=$this->config->item('mch_id');
$wxconfig['apikey']=$this->config->item('apikey');
$wxconfig['appsecret']=$this->config->item('appsecret');
$wxconfig['sslcertPath']=$this->config->item('sslcertPath');
$wxconfig['sslkeyPath']=$this->config->item('sslkeyPath');
$this->logtool->log(array('libxml'=>"libxml"));
// 解析xml 调用的库
libxml_disable_entity_loader(true);
$this->logtool->log(array('libxml'=>"scuess"));
$array= json_decode(json_encode(simplexml_load_string($xml,'SimpleXMLElement',LIBXML_NOCDATA)),true)
if($array!=null){
// 调用微信扫码支付接口配置信息
$this->load->config('wxpay_config');
$wxconfig['appid'] =$this->config->item('appid');
$wxconfig['mch_id'] =$this->config->item('mch_id');
$wxconfig['apikey'] =$this->config->item('apikey');
$wxconfig['appsecret'] =$this->config->item('appsecret');
$wxconfig['sslcertPath'] =$this->config->item('sslcertPath');
$wxconfig['sslkeyPath'] =$this->config->item('sslkeyPath');
//由于此类库构造函数需要传参,我们初始化类库就传参数给他吧
$this->load->library('CI_Wechatpay',$wxconfig);
$out_trade_no=$array['out_trade_no'];
$trade_no=$array['transaction_id'];
// 查询自己平台的订单数据
$result=$this->User_model->GetUserOrderInfo($out_trade_no);
$orderItem=$result->orderinfo;
// 订单完成
if($orderItem->o_state==3) {
//告知微信我成功了
$this->ci_wechatpay->response_back();
}else{
// 订单未完成,更新订单
$result=$this->User_model->UpdateOrderInfo($out_trade_no,"3",$trade_no,"2");
if($result->code==200) {
//告知微信我成功了
$this->ci_wechatpay->response_back();
}else{
//告知微信我失败了继续发
$this->ci_wechatpay->response_back("FAIL");
}
}
}else{
//告知微信我失败了继续发
$this->wechatpay->response_back("FAIL");
}
}
支付宝支付的吭
注意:我用的是UTF-8 MD5版本的
回调后签名签证不正确:这是支付宝的一个bug.
修改:
functionparaFilter($para) {
reset($para);// 添加这一句
$para_filter=array();
while(list($key,$val) = each ($para)) {
if($key=="sign"||$key=="sign_type"||$val=="")continue;
else$para_filter[$key] =$para[$key];
}
return$para_filter;
}