pay-order-query.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | WeChatDeveloper
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: https://thinkadmin.top
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( https://mit-license.org )
  10. // | 免责声明 ( https://thinkadmin.top/disclaimer )
  11. // +----------------------------------------------------------------------
  12. // | gitee 代码仓库:https://gitee.com/zoujingli/WeChatDeveloper
  13. // | github 代码仓库:https://github.com/zoujingli/WeChatDeveloper
  14. // +----------------------------------------------------------------------
  15. try {
  16. // 1. 手动加载入口文件
  17. include "../include.php";
  18. // 2. 准备公众号配置参数
  19. $config = include "./config.php";
  20. // 3. 创建接口实例
  21. // $wechat = new \WeChat\Pay($config);
  22. // $wechat = \We::WeChatPay($config);
  23. $wechat = \WeChat\Pay::instance($config);
  24. // 4. 组装参数,可以参考官方商户文档
  25. $options = [
  26. 'transaction_id' => '1008450740201411110005820873',
  27. // 'out_trade_no' => '商户订单号',
  28. ];
  29. $result = $wechat->queryOrder($options);
  30. var_export($result);
  31. } catch (Exception $e) {
  32. // 出错啦,处理下吧
  33. echo $e->getMessage() . PHP_EOL;
  34. }