Closed km3945 closed 5 years ago
PHP 7.1.27 Yansongda\Pay 2.7.4 thinkphp5.1.35
支付宝,WEB方式 验签失败
public function alipay($oid) { $order = [ 'out_trade_no' => time(), 'total_amount' => '0.01', 'subject' => 'test subject-km3945', ]; $alipay = Pay::alipay($this->alipay_config)->web($order); return $alipay; } public function alipay_return() { $data = Pay::alipay($this->alipay_config)->verify(); // 是的,验签就这么简单 Log::debug('alipay_return', ['alipay_return DONE']); return $data; // 订单号:$data->out_trade_no // 支付宝交易号:$data->trade_no // 订单总金额:$data->total_amount } public function alipay_notify() { $alipay = Pay::alipay($this->alipay_config); try{ $data=$alipay->verify(); Log::debug('Alipay notify', ['Alipay notify DONE']); } catch (\Exception $e) { Log::debug('Alipay notify E ', [$e->getMessage()]); } return $alipay; }
Alipay Sign Verify FAILED
2019-04-20 09:45:18 > yansongda.pay.DEBUG > Starting To Alipay ["web",{"out_trade_no":1555724718,"total_amount":"0.01","subject":"test subject-km3945"}] 2019-04-20 09:45:18 > yansongda.pay.DEBUG > Alipay Generate Sign Content Before Trim [{"app_id":"2019011563017364","biz_content":"{\"out_trade_no\":1555724718,\"total_amount\":\"0.01\",\"subject\":\"test subject-km3945\",\"product_code\":\"FAST_INSTANT_TRADE_PAY\"}","charset":"utf-8","format":"JSON","method":"alipay.trade.page.pay","notify_url":"http://baidu.com","return_url":"http://pays.kuaifubei.cn/api/alipay/return.html","sign_type":"RSA2","timestamp":"2019-04-20 09:45:18","version":"1.0"},"app_id=2019011563017364&biz_content={\"out_trade_no\":1555724718,\"total_amount\":\"0.01\",\"subject\":\"test subject-km3945\",\"product_code\":\"FAST_INSTANT_TRADE_PAY\"}&charset=utf-8&format=JSON&method=alipay.trade.page.pay¬ify_url=http://baidu.com&return_url=http://pays.kuaifubei.cn/api/alipay/return.html&sign_type=RSA2×tamp=2019-04-20 09:45:18&version=1.0&"] 2019-04-20 09:45:18 > yansongda.pay.DEBUG > Alipay Generate Sign [{"app_id":"2019011563017364","format":"JSON","charset":"utf-8","sign_type":"RSA2","version":"1.0","return_url":"http://pays.kuaifubei.cn/api/alipay/return.html","notify_url":"http://baidu.com","timestamp":"2019-04-20 09:45:18","biz_content":"{\"out_trade_no\":1555724718,\"total_amount\":\"0.01\",\"subject\":\"test subject-km3945\",\"product_code\":\"FAST_INSTANT_TRADE_PAY\"}","method":"alipay.trade.page.pay"},"XK7Wne6w5+OILmeF/WbGfx4gZgIfH0D9tKPj+cS1XLwysVuCuMR+hlhvFxwrV1oxGpo4hVvn7Oa3lZ+WIIpC3lrb4lJZ9C9ZVxCgUzvQ3JXBAxWhBvROBjDyL+QGjWBYuROWRKrwjPkNbdc0bxXfm5vDok0AhQv9ARFO1FRjyO6DpavGvUK+lEhwhw2pGZ1aC1tScf9DPUI48MN2e6nAwV9PO6v5f/9oGBZOL/uvhYfwBkvwW63ZYPIO4UdBsNGkX+rjoEiasAo4R0ZKIvM/L4DkuIi/AVcPoniuy3N2qPHSoabk3BxmZMCnunVUiYkHYiEiWdJk1E9W7S7bsyp6QQ=="] 2019-04-20 09:45:18 > yansongda.pay.INFO > Alipay Web/Wap Has Started ["https://openapi.alipay.com/gateway.do",{"app_id":"2019011563017364","format":"JSON","charset":"utf-8","sign_type":"RSA2","version":"1.0","return_url":"http://pays.kuaifubei.cn/api/alipay/return.html","notify_url":"http://baidu.com","timestamp":"2019-04-20 09:45:18","biz_content":"{\"out_trade_no\":1555724718,\"total_amount\":\"0.01\",\"subject\":\"test subject-km3945\",\"product_code\":\"FAST_INSTANT_TRADE_PAY\"}","method":"alipay.trade.page.pay","sign":"XK7Wne6w5+OILmeF/WbGfx4gZgIfH0D9tKPj+cS1XLwysVuCuMR+hlhvFxwrV1oxGpo4hVvn7Oa3lZ+WIIpC3lrb4lJZ9C9ZVxCgUzvQ3JXBAxWhBvROBjDyL+QGjWBYuROWRKrwjPkNbdc0bxXfm5vDok0AhQv9ARFO1FRjyO6DpavGvUK+lEhwhw2pGZ1aC1tScf9DPUI48MN2e6nAwV9PO6v5f/9oGBZOL/uvhYfwBkvwW63ZYPIO4UdBsNGkX+rjoEiasAo4R0ZKIvM/L4DkuIi/AVcPoniuy3N2qPHSoabk3BxmZMCnunVUiYkHYiEiWdJk1E9W7S7bsyp6QQ=="}] 2019-04-20 09:45:59 > yansongda.pay.INFO > Received Alipay Request {"charset":"utf-8","out_trade_no":"1555724718","method":"alipay.trade.page.pay.return","total_amount":"0.01","sign":"KyiNYu/Bcx+GDX+9pWtndVNsr1Aa7tB+xmbsA6qoSZqcCw1rhpss1RD80E3YdYTTydpfQFlDX+liZvdtIOS1SH5W7loZp3PTr2VrejVrPmYT5MQSqkIdWyHhaKOtefSCQc0xJaJY4mKz8JAp4or5wU9fJPG0zpJkbZ+qTQ0OqsmR9lOgYMWyiS6nxCTU9pM/lJfvTRRXhnndxvNprDq7y06dP7pRg9qACbi5d7Xk+hqVzoMxBuiC4OIcdkWF7WTdlEjLBT453oTcNdW99yq6MJnpm1yR9RIrJZd1RL5nDi2Z1hxRR6oVoImzie9h8eenT17uWQnzqaAx+gkBL+cw9Q==","trade_no":"2019042022001494741027788632","auth_app_id":"2019011563017364","version":"1.0","app_id":"2019011563017364","sign_type":"RSA2","seller_id":"2088431039918370","timestamp":"2019-04-20 09:46:34"} 2019-04-20 09:45:59 > yansongda.pay.DEBUG > Alipay Generate Sign Content Before Trim [{"app_id":"2019011563017364","auth_app_id":"2019011563017364","charset":"utf-8","method":"alipay.trade.page.pay.return","out_trade_no":"1555724718","seller_id":"2088431039918370","sign":"KyiNYu/Bcx+GDX+9pWtndVNsr1Aa7tB+xmbsA6qoSZqcCw1rhpss1RD80E3YdYTTydpfQFlDX+liZvdtIOS1SH5W7loZp3PTr2VrejVrPmYT5MQSqkIdWyHhaKOtefSCQc0xJaJY4mKz8JAp4or5wU9fJPG0zpJkbZ+qTQ0OqsmR9lOgYMWyiS6nxCTU9pM/lJfvTRRXhnndxvNprDq7y06dP7pRg9qACbi5d7Xk+hqVzoMxBuiC4OIcdkWF7WTdlEjLBT453oTcNdW99yq6MJnpm1yR9RIrJZd1RL5nDi2Z1hxRR6oVoImzie9h8eenT17uWQnzqaAx+gkBL+cw9Q==","sign_type":"RSA2","timestamp":"2019-04-20 09:46:34","total_amount":"0.01","trade_no":"2019042022001494741027788632","version":"1.0"},"app_id=2019011563017364&auth_app_id=2019011563017364&charset=utf-8&method=alipay.trade.page.pay.return&out_trade_no=1555724718&seller_id=2088431039918370×tamp=2019-04-20 09:46:34&total_amount=0.01&trade_no=2019042022001494741027788632&version=1.0&"] 2019-04-20 09:45:59 > yansongda.pay.WARNING > Alipay Sign Verify FAILED {"charset":"utf-8","out_trade_no":"1555724718","method":"alipay.trade.page.pay.return","total_amount":"0.01","sign":"KyiNYu/Bcx+GDX+9pWtndVNsr1Aa7tB+xmbsA6qoSZqcCw1rhpss1RD80E3YdYTTydpfQFlDX+liZvdtIOS1SH5W7loZp3PTr2VrejVrPmYT5MQSqkIdWyHhaKOtefSCQc0xJaJY4mKz8JAp4or5wU9fJPG0zpJkbZ+qTQ0OqsmR9lOgYMWyiS6nxCTU9pM/lJfvTRRXhnndxvNprDq7y06dP7pRg9qACbi5d7Xk+hqVzoMxBuiC4OIcdkWF7WTdlEjLBT453oTcNdW99yq6MJnpm1yR9RIrJZd1RL5nDi2Z1hxRR6oVoImzie9h8eenT17uWQnzqaAx+gkBL+cw9Q==","trade_no":"2019042022001494741027788632","auth_app_id":"2019011563017364","version":"1.0","app_id":"2019011563017364","sign_type":"RSA2","seller_id":"2088431039918370","timestamp":"2019-04-20 09:46:34"}
涉及到 异步通知、同步通知 的问题,请贴出来 为了日志干净,只调试了同步通知 112.115.88.247 - - [20/Apr/2019:09:45:18 +0800] "GET /api HTTP/1.1" 200 777 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36" "-" 112.115.88.247 - - [20/Apr/2019:09:45:59 +0800] "GET /api/alipay/return.html?charset=utf-8&out_trade_no=1555724718&method=alipay.trade.page.pay.return&total_amount=0.01&sign=KyiNYu%2FBcx%2BGDX%2B9pWtndVNsr1Aa7tB%2BxmbsA6qoSZqcCw1rhpss1RD80E3YdYTTydpfQFlDX%2BliZvdtIOS1SH5W7loZp3PTr2VrejVrPmYT5MQSqkIdWyHhaKOtefSCQc0xJaJY4mKz8JAp4or5wU9fJPG0zpJkbZ%2BqTQ0OqsmR9lOgYMWyiS6nxCTU9pM%2FlJfvTRRXhnndxvNprDq7y06dP7pRg9qACbi5d7Xk%2BhqVzoMxBuiC4OIcdkWF7WTdlEjLBT453oTcNdW99yq6MJnpm1yR9RIrJZd1RL5nDi2Z1hxRR6oVoImzie9h8eenT17uWQnzqaAx%2BgkBL%2Bcw9Q%3D%3D&trade_no=2019042022001494741027788632&auth_app_id=2019011563017364&version=1.0&app_id=2019011563017364&sign_type=RSA2&seller_id=2088431039918370×tamp=2019-04-20+09%3A46%3A34 HTTP/1.1" 500 31630 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36" "-"
涉及到 异步通知、同步通知 的问题,请贴出来 为了日志干净,只调试了同步通知
112.115.88.247 - - [20/Apr/2019:09:45:18 +0800] "GET /api HTTP/1.1" 200 777 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36" "-" 112.115.88.247 - - [20/Apr/2019:09:45:59 +0800] "GET /api/alipay/return.html?charset=utf-8&out_trade_no=1555724718&method=alipay.trade.page.pay.return&total_amount=0.01&sign=KyiNYu%2FBcx%2BGDX%2B9pWtndVNsr1Aa7tB%2BxmbsA6qoSZqcCw1rhpss1RD80E3YdYTTydpfQFlDX%2BliZvdtIOS1SH5W7loZp3PTr2VrejVrPmYT5MQSqkIdWyHhaKOtefSCQc0xJaJY4mKz8JAp4or5wU9fJPG0zpJkbZ%2BqTQ0OqsmR9lOgYMWyiS6nxCTU9pM%2FlJfvTRRXhnndxvNprDq7y06dP7pRg9qACbi5d7Xk%2BhqVzoMxBuiC4OIcdkWF7WTdlEjLBT453oTcNdW99yq6MJnpm1yR9RIrJZd1RL5nDi2Z1hxRR6oVoImzie9h8eenT17uWQnzqaAx%2BgkBL%2Bcw9Q%3D%3D&trade_no=2019042022001494741027788632&auth_app_id=2019011563017364&version=1.0&app_id=2019011563017364&sign_type=RSA2&seller_id=2088431039918370×tamp=2019-04-20+09%3A46%3A34 HTTP/1.1" 500 31630 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36" "-"
请确认支付宝公钥正确
感谢支持
谢谢.DONE
包版本号
PHP 7.1.27 Yansongda\Pay 2.7.4 thinkphp5.1.35
问题描述
支付宝,WEB方式 验签失败
你的代码
报错详情
Alipay Sign Verify FAILED
sdk 日志
nginx/apache 日志