refundquery.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <html>
  2. <head>
  3. <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
  4. <meta name="viewport" content="width=device-width, initial-scale=1" />
  5. <title>微信支付样例-查退款单</title>
  6. </head>
  7. <?php
  8. ini_set('date.timezone','Asia/Shanghai');
  9. error_reporting(E_ERROR);
  10. require_once "../lib/WxPay.Api.php";
  11. require_once 'log.php';
  12. //初始化日志
  13. $logHandler= new CLogFileHandler("../logs/".date('Y-m-d').'.log');
  14. $log = Log::Init($logHandler, 15);
  15. function printf_info($data)
  16. {
  17. foreach($data as $key=>$value){
  18. echo "<font color='#f00;'>$key</font> : $value <br/>";
  19. }
  20. }
  21. if(isset($_REQUEST["transaction_id"]) && $_REQUEST["transaction_id"] != ""){
  22. $transaction_id = $_REQUEST["transaction_id"];
  23. $input = new WxPayRefundQuery();
  24. $input->SetTransaction_id($transaction_id);
  25. printf_info(WxPayApi::refundQuery($input));
  26. }
  27. if(isset($_REQUEST["out_trade_no"]) && $_REQUEST["out_trade_no"] != ""){
  28. $out_trade_no = $_REQUEST["out_trade_no"];
  29. $input = new WxPayRefundQuery();
  30. $input->SetOut_trade_no($out_trade_no);
  31. printf_info(WxPayApi::refundQuery($input));
  32. exit();
  33. }
  34. if(isset($_REQUEST["out_refund_no"]) && $_REQUEST["out_refund_no"] != ""){
  35. $out_refund_no = $_REQUEST["out_refund_no"];
  36. $input = new WxPayRefundQuery();
  37. $input->SetOut_refund_no($out_refund_no);
  38. printf_info(WxPayApi::refundQuery($input));
  39. exit();
  40. }
  41. if(isset($_REQUEST["refund_id"]) && $_REQUEST["refund_id"] != ""){
  42. $refund_id = $_REQUEST["refund_id"];
  43. $input = new WxPayRefundQuery();
  44. $input->SetRefund_id($refund_id);
  45. printf_info(WxPayApi::refundQuery($input));
  46. exit();
  47. }
  48. ?>
  49. <body>
  50. <form action="#" method="post">
  51. <div style="margin-left:2%;color:#f00">微信订单号、商户订单号、微信订单号、微信退款单号选填至少一个,微信退款单号优先:</div><br/>
  52. <div style="margin-left:2%;">微信订单号:</div><br/>
  53. <input type="text" style="width:96%;height:35px;margin-left:2%;" name="transaction_id" /><br /><br />
  54. <div style="margin-left:2%;">商户订单号:</div><br/>
  55. <input type="text" style="width:96%;height:35px;margin-left:2%;" name="out_trade_no" /><br /><br />
  56. <div style="margin-left:2%;">商户退款单号:</div><br/>
  57. <input type="text" style="width:96%;height:35px;margin-left:2%;" name="out_refund_no" /><br /><br />
  58. <div style="margin-left:2%;">微信退款单号:</div><br/>
  59. <input type="text" style="width:96%;height:35px;margin-left:2%;" name="refund_id" /><br /><br />
  60. <div align="center">
  61. <input type="submit" value="查询" style="width:210px; height:50px; border-radius: 15px;background-color:#FE6714; border:0px #FE6714 solid; cursor: pointer; color:white; font-size:16px;" type="button" onclick="callpay()" />
  62. </div>
  63. </form>
  64. </body>
  65. </html>