settlement.php 864 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. // 订单信息
  14. $params = [
  15. 'bill_date' => '20200201',
  16. 'bill_type' => 'Basic',
  17. ];
  18. // 使用
  19. try {
  20. $client = new \Payment\Client(\Payment\Client::WECHAT, $wxConfig);
  21. $res = $client->settleDownload($params);
  22. } catch (InvalidArgumentException $e) {
  23. echo $e->getMessage();
  24. exit;
  25. } catch (\Payment\Exceptions\GatewayException $e) {
  26. echo $e->getMessage();
  27. exit;
  28. } catch (\Payment\Exceptions\ClassNotFoundException $e) {
  29. echo $e->getMessage();
  30. exit;
  31. }
  32. var_dump($res);