示例#1
0
文件: micropay.php 项目: lughong/test
//打印输出数组信息
function printf_info($data)
{
    foreach ($data as $key => $value) {
        echo "<font color='#00ff55;'>{$key}</font> : {$value} <br/>";
    }
}
if (isset($_REQUEST["auth_code"]) && $_REQUEST["auth_code"] != "") {
    $auth_code = $_REQUEST["auth_code"];
    $input = new WxPayMicroPay();
    $input->SetAuth_code($auth_code);
    $input->SetBody("刷卡测试样例-支付");
    $input->SetTotal_fee("1");
    $input->SetOut_trade_no(WxPayConfig::MCHID . date("YmdHis"));
    $microPay = new MicroPay();
    printf_info($microPay->pay($input));
}
/**
 * 注意:
 * 1、提交被扫之后,返回系统繁忙、用户输入密码等错误信息时需要循环查单以确定是否支付成功
 * 2、多次(一半10次)确认都未明确成功时需要调用撤单接口撤单,防止用户重复支付
 */
?>
<body>  
	<form action="#" method="post">
        <div style="margin-left:2%;">商品描述:</div><br/>
        <input type="text" style="width:96%;height:35px;margin-left:2%;" readonly value="刷卡测试样例-支付" name="auth_code" /><br /><br />
        <div style="margin-left:2%;">支付金额:</div><br/>
        <input type="text" style="width:96%;height:35px;margin-left:2%;" readonly value="1分" name="auth_code" /><br /><br />
        <div style="margin-left:2%;">授权码:</div><br/>
        <input type="text" style="width:96%;height:35px;margin-left:2%;" name="auth_code" /><br /><br />