yansongda / laravel-pay

可能是我用过的最优雅的 Alipay/WeChat/Unipay 的 laravel 支付扩展包了

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ERROR_GATEWAY: Get Wechat API Error:签名错误 spbill_create_ip地址为局域网地址

weiyandong opened this issue · comments

测试最简单的支付。提示ERROR_GATEWAY: Get Wechat API Error:签名错误

微信支付日志中:spbill_create_ip地址为局域网地址

环境

  • laravel "6.2"

  • "yansongda/laravel-pay": "^2.2"

  • 测试代码
    $order = [ 'out_trade_no' => time(), 'body' => 'subject-测试', 'total_fee' => '1', ]; $config = config('pay.wechat'); $pay=Pay::wechat($config); $result = $pay->scan($order)

错误描述

  • 报错
    ERROR_GATEWAY: Get Wechat API Error:签名错误
  • 日志
    `

yansongda.pay.DEBUG > Wechat Generate Sign Before UPPER [{"appid":"","body":"subject-测试","mch_id":"","nonce_str":" ","notify_url":"http://www.test.test/wechat/notify","out_trade_no":1592968269,"spbill_create_ip":"172.21.0.14","total_fee":"1","trade_type":"NATIVE"},""]

yansongda.pay.INFO > Wechat PreOrder Method Has Called ["",{"appid":"","mch_id":"","nonce_str":"","notify_url":"http ://www.test.test/wechat/notify","spbill_create_ip":"172.21.0.14","out_trade_no":1592968269,"body":"subject-测试","total_fee":"1","trade_type":"NATIVE","sign":""}]
yansongda.pay.DEBUG > Requesting To Wechat Api ["https://api.mch.weixin.qq.com/pay/unifiedorder",{"appid":"","mch_id":"","nonce_str" :"","notify_url":"http://www.test.test/wechat/notify","spbill_create_ip":"172.21.0.14","out_trade_no":1592968269,"body":"subject-测试","total_fee":"1","trade_type":"NATIVE","sign": ""}]
yansongda.pay.DEBUG > Result Of Wechat Api {"return_code":"FAIL","return_msg":"签名错误"}
`

自己参数配置错误