queryRefund.php 981 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. //'refund_no' => '15805498596435',
  16. //'transaction_id' => '4988319909620200201172451651106',
  17. //'refund_id' => '4196711984120200201173913842',
  18. ];
  19. // 使用
  20. try {
  21. $client = new \Payment\Client(\Payment\Client::WECHAT, $wxConfig);
  22. $res = $client->refundQuery($data);
  23. } catch (InvalidArgumentException $e) {
  24. echo $e->getMessage();
  25. exit;
  26. } catch (\Payment\Exceptions\GatewayException $e) {
  27. echo $e->getMessage();
  28. exit;
  29. } catch (\Payment\Exceptions\ClassNotFoundException $e) {
  30. echo $e->getMessage();
  31. exit;
  32. }
  33. var_dump($res);