queryOrder.php 879 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /*
  3. * The file is part of the payment lib.
  4. *
  5. * (c) Leo <dayugog@gmail.com>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. require_once __DIR__ . '/../../vendor/autoload.php';
  11. date_default_timezone_set('Asia/Shanghai');
  12. $wxConfig = require_once __DIR__ . '/../wxconfig.php';
  13. $data = [
  14. 'trade_no' => '15805490027722',
  15. //'transaction_id' => '4557984565220190407200528457633',
  16. ];
  17. // 使用
  18. try {
  19. $client = new \Payment\Client(\Payment\Client::WECHAT, $wxConfig);
  20. $res = $client->tradeQuery($data);
  21. } catch (InvalidArgumentException $e) {
  22. echo $e->getMessage();
  23. exit;
  24. } catch (\Payment\Exceptions\GatewayException $e) {
  25. echo $e->getMessage();
  26. exit;
  27. } catch (\Payment\Exceptions\ClassNotFoundException $e) {
  28. echo $e->getMessage();
  29. exit;
  30. }
  31. var_dump($res);