Ejemplo n.º 1
0
//导入私钥文件, 返回值即为您的商户号,长度15位
$merId = $client_sign->buildKey(PRI_KEY);
if (!$merId) {
    echo "导入私钥文件失败!";
    exit;
}
//接口版本号,境内支付为 20090501,必填
$version = "20090501";
//签名标志,值固定,但不参与签名
$signFlag = "1";
//按次序组合报文信息为待签名串
$plain = $merId . $version;
//进行Base64编码
$data = base64_encode($plain);
//生成签名值,必填
$chkvalue = $client_sign->sign($data);
if (!$chkvalue) {
    echo "签名失败!";
    exit;
}
?>
<title>备付金余额查询</title>
<h1>备付金余额查询</h1>
<?php 
$http = HttpInit();
$post_data = "merId={$merId}&version={$version}&signFlag={$signFlag}&chkValue={$chkvalue}";
$output = HttpPost($http, $post_data, Balance_URL_QRY);
print_r($http);
echo '1231';
if ($output) {
    $output = trim(strip_tags($output));
$merId = $client_sign->buildKey(PRI_KEY);
if (!$merId) {
    echo "导入私钥文件失败!";
    exit;
}
$fromDate = $_REQUEST["fromDate"];
$toDate = $_REQUEST["toDate"];
$stat = $_REQUEST["stat"];
$version = $_REQUEST["version"];
$signFlag = $_REQUEST["signFlag"];
//按次序组合报文信息为待签名串
$plain = $merId . $fromDate . $toDate . $stat . $version;
//进行Base64编码
$signData = base64_encode($plain);
//生成签名值,必填
$chkvalue = $client_sign->sign($signData);
if (!$chkvalue) {
    echo "签名失败!";
    exit;
}
?>
<title>批量退单查询</title>
<h1>批量退单查询</h1>
<?php 
if ($fromDate != '' && $toDate != '') {
    $http = HttpInit();
    $post_data = "merId={$merId}&fromDate={$fromDate}&toDate={$toDate}&stat={$stat}&version={$version}&signFlag={$signFlag}&chkValue={$chkvalue}";
    $output = HttpPost($http, $post_data, BatchOrder_URL_QRY);
    if ($output) {
        $output = trim(strip_tags($output));
        echo "<h2>查询返回</h2>";