refundquery.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <?php
  2. /* *
  3. * 功能:支付宝手机网站alipay.trade.fastpay.refund.query (统一收单交易退款查询)调试入口页面
  4. * 版本:2.0
  5. * 修改日期:2016-11-01
  6. * 说明:
  7. * 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
  8. 请确保项目文件有可写权限,不然打印不了日志。
  9. */
  10. header("Content-type: text/html; charset=utf-8");
  11. require_once dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'service/AlipayTradeService.php';
  12. require_once dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'buildermodel/AlipayTradeFastpayRefundQueryContentBuilder.php';
  13. require dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'./../config.php';
  14. if (!empty($_POST['WIDout_trade_no']) || !empty($_POST['WIDtrade_no'])&&!empty($_POST['WIDout_request_no'])){
  15. //商户订单号和支付宝交易号不能同时为空。 trade_no、 out_trade_no如果同时存在优先取trade_no
  16. //商户订单号,和支付宝交易号二选一
  17. $out_trade_no = trim($_POST['WIDout_trade_no']);
  18. //支付宝交易号,和商户订单号二选一
  19. $trade_no = trim($_POST['WIDtrade_no']);
  20. //请求退款接口时,传入的退款请求号,如果在退款请求时未传入,则该值为创建交易时的外部交易号
  21. $out_request_no = trim($_POST['WIDout_request_no']);
  22. $RequestBuilder = new AlipayTradeFastpayRefundQueryContentBuilder();
  23. $RequestBuilder->setTradeNo($trade_no);
  24. $RequestBuilder->setOutTradeNo($out_trade_no);
  25. $RequestBuilder->setOutRequestNo($out_request_no);
  26. $Response = new AlipayTradeService($config);
  27. $result=$Response->refundQuery($RequestBuilder);
  28. return ;
  29. }
  30. ?>
  31. <!DOCTYPE html>
  32. <html>
  33. <head>
  34. <title>支付宝手机网站交易退款查询 (alipay.trade.fastpay.refund.query)</title>
  35. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  36. <style>
  37. *{
  38. margin:0;
  39. padding:0;
  40. }
  41. ul,ol{
  42. list-style:none;
  43. }
  44. body{
  45. font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;
  46. }
  47. .hidden{
  48. display:none;
  49. }
  50. .new-btn-login-sp{
  51. padding: 1px;
  52. display: inline-block;
  53. width: 75%;
  54. }
  55. .new-btn-login {
  56. background-color: #02aaf1;
  57. color: #FFFFFF;
  58. font-weight: bold;
  59. border: none;
  60. width: 100%;
  61. height: 30px;
  62. border-radius: 5px;
  63. font-size: 16px;
  64. }
  65. #main{
  66. width:100%;
  67. margin:0 auto;
  68. font-size:14px;
  69. }
  70. .red-star{
  71. color:#f00;
  72. width:10px;
  73. display:inline-block;
  74. }
  75. .null-star{
  76. color:#fff;
  77. }
  78. .content{
  79. margin-top:5px;
  80. }
  81. .content dt{
  82. width:100px;
  83. display:inline-block;
  84. float: left;
  85. margin-left: 20px;
  86. color: #666;
  87. font-size: 13px;
  88. margin-top: 8px;
  89. }
  90. .content dd{
  91. margin-left:120px;
  92. margin-bottom:5px;
  93. }
  94. .content dd input {
  95. width: 85%;
  96. height: 28px;
  97. border: 0;
  98. -webkit-border-radius: 0;
  99. -webkit-appearance: none;
  100. }
  101. #foot{
  102. margin-top:10px;
  103. position: absolute;
  104. bottom: 15px;
  105. width: 100%;
  106. }
  107. .foot-ul{
  108. width: 100%;
  109. }
  110. .foot-ul li {
  111. width: 100%;
  112. text-align:center;
  113. color: #666;
  114. }
  115. .note-help {
  116. color: #999999;
  117. font-size: 12px;
  118. line-height: 130%;
  119. margin-top: 5px;
  120. width: 100%;
  121. display: block;
  122. }
  123. #btn-dd{
  124. margin: 20px;
  125. text-align: center;
  126. }
  127. .foot-ul{
  128. width: 100%;
  129. }
  130. .one_line{
  131. display: block;
  132. height: 1px;
  133. border: 0;
  134. border-top: 1px solid #eeeeee;
  135. width: 100%;
  136. margin-left: 20px;
  137. }
  138. .am-header {
  139. display: -webkit-box;
  140. display: -ms-flexbox;
  141. display: box;
  142. width: 100%;
  143. position: relative;
  144. padding: 7px 0;
  145. -webkit-box-sizing: border-box;
  146. -ms-box-sizing: border-box;
  147. box-sizing: border-box;
  148. background: #1D222D;
  149. height: 50px;
  150. text-align: center;
  151. -webkit-box-pack: center;
  152. -ms-flex-pack: center;
  153. box-pack: center;
  154. -webkit-box-align: center;
  155. -ms-flex-align: center;
  156. box-align: center;
  157. }
  158. .am-header h1 {
  159. -webkit-box-flex: 1;
  160. -ms-flex: 1;
  161. box-flex: 1;
  162. line-height: 18px;
  163. text-align: center;
  164. font-size: 18px;
  165. font-weight: 300;
  166. color: #fff;
  167. }
  168. </style>
  169. </head>
  170. <body text=#000000 bgColor="#ffffff" leftMargin=0 topMargin=4>
  171. <header class="am-header">
  172. <h1>支付宝手机网站交易退款查询 (alipay.trade.fastpay.refund.query)</h1>
  173. </header>
  174. <div id="main">
  175. <form name=alipayment action='' method=post target="_blank">
  176. <div id="body" style="clear:left">
  177. <dl class="content">
  178. <dt>退款请求号:</dt>
  179. <dd>
  180. <input id="WIDout_request_no" name="WIDout_request_no" />
  181. </dd>
  182. <dt>商户订单号:</dt>
  183. <dd>
  184. <input id="WIDout_trade_no" name="WIDout_trade_no" />
  185. </dd>
  186. <hr class="one_line">
  187. <dt>支付宝交易号:</dt>
  188. <dd>
  189. <input id="WIDtrade_no" name="WIDtrade_no" />
  190. </dd>
  191. <hr class="one_line">
  192. <dt></dt>
  193. <dd>
  194. <span style="line-height: 28px; color:red;">注意:退款请求号值(必传,退款时传的值,如果退款时没传则无法查询)商户订单号和支付宝交易号不能同时为空。 trade_no、 out_trade_no如果同时存在优先取trade_no</span>
  195. </dd>
  196. <dd id="btn-dd">
  197. <span class="new-btn-login-sp">
  198. <button class="new-btn-login" type="submit" style="text-align:center;">确 认</button>
  199. </span>
  200. <span class="note-help">如果您点击“确认”按钮,即表示您同意该次的执行操作。</span>
  201. </dd>
  202. </dl>
  203. </div>
  204. </form>
  205. <div id="foot">
  206. <ul class="foot-ul">
  207. <li>
  208. 支付宝版权所有 2015-2018 ALIPAY.COM
  209. </li>
  210. </ul>
  211. </div>
  212. </div>
  213. </body>
  214. </html>