<?php

/**
 * @author huang.xuting
 *
 */
header('Content-type: text/html; charset=gbk');
include_once "netpayclient_config.php";
//加载 netpayclient 组件
include_once "netpayclient.php";
//加载 CURL 函数库,该库由 chinapay 提供,方便您使用 curl 发送 HTTP 请求
include_once "lib_curl.php";
$client_sign = new netpayclient();
//导入私钥文件, 返回值即为您的商户号,长度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 "签名失败!";
<?php

/**
 * @author huang.xuting
 *
 */
header("Content-type: text/html; charset=GBK");
include_once "netpayclient_config.php";
//加载 netpayclient 组件
include_once "netpayclient.php";
//加载 CURL 函数库,该库由 chinapay 提供,方便您使用 curl 发送 HTTP 请求
include_once "lib_curl.php";
$client_sign = new netpayclient();
//导入私钥文件, 返回值即为您的商户号,长度15位
$merId = $client_sign->buildKey(PRI_KEY);
if (!$merId) {
    echo "导入私钥文件失败!";
    exit;
}
//商户日期,本例采用当天日期,必填
$merDate = date('Ymd');
//生成流水号,定长16位,任意数字组合,一天内不允许重复,本例采用当前时间戳,必填
$merSeqId = "00" . date('YmdHis');
//收款账号,必填
$cardNo = "6225882106897891";
//收款人姓名,必填
$usrName = "测试";
//开户银行,本例采用工商银行,必填
$openBank = "工商银行";
//省份,本例采用上海,必填
$prov = "上海";
<?php

/**
 * @author huang.xuting
 *
 */
header('Content-type: text/html; charset=GBK');
include_once "netpayclient_config.php";
//加载 netpayclient 组件
include_once "netpayclient.php";
//加载 CURL 函数库,该库由 chinapay 提供,方便您使用 curl 发送 HTTP 请求
include_once "lib_curl.php";
$client_sign = new netpayclient();
//导入私钥文件, 返回值即为您的商户号,长度15位
$merId = $client_sign->buildKey(PRI_KEY);
if (!$merId) {
    echo "导入私钥文件失败!";
    exit;
}
$merDate = $_REQUEST["merDate"];
$merSeqId = $_REQUEST["merSeqId"];
$cardNo = $_REQUEST["cardNo"];
$usrName = $_REQUEST["usrName"];
$openBank = $_REQUEST["openBank"];
$prov = $_REQUEST["prov"];
$city = $_REQUEST["city"];
$transAmt = $_REQUEST["transAmt"];
$purpose = $_REQUEST["purpose"];
$subBank = $_REQUEST["subBank"];
$flag = $_REQUEST["flag"];
$signFlag = $_REQUEST["signFlag"];