thinkphp5.0中小程序支付报 ERROR_GATEWAY: Get Wechat API Error:

  • 环境: lamp + 小程序 + thinkPHP5.0
  • 使用的是 yansongda/pay 2.9.3 扩展包做的支付
  • 报错如下:

thinkphp5.0中小程序支付报 ERROR_GATEWAY: Get Wechat API Error:

  • 日志如下:

thinkphp5.0中小程序支付报 ERROR_GATEWAY: Get Wechat API Error:


  • 代码如下:

      protected $config = [
          'miniapp_id' => '***',
          'mch_id' => '**',  // 商户号
          'key' => '**',   // 支付秘钥
          'notify_url' => 'http://requestbin.net/r/1005cpc1',
          'log' => [ // optional
              'file' => '',
              'level' => 'debug', // 建议生产环境等级调整为 info,开发环境为 debug
              'type' => 'single', // optional, 可选 daily.
              'max_file' => 30, // optional, 当 type 为 daily 时有效,默认 30 天
          ],
          'http' => [ // optional
              'timeout' => 5.0,
              'connect_timeout' => 5.0,
          ],
          'mode' => 'dev', // optional, dev/hk;当为 `hk` 时,为香港 gateway。
      ];
    
      ...
    
      $order = [
          'out_trade_no' => $orderId,
          'total_fee' => '1', // **单位:分**
          'body' => 'test body',
          'openid' => $openid['openid']
      ];
      $pay = Pay::wechat($this->config);
      $result = $pay->miniapp($order);
      return json($result);
  • 商户号和支付秘钥没有问题, 求大佬指教下该怎么解决

最佳答案

终于解决了, 是因为 $config 中的 mode 问题, 这里应该设置 normal

4年前 评论
讨论数量: 2

Yansongda\Pay\Gateways\Wechat\Support@processingApiResult 打印一下result,扩展包针对响应处理的不是很好,很多错误信息没有展现出来!

PHP

4年前 评论
qingshui (楼主) 4年前
Imuyu (作者) 4年前
qingshui (楼主) 4年前
qingshui (楼主) 4年前

终于解决了, 是因为 $config 中的 mode 问题, 这里应该设置 normal

4年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!