$this->merchant_no, 'merchant_order_no' => $order_no, //异步通知的地址 'notify_url' => $notify_url, //同步跳转的地址 //'return_url' => $return_url, 'start_time' => date('YmdHis'), 'trade_amount' => $pay_amount, 'goods_name' => $title, 'goods_desc' => $title, 'user_ip' => Request::instance()->ip(), 'pay_sence' => '{"type":"Wap","wap_url":"http://www.weilongwl.com","wap_name":"麻花网络"}', 'receivers' => json_encode($receivers), 'sign_type' => 1 ); } else{ $param = array( 'merchant_no' => $this->merchant_no, 'merchant_order_no' => $order_no, //异步通知的地址 'notify_url' => $notify_url, //同步跳转的地址 //'return_url' => $return_url, 'start_time' => date('YmdHis'), 'trade_amount' => $pay_amount, 'goods_name' => $title, 'goods_desc' => $title, 'user_ip' => Request::instance()->ip(), 'pay_sence' => '{"type":"Wap","wap_url":"http://www.weilongwl.com","wap_name":"麻花网络"}', 'sign_type' => 1 ); } //签名 $sign = local_sign($param, $this->key); $param['sign'] = $sign; $res = getdata($this->payUrl, $param); $list = json_decode($res, true); /* echo "
";
print_r($list);
echo "";
*/
//对响应结果进行验签,具体见下面的验签示例
if (local_sign($list['data'], $this->key) == $list['data']['sign']) {
// echo '响应结果验签成功,请继续您的业务层操作';
return $list;
} else {
// echo '验签失败';
return false;
}
}
public function scanpay($title, $order_no, $pay_amount,$return_url='',$notify_url=''){
//请求的参数(注:不同支付接口请求参数略有不同,具体请参照接口文档)
//分账逻辑处理
$sub_amount = floatval(intval($pay_amount * 100 * 0.295)/100);
$receivers = array();
if($sub_amount){
$receiver = array();
$receiver['type'] = 'PERSONAL_OPENID';
$receiver['account'] = 'oSepO0l1J_2CyAj-6jebvQov-krk';
$receiver['name'] = '郑坦';
$receiver['amount'] = $sub_amount;
$receiver['description'] = '分到个人';
$receivers[] = $receiver;
}
if($receivers){
$param = array(
'merchant_no' => $this->merchant_no,
'merchant_order_no' => $order_no,
//异步通知的地址
'notify_url' => $notify_url,
//同步跳转的地址
// 'return_url' => $return_url,
'start_time' => date('YmdHis'),
'trade_amount' => $pay_amount,
'goods_name' => $title,
'goods_desc' => $title,
'user_ip' => Request::instance()->ip(),
'pay_type' => 2,
'receivers' => json_encode($receivers),
'sign_type' => 1
);
}
else{
$param = array(
'merchant_no' => $this->merchant_no,
'merchant_order_no' => $order_no,
//异步通知的地址
'notify_url' => $notify_url,
//同步跳转的地址
// 'return_url' => $return_url,
'start_time' => date('YmdHis'),
'trade_amount' => $pay_amount,
'goods_name' => $title,
'goods_desc' => $title,
'user_ip' => Request::instance()->ip(),
'pay_type' => 2,
'sign_type' => 1
);
}
//签名
$sign = local_sign($param, $this->key);
$param['sign'] = $sign;
$res = getdata($this->scanPayUrl, $param);
$list = json_decode($res, true);
/*
echo "";
print_r($list);
echo "";
*/
//对响应结果进行验签,具体见下面的验签示例
if (local_sign($list['data'], $this->key) == $list['data']['sign']) {
// echo '响应结果验签成功,请继续您的业务层操作';
return $list;
} else {
// echo '验签失败';
return false;
}
}
public function notifyVerify($data){
//签名
$sign = local_sign($data, $this->key);
if ($sign == $data['sign']){
return $data;
} else {
return false;
}
}
public function queryOrder($order_no)
{
//请求的参数(注:不同支付接口请求参数略有不同,具体请参照接口文档)
$param = array(
'merchant_no' => $this->merchant_no,
'trade_no' => $order_no,
'sign_type' => 1
);
//签名
$sign = local_sign($param, $this->key);
$param['sign'] = $sign;
$res = getdata($this->queryUrl, $param);
$list = json_decode($res, true);
/*
echo "";
print_r($list);
echo "";
*/
//对响应结果进行验签,具体见下面的验签示例
if (isset($list['data']['sign']) && local_sign($list['data'], $this->key) == $list['data']['sign']) {
return $res;
echo '验签成功';
} else {
echo '验签失败';
return false;
}
}
}