pay-v3-transfer.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 "./pay-v3-config.php";
  20. $pay = \WePayV3\Transfers::instance($config);
  21. $result = $pay->batchs([
  22. 'out_batch_no' => 'plfk2020042013',
  23. 'batch_name' => '2019年1月深圳分部报销单',
  24. 'batch_remark' => '2019年1月深圳分部报销单',
  25. 'total_amount' => 100,
  26. 'transfer_detail_list' => [
  27. [
  28. 'out_detail_no' => 'x23zy545Bd5436',
  29. 'transfer_amount' => 100,
  30. 'transfer_remark' => '2020年4月报销',
  31. 'openid' => 'o-MYE42l80oelYMDE34nYD456Xoy',
  32. 'user_name' => '小小邹'
  33. ]
  34. ]
  35. ]);
  36. echo "\n--- 批量打款 ---\n";
  37. var_export($result);
  38. } catch (\Exception $exception) {
  39. // 出错啦,处理下吧
  40. echo $exception->getMessage() . PHP_EOL;
  41. }