| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- <?php
- /**
- * Created by PhpStorm.
- * User: airwalk
- * Date: 16/5/20
- * Time: 下午7:54
- */
- header("Content-type: text/html; charset=utf-8");
- require_once 'service/AlipayTradeService.php';
- if (!empty($_POST['out_trade_no'])&& trim($_POST['out_trade_no'])!=""){
- ////获取商户订单号
- $out_trade_no = trim($_POST['out_trade_no']);
- //第三方应用授权令牌,商户授权系统商开发模式下使用
- $appAuthToken = "";//根据真实值填写
- //构造查询业务请求参数对象
- $queryContentBuilder = new AlipayTradeQueryContentBuilder();
- $queryContentBuilder->setOutTradeNo($out_trade_no);
- $queryContentBuilder->setAppAuthToken($appAuthToken);
- //初始化类对象,调用queryTradeResult方法获取查询应答
- $queryResponse = new AlipayTradeService($config);
- $queryResult = $queryResponse->queryTradeResult($queryContentBuilder);
- //根据查询返回结果状态进行业务处理
- switch ($queryResult->getTradeStatus()){
- case "SUCCESS":
- echo "支付宝查询交易成功:"."<br>--------------------------<br>";
- print_r($queryResult->getResponse());
- break;
- case "FAILED":
- echo "支付宝查询交易失败或者交易已关闭!!!"."<br>--------------------------<br>";
- if(!empty($queryResult->getResponse())){
- print_r($queryResult->getResponse());
- }
- break;
- case "UNKNOWN":
- echo "系统异常,订单状态未知!!!"."<br>--------------------------<br>";
- if(!empty($queryResult->getResponse())){
- print_r($queryResult->getResponse());
- }
- break;
- default:
- echo "不支持的查询状态,交易返回异常!!!";
- break;
- }
- return ;
- }
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html>
- <head>
- <title>支付宝当面付 消费查询</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <style>
- *{
- margin:0;
- padding:0;
- }
- ul,ol{
- list-style:none;
- }
- .title{
- color: #ADADAD;
- font-size: 14px;
- font-weight: bold;
- padding: 8px 16px 5px 10px;
- }
- .hidden{
- display:none;
- }
- .new-btn-login-sp{
- border:1px solid #D74C00;
- padding:1px;
- display:inline-block;
- }
- .new-btn-login{
- background-color: transparent;
- background-image: url("../img/new-btn-fixed.png");
- border: medium none;
- }
- .new-btn-login{
- background-position: 0 -198px;
- width: 82px;
- color: #FFFFFF;
- font-weight: bold;
- height: 28px;
- line-height: 28px;
- padding: 0 10px 3px;
- }
- .new-btn-login:hover{
- background-position: 0 -167px;
- width: 82px;
- color: #FFFFFF;
- font-weight: bold;
- height: 28px;
- line-height: 28px;
- padding: 0 10px 3px;
- }
- .bank-list{
- overflow:hidden;
- margin-top:5px;
- }
- .bank-list li{
- float:left;
- width:153px;
- margin-bottom:5px;
- }
- #main{
- width:750px;
- margin:0 auto;
- font-size:14px;
- font-family:'宋体';
- }
- #logo{
- background-color: transparent;
- background-image: url("../img/new-btn-fixed.png");
- border: medium none;
- background-position:0 0;
- width:166px;
- height:35px;
- float:left;
- }
- .red-star{
- color:#f00;
- width:10px;
- display:inline-block;
- }
- .null-star{
- color:#fff;
- }
- .content{
- margin-top:5px;
- }
- .content dt{
- width:160px;
- display:inline-block;
- text-align:right;
- float:left;
- }
- .content dd{
- margin-left:100px;
- margin-bottom:5px;
- }
- #foot{
- margin-top:10px;
- }
- .foot-ul li {
- text-align:center;
- }
- .note-help {
- color: #999999;
- font-size: 12px;
- line-height: 130%;
- padding-left: 3px;
- }
- .cashier-nav {
- font-size: 14px;
- margin: 15px 0 10px;
- text-align: left;
- height:30px;
- border-bottom:solid 2px #CFD2D7;
- }
- .cashier-nav ol li {
- float: left;
- }
- .cashier-nav li.current {
- color: #AB4400;
- font-weight: bold;
- }
- .cashier-nav li.last {
- clear:right;
- }
- .alipay_link {
- text-align:right;
- }
- .alipay_link a:link{
- text-decoration:none;
- color:#8D8D8D;
- }
- .alipay_link a:visited{
- text-decoration:none;
- color:#8D8D8D;
- }
- </style>
- </head>
- <body text=#000000 bgColor="#ffffff" leftMargin=0 topMargin=4>
- <div id="main">
- <div id="head">
- <dl class="alipay_link">
- <a target="_blank" href="http://www.alipay.com/"><span>支付宝首页</span></a>|
- <a target="_blank" href="https://b.alipay.com/home.htm"><span>商家服务</span></a>|
- <a target="_blank" href="http://help.alipay.com/support/index_sh.htm"><span>帮助中心</span></a>
- </dl>
- <span class="title">支付宝 当面付2.0 订单查询接口</span>
- </div>
- <div class="cashier-nav">
- <ol>
- <li class="current">1、确认信息 →</li>
- <li>2、点击确认 →</li>
- <li class="last">3、确认完成</li>
- </ol>
- </div>
- <form name=alipayment action="" method=post target="_blank">
- <div id="body" style="clear:left">
- <dl class="content">
- <dt>商户订单号:</dt>
- <dd>
- <span class="null-star">*</span>
- <input size="30" name="out_trade_no" />
- <span>商户网站订单系统中唯一订单号,必填
- </span>
- </dd>
- <dt></dt>
- <dd>
- <span class="new-btn-login-sp">
- <button class="new-btn-login" type="submit" style="text-align:center;">确 认</button>
- </span>
- </dd>
- </dl>
- </div>
- </form>
- <div id="foot">
- <ul class="foot-ul">
- <li><font class="note-help">如果您点击“确认”按钮,即表示您同意该次的执行操作。 </font></li>
- <li>
- 支付宝版权所有 2011-2015 ALIPAY.COM
- </li>
- </ul>
- </div>
- </div>
- </body>
- </html>
|