pay-transfersbank-create.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | WeChatDeveloper
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2020 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://think.ctolog.com
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( https://mit-license.org )
  10. // +----------------------------------------------------------------------
  11. // | github开源项目:https://github.com/zoujingli/WeChatDeveloper
  12. // +----------------------------------------------------------------------
  13. try {
  14. // 1. 手动加载入口文件
  15. include "../include.php";
  16. // 2. 准备公众号配置参数
  17. $config = include "./config.php";
  18. // 3. 创建接口实例
  19. // $wechat = new \WeChat\Pay($config);
  20. // $wechat = \We::WeChatPay($config);
  21. $wechat = \WeChat\Pay::instance($config);
  22. // 4. 组装参数,可以参考官方商户文档
  23. $options = [
  24. 'partner_trade_no' => time(),
  25. 'enc_bank_no' => '6212263602037318102',
  26. 'enc_true_name' => '邹景立',
  27. 'bank_code' => '1002',
  28. 'amount' => '100',
  29. 'desc' => '打款测试',
  30. ];
  31. echo '<pre>';
  32. $result = $wechat->createTransfersBank($options);
  33. var_export($result);
  34. } catch (Exception $e) {
  35. // 出错啦,处理下吧
  36. echo $e->getMessage() . PHP_EOL;
  37. }