25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

micropay.php 2.1 KiB

3 yıl önce
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. require_once "../lib/WxPay.Api.php";
  9. require_once "WxPay.MicroPay.php";
  10. require_once 'log.php';
  11. //初始化日志
  12. $logHandler= new CLogFileHandler("../logs/".date('Y-m-d').'.log');
  13. $log = Log::Init($logHandler, 15);
  14. //打印输出数组信息
  15. function printf_info($data)
  16. {
  17. foreach($data as $key=>$value){
  18. echo "<font color='#00ff55;'>$key</font> : $value <br/>";
  19. }
  20. }
  21. if(isset($_REQUEST["auth_code"]) && $_REQUEST["auth_code"] != ""){
  22. $auth_code = $_REQUEST["auth_code"];
  23. $input = new WxPayMicroPay();
  24. $input->SetAuth_code($auth_code);
  25. $input->SetBody("刷卡测试样例-支付");
  26. $input->SetTotal_fee("1");
  27. $input->SetOut_trade_no(WxPayConfig::MCHID.date("YmdHis"));
  28. $microPay = new MicroPay();
  29. printf_info($microPay->pay($input));
  30. }
  31. /**
  32. * 注意:
  33. * 1、提交被扫之后,返回系统繁忙、用户输入密码等错误信息时需要循环查单以确定是否支付成功
  34. * 2、多次(一半10次)确认都未明确成功时需要调用撤单接口撤单,防止用户重复支付
  35. */
  36. ?>
  37. <body>
  38. <form action="#" method="post">
  39. <div style="margin-left:2%;">商品描述:</div><br/>
  40. <input type="text" style="width:96%;height:35px;margin-left:2%;" readonly value="刷卡测试样例-支付" name="auth_code" /><br /><br />
  41. <div style="margin-left:2%;">支付金额:</div><br/>
  42. <input type="text" style="width:96%;height:35px;margin-left:2%;" readonly value="1分" name="auth_code" /><br /><br />
  43. <div style="margin-left:2%;">授权码:</div><br/>
  44. <input type="text" style="width:96%;height:35px;margin-left:2%;" name="auth_code" /><br /><br />
  45. <div align="center">
  46. <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()" />
  47. </div>
  48. </form>
  49. </body>
  50. </html>